Ticket #847 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

RFE: ability to show scriptlet program arguments

Reported by: scop Assigned to: pmatilai
Priority: minor Milestone: rpm-4.10.0
Component: rpm Version: RPM Development
Keywords: Cc:

Description

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)

Change History

09/12/11 06:00:54 changed by pmatilai

  • owner changed from RpmTickets to pmatilai.
  • status changed from new to assigned.

The trick is that FOOPROG tags are actually arrays if more than one argument is present (see http://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).

(follow-up: ↓ 3 ) 09/12/11 09:40:07 changed by pmatilai

  • status changed from assigned to closed.
  • resolution set to fixed.

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)

(in reply to: ↑ 2 ) 09/13/11 18:17:36 changed by scop

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

05/28/12 16:12:56 changed by pmatilai

  • milestone set to rpm-4.10.0.