Bug 99343 - cannot add rpm macro files using command line flags
cannot add rpm macro files using command line flags
Status: CLOSED WORKSFORME
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-07-17 17:56 EDT by Ben Liblit
Modified: 2007-04-18 12:55 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-07-17 19:24:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
/var/tmp/rpmrc (63 bytes, text/plain)
2003-07-17 19:21 EDT, Jeff Johnson
no flags Details
/var/tmp/macros (15 bytes, text/plain)
2003-07-17 19:24 EDT, Jeff Johnson
no flags Details

  None (edit)
Description Ben Liblit 2003-07-17 17:56:30 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686) Gecko/20030509 Galeon/1.3.5

Description of problem:
Suppose you have some additional RPM macro definitions in a standalone file.  I
cannot figure out any way to add that file to RPM's list using any of the RPM
command line flags.  Both "rpm" and "rpmbuild" are affected.

Using "--macros" is completely ineffective, as already documented in bug 56833.
 That bug was closed with the suggestion to use "--rcfiles" instead.  Using
"--rcfiles" appears to change the "macrofiles" list displayed by "--showrc", but
the macros defined in the added file are not actually present.

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

How reproducible:
Always

Steps to Reproduce:
1. Create "/var/tmp/macros" with the following contents, unindented:

    mymacro whee!

2. Try to use this macro file directly:

    rpm --macros=/var/tmp/macros --eval %mymacro

3. Look for this macro file on the list of loaded macro files:

    rpm --macros=/var/tmp/macros --showrc | fgrep macrofiles

4. Per the recommendation in bug 56833, create "/var/tmp/rpmrc" with the
following contents, unindented:

    include: /usr/lib/rpm/rpmrc
    macrofiles: /var/tmp/macros

5. Try to use our macro file again, this time indirectly:

    rpm --rcfile=/var/tmp/rpmrc --eval %mymacro

6. Look again for our macro file on the list of loaded macro files:

    rpm --rcfile=/var/tmp/rpmrc --showrc | fgrep macrofiles


Actual Results:  Step 2 prints "%mymacro", and step 3 does not show
"/var/tmp/macros" on the list of loaded macro files.  This basically reproduces
the problem described in bug 56833.

Step 5 also prints "%mymacro", even though step 6 does show "/var/tmp/macros" at
the end of the list of loaded macro files.  Thus, the workaround suggested in
bug 56833 does not work either.

Expected Results:  If bug 56833 were fixed, step 2 should have printed "whee!",
and step 3 should have shown "/var/tmp/macros" on the list of loaded macro files.

If the suggested workaround for bug 56833 worked, step 5 should have printed
"whee".  It is especially strange that this fails even though step 6 does
correctly show "/var/tmp/macros" at the end of the list of loaded macro files.

Additional info:

It's not clear to me whether this is a distinct bug or simply a regression of
the suggested workaround for 56833.  The distinction is moot: I don't appear to
have permission to reopen bug 56833, so all I can do here is open a new report.

The heart of the matter is this: 56833 is still a problem, and the suggested
workaround doesn't work.
Comment 1 Jeff Johnson 2003-07-17 19:21:46 EDT
Created attachment 92995 [details]
/var/tmp/rpmrc
Comment 2 Jeff Johnson 2003-07-17 19:24:29 EDT
Created attachment 92996 [details]
/var/tmp/macros
Comment 3 Jeff Johnson 2003-07-17 19:24:56 EDT
Um, no. The attached rpmrc/macro files, when placed in /var/tmp
produce the following:

bash$ rpm --rcfile /var/tmp/rpmrc --eval '%{mymacro}'
whee!
Comment 4 Ben Liblit 2003-07-17 19:38:51 EDT
Aah, now I see.  Pilot error on my part.  The macro definitions in
/var/tmp/macros need to have "%" before the macro name:

    %mymacro whee!

Jeff, thanks for lending me a clue.  Sorry to have wasted your time on so
foolish a mistake.

It's a shame RPM didn't present an error message when I left out the "%".  I
wonder what it thought I was trying to say there....

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