Bug 90428 - rpm removes '%-...' conversions in scriptlets
rpm removes '%-...' conversions in scriptlets
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
9
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2003-05-08 16:28:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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
Vendor: CSIRO-MIT
URL: http://www.csiro.au/
Group: none
Packager: Murray.Jensen@csiro.au

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

%description

A simple test package...

%pre

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

%post

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

%preun

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

%postun

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

%files

%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):
rpm-4.2-0.69

How reproducible:
Always

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.