Bug 1347865

Summary: systemd spec file needs to escape %prep in comment
Product: [Fedora] Fedora Reporter: Pat Cox <lists>
Component: systemdAssignee: systemd-maint
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 25CC: johannbg, lnykryn, msekleta, muadda, ssahani, s, systemd-maint, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://pkgs.fedoraproject.org/cgit/rpms/systemd.git/tree/systemd.spec#n27
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-04 05:07:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pat Cox 2016-06-17 21:26:52 UTC
User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36
Build Identifier: 

The systemd specfile I have is seen here: http://pkgs.fedoraproject.org/cgit/rpms/systemd.git/tree/systemd.spec#n27

rpm (version 4.8.0 on CentOS 6.&) is unable to parse this specfile. See output below.

Reproducible: Always

Steps to Reproduce:
1. download systemd specfile
2. run `rpm -q --qf "%{Name}" --specfile ~/systemd/specfiles/systemd.spec`
Actual Results:  
error: line 217: second %prep
error: query of specfile ~/systemd/specfiles/systemd.spec failed, can't parse

Expected Results:  
systemdsystemd-libssystemd-compat-libssystemd-pamsystemd-develsystemd-udevsystemd-containersystemd-journal-remotesystemd-debuginfo

According to http://www.rpm.org/max-rpm-snapshot/ch-rpm-inside.html, the %prep macro on the comment line needs to be escaped:
"Comments can be placed in any section of the spec file. Note that macros are expanded everywhere, so with multiline macros which would only have the first line commented also escape the percent (%) character:"

Changing '%prep' to '%%prep' on line 27 fixes the parsing.
$ rpm -q --qf "%{Name}" --specfile ~/systemd/specfiles/systemd.spec
systemdsystemd-libssystemd-compat-libssystemd-pamsystemd-develsystemd-udevsystemd-containersystemd-journal-remotesystemd-debuginfo

Comment 1 Jan Kurik 2016-07-26 05:06:54 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 2 Zbigniew Jędrzejewski-Szmek 2016-08-04 05:07:32 UTC
Fixed in edb4e050132b3c8d7764b73d0d7dc564aba51d8f.