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.
This commit is contained in:
parent
2490b95b86
commit
e72e5cf604
15
setup.spec
15
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 <lua>
|
||||
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 <zbyszek@in.waw.pl> - 2.13.10-2
|
||||
- Fix %%post scriptlet to not require the shell
|
||||
|
||||
* Sat May 07 2022 Martin Osvald <mosvald@redhat.com> - 2.13.10-1
|
||||
- Move /var/log/lastlog ownership to systemd (#1798685)
|
||||
- tcsh sets variable p to /usr/sbin from /etc/csh.login (#2019874)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user