From nobody Tue Oct 08 07:07:46 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 4XN6Xy4B9dz5Z4T0; Tue, 08 Oct 2024 07:07:46 +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 4XN6Xy1tYBz42Yg; Tue, 8 Oct 2024 07:07:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728371266; 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=CZPr9PGuHEUBOBEmeETDNYynvyoxr6+ZCLp871khvws=; b=TmBxHDkx8FmuZFtBxoVbmJqYeUCq7K/ARh87cSQBcEcZBxvkWHmV5MvaGQtRrj/Qse97+i Qi0/IYDnWIVm0ojHn9fjrPA1VcDVS9rVd6XruJMhv9d6jqkvw1mn29kLOvLJTMmR7jr/wE gK6vX6RK7jscflxFb6o3ejJZJeobcW9jJV+tRMOrAYgwHlkEqcrDZVjUBkvT/3dxWJJcTo FRku3CwuefrkJd9GZ/yIWbh/ZDcIgX/KMkDLnRiSUwE2k7JJaJswJ62QbcINqUPe4Di6I8 HSe5Wu0Il3v1MdTZE+bAAmUmuz8Xol39s7ESsNU1ATHs73XbgzEuCSa7maQ/ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728371266; 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=CZPr9PGuHEUBOBEmeETDNYynvyoxr6+ZCLp871khvws=; b=KKlsHfNu4rRfSk9pX9fgCwvYlci1QiFZcuK+/5ACLqm5wiqxveU7cBPMjdnCSOuILCbVYG DSvnAarbKMBuZhXDsyd57shtoEEeunJjRWMIzVdmA0RbWgae8LhLbGwKbIC/WNwlktbGc6 QAKEyD1Xq3gnwKMql1G+9Bchmxiyl/7U77P432zAfd4+4eacYxBMMsTRWgPCVL3dat+ECd WPRD2K/Ggz7XESSOCV8YQvFQHcgsxbuMrgZY7+NRsWDyfN//NDC+dhv8xEicGtoZkvwFvG BXGIHpYpjZjL9HTbYtGIXgrHC5UrP2Exm9CUxMwxw4aXRmDjn73HfrGlJslSag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728371266; a=rsa-sha256; cv=none; b=eQZiSjZIs2VwE05w7u97XIiTM7DSbDBk7k8hzcefbeRU8ijd1Jez5ULH+yunYxS6b3f220 M+OPGqDxFZBUb9MN6MisKUt1EIlCEg6JtzhQhg4U/Wc86zwE5542ygm8FP1Ac3V/HMWAcT gZCNb6utOOTI7esmtOY0Dv0x2JWo1zqhlvONTr7NIvuAZ4JSVpA2ZJp63nlK9AmE83QBEk n6C7quFyEyYHXBsW+PfhUHCg/RGAjjyQ/ZH1FlNQHjDWHVrZcLtPIrhXKW5HfCUT+JTwVq v88SDChvl2QIE7rBp8wP8CG3f6PzKaDk8UcIkFWIU6ClCotfq98RWG7zWBi/WA== 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 4XN6Xy0qb6zL9D; Tue, 8 Oct 2024 07:07:46 +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 49877k2q051485; Tue, 8 Oct 2024 07:07:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49877kn4051482; Tue, 8 Oct 2024 07:07:46 GMT (envelope-from git) Date: Tue, 8 Oct 2024 07:07:46 GMT Message-Id: <202410080707.49877kn4051482@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 1eaf3331eaee - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 1eaf3331eaee56f012191195dc3e688f5284f69d Auto-Submitted: auto-generated The branch stable/14 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=1eaf3331eaee56f012191195dc3e688f5284f69d commit 1eaf3331eaee56f012191195dc3e688f5284f69d Author: Jose Luis Duran AuthorDate: 2024-07-30 00:37:10 +0000 Commit: Baptiste Daroussin CommitDate: 2024-10-08 07:04:01 +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 (cherry picked from commit 9b2d92addc31ba6f5696c85d184a45d43e9073dc) --- 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