Bug 450060 - rpmbuild does not honor comment for define
Summary: rpmbuild does not honor comment for define
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 8
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-06-05 00:55 UTC by Antony Sequeira
Modified: 2008-10-04 11:06 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-10-04 11:06:24 UTC
Type: ---


Attachments (Terms of Use)

Description Antony Sequeira 2008-06-05 00:55:31 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.14) Gecko/20080416 Fedora/2.0.0.14-1.fc8 Firefox/2.0.0.14

Description of problem:
rpm spec files ignore # if it precedes %define
In the followimg example, we see echo of 222 instead of 111

[antony@linuxlaptop1 ~]$ cat foo.spec
%define aaa 111
#%define aaa 222

Name: foo
Version: 1.0
Release: 5
License: Xyz
Group: System/Application
Summary: test bug of commenting defines

%prep
echo %{aaa}

%description
test bug of commenting defines
[antony@linuxlaptop1 ~]$ rpmbuild -bb -v foo.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.12193
+ umask 022
+ cd /usr/src/redhat/BUILD
+ echo 222
222
+ exit 0
Checking for unpackaged file(s): /usr/lib/rpm/check-files %{buildroot}


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

How reproducible:
Always


Steps to Reproduce:
1.copy the spec file above from the description
2.run the rpmbuild command
3.see 222 echoed instead of the expected 111

Actual Results:
echoes 222

Expected Results:
see 111

Additional info:

Comment 1 Ville Skyttä 2008-06-05 17:40:44 UTC
rpmdevtools has no chance to affect this, reassigning to rpm.

Comment 2 Panu Matilainen 2008-10-04 11:06:24 UTC
This has always been the case: %define is a macro and macros are expanded everywhere, comments included and you need to use %%define to escape. Not a bug, but "intended behavior".

That said, the behavior has been criticized a lot and I don't disagree at all, the rules for spec comments are clear as mud because % is overloaded to mean section markers, macros and various other items like %config(...) attributes, "internal" macros like %patch are behave differently from "real" macros etc. The problem is, really sorting out the mess would require incompatible changes to the spec "syntax".

The behavior is not going to change for Fedora 8 (hence WONTFIX), if you want to discuss it further feel free to open a ticket at rpm.org.


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