Bug 124458 - rpmbuild macroprocessing error with commented out _sourcedir
rpmbuild macroprocessing error with commented out _sourcedir
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: rpm (Show other bugs)
3.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-05-26 15:09 EDT by Aleksandr Brezhnev
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-05-26 17:01:00 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)

  None (edit)
Description Aleksandr Brezhnev 2004-05-26 15:09:03 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2)
Gecko/20030716

Description of problem:
If rpm spec file has commented out %define statement for _topdir or
_sourcedir, rpmbuild does not undestand that they are commented out
and performs assignments.


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


How reproducible:
Always

Steps to Reproduce:
1.Put spec file like an example below to your %{_topdir}/SPECS directory.

===== Begin of bug.spec =====
Summary: rpmbuild macro processing bug example
Name: bug
Version: 1
Release: 1
Group: Examples
Source0: example.tar.gz
License: free
Buildroot:%{_tmppath}/%{name}-%{version}

# %define _sourcedir /tmp

%description
This is an example to demonstrate rpmbuild macroprocessing bug.

%prep
%setup -n bug
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/tmp
cp example $RPM_BUILD_ROOT/tmp

%clean
rm -rf $RPM_BUILD_ROOT

%files
%attr(0644,root,root) /tmp/example
===== End of bug.spec =====

Copy bug.spec to good.spec and remove a line with commented out
%define statement from good.spec:

===== Begin of good.spec =====
Summary: rpmbuild macro processing bug example
Name: bug
Version: 1
Release: 1
Group: Examples
Source0: example.tar.gz
License: free
Buildroot:%{_tmppath}/%{name}-%{version}

%description
This is an example to demonstrate rpmbuild macroprocessing bug.

%prep
%setup -n bug

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/tmp
cp example $RPM_BUILD_ROOT/tmp

%clean
rm -rf $RPM_BUILD_ROOT

%files
%attr(0644,root,root) /tmp/example
===== End of good.spec =====

2.Create an example.tar.gz and put it into your %_sourcedir directory.
E.g., 
mkdir bug
echo "Sample file" > bug/example
tar zcvf SOURCES/example.tar.gz bug

3.Try to run "rpmbuild -bp bug.spec
    

Actual Results:  
$ rpmbuild -bp bug.spec
error: File /tmp/example: No such file or directory

Expected Results:  
$ rpmbuild -bp good.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.4950
+ umask 022
+ cd /home/devel/rpm/BUILD
+ cd /home/devel/rpm/BUILD
+ rm -rf bug
+ /usr/bin/gzip -dc /home/devel/rpm/SOURCES/example.tar.gz
+ tar -xvvf -
drwxrwxr-x devel/devel       0 2004-05-26 14:49:46 bug/
-rw-rw-r-- devel/devel      12 2004-05-26 14:49:46 bug/example
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd bug
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
+ /bin/chmod -Rf a+rX,g-w,o-w .
+ exit 0



Additional info:
$ rpm -q rpm-build
rpm-build-4.2.2-0.14

$ uname -r
2.4.21-9.ELsmp
Comment 1 Jeff Johnson 2004-05-26 17:01:00 EDT
macros are entirely context free, are expanded everywhere
they are found, in comments, within quotes, everywhere.

Do
   # %%foo
to disable the expansion. Note the 2nd %.

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