Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 90428 - rpm removes '%-...' conversions in scriptlets
rpm removes '%-...' conversions in scriptlets
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2003-05-07 22:20 EDT by Murray Jensen
Modified: 2007-04-18 12:53 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-05-08 16:28:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Murray Jensen 2003-05-07 22:20:24 EDT
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 16:28:28 EDT
Escape (by doubling '%%') the per cents.

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