Bug 443775 - Cannot comment out macro definitions
Summary: Cannot comment out macro definitions
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 8
Hardware: All
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-04-23 09:13 UTC by Stefan Ring
Modified: 2008-04-24 08:09 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2008-04-23 09:58:09 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Test .spec file (360 bytes, text/plain)
2008-04-23 09:15 UTC, Stefan Ring
no flags Details

Description Stefan Ring 2008-04-23 09:13:05 UTC
Description of problem:

The RPM guide says:  Any line starting with a hash character, #, holds a comment. RPM will ignore 
comments.

Unfortunately, this is not the case.


Version-Release number of selected component (if applicable):
4.4.2.2-7.fc8

How reproducible:
Use the attached .spec file

Steps to Reproduce:
1. Use rpmbuild -bc on the .spec file
2.
3.
  
Actual results:
+ echo 'Should be empty: but it is not'

Expected results:
+ echo 'Should be empty: '


Additional info:
Very nasty...

Comment 1 Stefan Ring 2008-04-23 09:15:09 UTC
Created attachment 303461 [details]
Test .spec file

Where did my attachment go...?

Comment 2 Panu Matilainen 2008-04-23 09:58:09 UTC
Yup, macros are expanded even in comments. This is fairly well known and
intended behavior, documented in RPM Guide and various other places. Quote from
http://docs.fedoraproject.org/drafts/rpm-guide-en/ch09s02.html#id2970430

---
 Avoid single percent signs, %, in comments. For example:

# Added new commands to %prep

The rpmbuild command may report an error of a second %prep section. To get
around this problem, use two percent signs, such as %%prep, in spec file comments.
---

Comment 3 Stefan Ring 2008-04-24 08:04:51 UTC
Ok thanks for the clarification. It's not a very "discoverable" feature, I would
say...

Apparently that's the reason I haven't understood rpm macros for years - every
attempt at playing around with them failed completely and utterly because I
commented out something (or so I thought), and it didn't have any effect.

Comment 4 Stefan Ring 2008-04-24 08:09:42 UTC
Maybe vim and emacs syntax coloring rules should be changed for spec files. I
tend to rely on the visual feedback for such mundane tasks.

PS Sorry for the spam but somehow pressing a submit button always results in a
flurry of new thoughts... ;)


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