[Bugs] [Bug 1315024] glusterfs-libs postun scriptlet fail /sbin/ldconfig: relative path `1' used to build cache
bugzilla at redhat.com
bugzilla at redhat.com
Tue Mar 8 16:48:57 UTC 2016
https://bugzilla.redhat.com/show_bug.cgi?id=1315024
--- Comment #9 from Vijay Bellur <vbellur at redhat.com> ---
COMMIT: http://review.gluster.org/13613 committed in master by Kaleb KEITHLEY
(kkeithle at redhat.com)
------
commit 5cb80ac63b17a3c34d4deef1816e1782757687d9
Author: Kaleb S KEITHLEY <kkeithle at redhat.com>
Date: Sat Mar 5 16:06:18 2016 -0500
packaging: rpm scriptlet cleanup, handle -p /sbin/ldconfig
The RPM documention indicates that during an rpm install or erase, the
script(lets): %post, %preun, and %postun (and %pre, %build, %install,
etc.) are copied to a temp file, and then the temp file is run as a
(/bin/sh or bash) script.
Unfortunately the documentation is not clear about how rpmbuild and/or
rpm determine where the end of any scriptlet is when it is copied to
the file.
Most things in the glusterfs.spec work correctly as is. These are the
%preun, %post, and %postun scriptlets that are "closed" by a following
%preun, %post, and %postun, or poetentially another scriptlet, e.g.
%file.
The ones that don't work correctly (only one actually) are those where
there is a comment in the spec file before it is closed by another
scriptlet. Further complicating things is that the type of scriptlet
affects what rpm does and what `rpm -qp --scripts ...` shows.
The specific one that didn't work was the "%postun libs" scriptlet. It
is followed by a comment before being "closed" by the %files section (or
scriptlet). It can be written two ways: "%postun libs\n/sbin/ldconfig"
or "%postun libs -p /sbin/ldconfig" Either way it's written, `rpm -qp
--scripts glusterfs-libs...` will include the comment lines between the
%postun libs line and the following %files line.
But the way rpm executes these depends on how they're written. If
written as "%postun libs\n/sbin/ldconfig" rpm will simply run
/sbin/ldconfig with no command line options, i.e.
execve ("/sbin/ldconfig", [ "/sbin/ldconfig" ], [ ]);
But when written as "%postun libs -p /sbin/ldconfig", it will copy
the comment lines to a temp file, and pass the temp file name and "1"
as (command line) parameters, i.e.
execve ("/sbin/ldconfig", [ "/sbin/ldconfig", "/tmp/tmpXXXXXX", "1" ],
[ ]);
Which results in ldconfig exiting with an error. (Remember, both ways show
the comment in `rpm -qp --scripts ...`)
(Note though, that the similar "%postun api -p /sbin/ldconfig" is run
correctly, because it is "closed" by the following "%postun server"
scriptlet.)
Finally, through trial and error, it appears that rpm can be tricked with
a hack, and "closure" of the scriptlet forcedlike this:
%postun libs -p /sbin/ldconfig
%if ( 0%{?_undocumented_hack_closes_scriptlets} )
%postun
%endif
in which case ldconfig appears to run correctly. Note also that here too
the comment will be included in the output of `rpm -qp --scripts ...`
But that's very ugly hack.
Change-Id: I587a490ddcdf47d01605479bc8ef8b0e439108fb
BUG: 1315024
Signed-off-by: Kaleb S KEITHLEY <kkeithle at redhat.com>
Reviewed-on: http://review.gluster.org/13613
Smoke: Gluster Build System <jenkins at build.gluster.com>
Reviewed-by: Niels de Vos <ndevos at redhat.com>
NetBSD-regression: NetBSD Build System <jenkins at build.gluster.org>
CentOS-regression: Gluster Build System <jenkins at build.gluster.com>
Reviewed-by: Raghavendra Talur <rtalur at redhat.com>
--
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug https://bugzilla.redhat.com/token.cgi?t=0LA1JViFxY&a=cc_unsubscribe
More information about the Bugs
mailing list