From nobody Thu Sep 26 11:06:17 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XDrPj5FPTz5X7qc; Thu, 26 Sep 2024 11:06:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XDrPj2tW1z4H8h; Thu, 26 Sep 2024 11:06:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727348777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=09TOVnQiXXADqOQ8FR1f/IzQbJQT9/BoDNEq6Wmkib4=; b=fVLbTRVMpYXT7QFH1Gwq2+hyc142I2AfGzK1h41CNaY9Igw8eLjLTsKggcEhyoob7x9Piv S74i26YS2DdwnBoMmo2GmxkOFT/9hQKBgJMiJpY/eoq4lc/RVZe4zFnHqgdLfVAEp6Xcjl wOp3eRdya20C8po4siSqJuhrSmHxjkzfTgeuikitAzj3unkEPMvmNfVjExI8aCDvP7JayF dezYzO6+YMUYxl3dwvXCUU9j7EL7K5VJA7n4l+KlKMkHfWt7wbu/LeX/cCIA0D5OmjwJJY RHr6cLI7RVKG9gQ3hrazKFJ6MorvPryD3fAhnEW/uL8Xt4ZefgnInLf0zsSQlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727348777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=09TOVnQiXXADqOQ8FR1f/IzQbJQT9/BoDNEq6Wmkib4=; b=yRRGSA21MkQBcq/xfzoztvH7cHkM2nX7bUtvpRsxsfTxf0ScMw3IUm5ZcL64y4kD8wXjZG 8ZelDM8eA5A6gFjIjdEe6gw5S+EWrmR9bxI0zOiDMcooAZLioHtP96eQQBla0O9+sqJeOm medKfUbixIgTX9YNf1lW1U80QODcE/Ek2bH2JqR7YyoET1u/5SacJAhDDVNVi/mLHnn8vM ISRR+9epPip0/9c8191C+2iggQzzVyKhvLzW/OWkOomMw/fz5MvtMymsWSZ2QG189uk4FX lRPFNxm7YW/g/1JkOibT6horMG6eCH1MzfcWcJECilStp/5ZpTqAd0ejWRbL+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727348777; a=rsa-sha256; cv=none; b=l6qsn6+iSMMzT209ZurfWhIpWIjtabno7CwYdw3l0ljJ58vWEBY202fDggVfYgU5ygezUO 6T9hXHghsLZ0aRKrR9RN0GMkssqUHor/TxQWmH1X4uY5OPojyT2pWBEX4lJCcDfLpHdRkI NQ5PVJqQdcxnDXf4h+Akpb7AkS4Yk0J1UpXt4dl6IGuSd6ryUaRuReUwP9KxKwSm5L/y9M XEftdBtkfvl0qDQV02ZoDiI7fpCdNcURkSVfSo48qw/1QGBFhT55NBL1fy5jZ2h+2fQTrT e70NmZIBhgm7UpCnXcUOEnilaC/SfkPzecAp8/xIU3zSURvHFsYDYjPnlXfemw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XDrPj1nVxzv7L; Thu, 26 Sep 2024 11:06:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48QB6HaP063470; Thu, 26 Sep 2024 11:06:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48QB6HFO063467; Thu, 26 Sep 2024 11:06:17 GMT (envelope-from git) Date: Thu, 26 Sep 2024 11:06:17 GMT Message-Id: <202409261106.48QB6HFO063467@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 9b2d92addc31 - main - nuageinit: Replace os.execute with Lua libraries List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b2d92addc31ba6f5696c85d184a45d43e9073dc Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=9b2d92addc31ba6f5696c85d184a45d43e9073dc commit 9b2d92addc31ba6f5696c85d184a45d43e9073dc Author: Jose Luis Duran AuthorDate: 2024-07-30 00:37:10 +0000 Commit: Baptiste Daroussin CommitDate: 2024-09-26 10:59:00 +0000 nuageinit: Replace os.execute with Lua libraries Prefer posix.sys.stat's chmod() to os.execute(). While here, change the name of the locals to be more descriptive. Signed-off-by: Jose Luis Duran --- libexec/nuageinit/nuage.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua index d35d3725fa99..1f035036f802 100644 --- a/libexec/nuageinit/nuage.lua +++ b/libexec/nuageinit/nuage.lua @@ -3,8 +3,9 @@ -- -- Copyright(c) 2022 Baptiste Daroussin +local unistd = require("posix.unistd") +local sys_stat = require("posix.sys.stat") local lfs = require("lfs") -local pu = require("posix.unistd") local function warnmsg(str) io.stderr:write(str .. "\n") @@ -206,12 +207,12 @@ local function addsshkey(homedir, key) f:write(key .. "\n") f:close() if chownak then - os.execute("chmod 0600 " .. ak_path) - pu.chown(ak_path, dirattrs.uid, dirattrs.gid) + sys_stat.chmod(ak_path, 384) + unistd.chown(ak_path, dirattrs.uid, dirattrs.gid) end if chowndotssh then - os.execute("chmod 0700 " .. dotssh_path) - pu.chown(dotssh_path, dirattrs.uid, dirattrs.gid) + sys_stat.chmod(dotssh_path, 448) + unistd.chown(dotssh_path, dirattrs.uid, dirattrs.gid) end end