Opened 4 years ago
Last modified 3 years ago
Reported by: scop Assigned to: pmatilai Priority: minor Milestone: rpm-4.10.0 Component: rpm Version: RPM Development Keywords: Cc:
There does not seem to be any way to display scriptlet program arguments.
For example, for %post -p "/bin/echo hello"
I could not find any way
to get the "hello" displayed or queried, only the /bin/echo part is
shown.
$ rpm -qp --scripts foo-1.0-3.fc14.x86_64.rpm
postinstall program: /bin/echo
$ rpm -qp --qf="%{POSTINPROG}\n" foo-1.0-3.fc14.x86_64.rpm
/bin/echo
$ rpm -qp --qf="%{POSTINFLAGS}\n" foo-1.0-3.fc14.x86_64.rpm
(none)
The trick is that FOOPROG tags are actually arrays if more than one argument is present (see https://rpm.org/gitweb?p=rpm.git;a=blob;f=build/parseScript.c;hb=HEAD from line 326 onwards). You can use --qf="[%{POSTINPROG} ]\n" to get the other arguments.
Thanks for pointing this out, there are a few places that should be updated to reflect the reality: --scripts alias needs to use the array query format and VERIFYSCRIPTPROG is missing completely from the output. Will fix. Also the tag types in rpmtag.h probably need changing from "s" to "s[]", although I need to verify it doesn't break anything else (the tag types are supposedly static but there are a few exceptions like this where things get a bit funny).
Okay, fixed in HEAD, --scripts query now also shows all scriptlet interpreter arguments if present:
[pmatilai@localhost ~]$ rpm -qp --scripts /home/pmatilai/rpmbuild/RPMS/x86_64/argtest-1.0-4.x86_64.rpm
preinstall program: /bin/echo -a -c -e
postinstall scriptlet (using /bin/sh -x):
echo "echo this"
preuninstall scriptlet (using /bin/bash --posix --version -l -v -x):
echo "echo that"
postuninstall scriptlet (using /bin/sh):
echo "postun, nuting special"
posttrans scriptlet (using /usr/bin/python):
print "foo"
verify program: /sbin/ldconfig -x -y
[pmatilai@localhost ~]$
While at it, some related bugs also fixed: accessing the fooprog tags are now defined as array types, meaning eg python accessing them will return the full array instead of just the first item. In addition, %verifyscript interpreter wasn't shown at all, and attempting to pass arguments to trigger scriptlet interpreters now fails at build-time (previously they were just silently discarded).
BTW if rpmlint examines the fooprog tags, it'll need to be adjusted to expect arrays whereas it previously just got single strings (and for compatibility, it probably should handle both cases the best it can)
Replying to pmatilai:
BTW if rpmlint examines the fooprog tags, it'll need to be adjusted to expect arrays whereas it previously just got single strings (and for compatibility, it probably should handle both cases the best it can)
Thanks, hopefully done sufficiently in http://rpmlint.zarb.org/cgi-bin/trac.cgi/changeset/1885