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

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-05-08 20:28:28 UTC
Embargoed:


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

# 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 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.