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...
Created attachment 303461 [details] Test .spec file Where did my attachment go...?
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. ---
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.
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... ;)