From e72e5cf604faf61ae9ebceb61a591e3d4c0d8c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 24 Feb 2022 00:23:10 +0100 Subject: [PATCH] Fix %post scriptlet to not require the shell os.execute uses /bin/sh, which to a large extent defeats the purpose of having the scriptlet in lua ;) $ strace -qq -ff -eexecve rpm -E "%{lua:os.execute('true')}" execve("/usr/bin/rpm", ["rpm", "-E", "%{lua:os.execute('true')}"], 0x7ffd180ce638 /* 60 vars */) = 0 [pid 849466] execve("/bin/sh", ["sh", "-c", "true"], 0x7fff73cfc9d8 /* 60 vars */) = 0 Let's use posix.exec(). rpm.execute() would be nice, but it does not support suppressing of stderr. --- setup.spec | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/setup.spec b/setup.spec index 65afa5e..a069e92 100644 --- a/setup.spec +++ b/setup.spec @@ -1,7 +1,7 @@ Summary: A set of system configuration and setup files Name: setup Version: 2.13.10 -Release: 1%{?dist} +Release: 2%{?dist} License: Public Domain Group: System Environment/Base URL: https://pagure.io/setup/ @@ -68,10 +68,16 @@ rm -rf %{buildroot}/etc/contrib #handle it ( http://rpm.org/ticket/6 ) %post -p for i, name in ipairs({"passwd", "shadow", "group", "gshadow"}) do - os.remove("/etc/"..name..".rpmnew") + os.remove("/etc/"..name..".rpmnew") end if posix.access("/usr/bin/newaliases", "x") then - os.execute("/usr/bin/newaliases >/dev/null") + local pid = posix.fork() + if pid == 0 then + posix.redirect2null(2) + posix.exec("/usr/bin/newaliases") + elseif pid > 0 then + posix.wait(pid) + end end %files @@ -114,6 +120,9 @@ end %{_tmpfilesdir}/%{name}.conf %changelog +* Fri May 27 2022 Zbigniew Jędrzejewski-Szmek - 2.13.10-2 +- Fix %%post scriptlet to not require the shell + * Sat May 07 2022 Martin Osvald - 2.13.10-1 - Move /var/log/lastlog ownership to systemd (#1798685) - tcsh sets variable p to /usr/sbin from /etc/csh.login (#2019874)