Bug 450060 - rpmbuild does not honor comment for define
rpmbuild does not honor comment for define
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
8
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Panu Matilainen
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-04 20:55 EDT by Antony Sequeira
Modified: 2008-10-04 07:06 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-10-04 07:06:24 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 Antony Sequeira 2008-06-04 20:55:31 EDT
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 13:40:44 EDT
rpmdevtools has no chance to affect this, reassigning to rpm.
Comment 2 Panu Matilainen 2008-10-04 07:06:24 EDT
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.