Bug 90428 - rpm removes '%-...' conversions in scriptlets
Summary: rpm removes '%-...' conversions in scriptlets
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 9
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: Mike McLean
Depends On:
TreeView+ depends on / blocked
Reported: 2003-05-08 02:20 UTC by Murray Jensen
Modified: 2007-04-18 16:53 UTC (History)
0 users

Clone Of:
Last Closed: 2003-05-08 20:28:28 UTC

Attachments (Terms of Use)

Description Murray Jensen 2003-05-08 02:20:24 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.0.3 (X11; Linux i686; U;) Gecko/0

Description of problem:
Take the following test spec file (test.spec):

Name: test
Version: 1.0
Release: 1
Summary: A test package
License: GPL
URL: http://www.csiro.au/
Group: none
Packager: Murray.Jensen@csiro.au

# need this because we don't have a build dir


A simple test package...


echo "pre: test percent %-14s %14s %+14s % -14s - \$1='$1'"


echo "post: test percent %-14s %14s %+14s % -14s - \$1='$1'"


echo "preun: test percent %-14s %14s %+14s % -14s - \$1='$1'"


echo "postun: test percent %-14s %14s %+14s % -14s - \$1='$1'"


%doc /dev/null

Run "rpmbuild -bb test.spec", then run "rpm -q --scripts -p xxx.rpm"
where "xxx.rpm" is the binary rpm resulting from the "rpmbuild".

You will see that the string '%-14s' has been completely removed from
the script. Other percent conversions remain.

I discovered this while trying to use the "printf" command, or printf
in awk, within a scriptlet, and then trying to left justify a string.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. <create the test.spec file from description>
2. rpmbuild -bb test.spec
3. rpm -q --scripts -p test-1.0-1.i386.rpm

Actual Results:  The scriptlet stored in the binary rpm file was not identical
to the
scriptlet in the spec file

Expected Results:  I expect the scriptlet stored in the binary rpm to be *exactly*
identical to the scriptlet as written in the spec file

Additional info:

Here's what output from command #3 looks like for me:

preinstall scriptlet (using /bin/sh):

echo "pre: test percent  %14s %+14s % -14s - \$1='$1'"
postinstall scriptlet (using /bin/sh):

echo "post: test percent  %14s %+14s % -14s - \$1='$1'"
preuninstall scriptlet (using /bin/sh):

echo "preun: test percent  %14s %+14s % -14s - \$1='$1'"
postuninstall scriptlet (using /bin/sh):

echo "postun: test percent  %14s %+14s % -14s - \$1='$1'"

You will notice a workaround in the output above. The conversion
"% -14s" is NOT removed, and it will still work the same way in both
the "printf" command, and printf in awk, since the space is a
harmless modifier for string conversions.

Comment 1 Jeff Johnson 2003-05-08 20:28:28 UTC
Escape (by doubling '%%') the per cents.

Note You need to log in before you can comment on or make changes to this bug.