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 9508 - %files -f breaks when using RPM shell variables in %setup -n
%files -f breaks when using RPM shell variables in %setup -n
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Depends On:
  Show dependency treegraph
Reported: 2000-02-16 20:35 EST by David D. Kilzer
Modified: 2016-07-01 17:19 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-02-22 05:56:04 EST
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 David D. Kilzer 2000-02-16 20:35:10 EST
If a directory name with an RPM shell variable is used in "%setup -n" with
"%files -f", then RPM won't find the file list.

For example, if this %setup line is used:

%setup -c -n $RPM_PACKAGE_NAME -T

with this %files line (and macro definition):

%define FILE_LIST       rpmfiles.mft
%files -f %{FILE_LIST}

Then RPM will fail to find the %{FILE_LIST} file.

If "$RPM_PACKAGE_NAME" is hard-coded to the actual package name in %setup,
then RPM will function correctly.

I will attach a SPEC file that may be used as a test case.  Note that
/usr/src/redhat/SOURCES/foo.txt will need to be touched before running it.

I am using rpm-3.0.2-5.x (the rpm-3.x upgrade for Red Hat 5.x users) on Red
Hat 5.2.
Comment 1 David D. Kilzer 2000-02-16 20:37:59 EST
%define FILE_LIST       rpmfiles.mft

Name: setup-files-bug
Summary: Demonstrates %setup -n/%files -f bug.
Version: 1.0
Release: 1
Source0: foo.txt
Group: Regression/Test
BuildRoot: /var/tmp/%{name}-buildroot
Copyright: GPL
Prefix: /usr

Demonstrates %setup -n/%files -f bug.


%setup -c -n $RPM_PACKAGE_NAME -T


mkdir -p $RPM_BUILD_ROOT

find . -type f | sed -e 's,^\.,\%attr(-\,root\,root) ,' \


%files -f %{FILE_LIST}

* Wed Feb 16 2000 David Kilzer <ddkilzer@e-markets.com>
- Created spec file
Comment 2 David D. Kilzer 2000-02-16 20:46:59 EST
See also comment from oliver@deeper.co.nz on 02/07/00 22:01 in bug 9091.
Comment 3 Jeff Johnson 2000-02-22 05:56:59 EST
The problem is in
	%setup -c -n $RPM_PACKAGE_NAME -T
The macro %setup does not run in a shell context, so the name is taken
literally as '$RPM_PACKAGE_NAME'.

Use %{name} instead, as that is the macro from which RPM_PACKAGE_NAME
is set.
Comment 4 David D. Kilzer 2000-02-22 10:10:59 EST
Actually, %setup works fine (probably by accident) with -n $RPM_PACKAGE_NAME
since the literal name is used later in a shell context.  It is %files that gets
tripped up later in the build process by doing this.

It would be nice if this 'feature' were documented since it was a pain to track
down, and it is not at all obvious to the casual SPEC file writer.
Comment 5 Jeff Johnson 2000-02-22 10:40:59 EST
"Works fine" only if you like literally '$RPM_PACKAGE_NAME' as a file name.

A spec file is not a shell script, even though sections like %prep of
the spec file are shell scriptlets written in shell.
Comment 6 openshift-github-bot 2016-07-01 17:19:11 EDT
Commit pushed to master at https://github.com/openshift/origin

Merge pull request #9583 from rhcarvalho/issue9508-new-app-env

Merged by openshift-bot

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