Bug 184196

Summary: Unclosed macro in comment causes rpmbuild to fail
Product: [Fedora] Fedora Reporter: Hann-Huei Chiou <koala>
Component: rpmAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED NOTABUG QA Contact: Mike McLean <mikem>
Severity: low Docs Contact:
Priority: medium    
Version: 4   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-07 16:50:49 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 Hann-Huei Chiou 2006-03-07 04:52:02 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060202 Fedora/1.7.12-1.5.2

Description of problem:
I was trying to build my own RPM this morning. The spec file
was modified from a known working one. After a little
tweaking, I found that rpmbuild won't execute the %install
stage and wrote the source rpm only.

After a careful inspection, I noticed that a "%{version" was
in the comment (in %build stage). The rest of %build stage
were skipped, so does %install, %pre, %post and %files. Only
the source rpm was written.

I took another official source rpm (tree and kernel) for
testing. Just put a macro without a right brace (# %{name)
in the comment. When rpmbuild saw this, a "+ exit 0" was
executed, thus the rest of the spec file were skipped.

This bug exists on both i386 and x86_64 platforms.


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

How reproducible:
Always

Steps to Reproduce:
1. Install any source rpm
2. Edit the spec file and put "# %{name" in the beginning of the %build stage
3. Execute "rpmbuild -ba XXXX.spec"
  

Actual Results:  1. rpmbuild skipped the %build stage and the rest of the spec file and wrote
 only the source rpm:
+ exit 0
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/tree-root
Wrote: /usr/src/redhat/SRPMS/XXXX-A.B.C-D.src.rpm


Expected Results:  binary rpms were successfully built (or failed with messages).

Additional info:

Why does rpmbuild try to parse the comment?

Comment 1 Jeff Johnson 2006-03-07 16:50:49 UTC
Macros are expanded everywhere they are found, including comments. Escape
the macro with '%%' is you don't want it expanded.

This is a syntax error, not otherwise.

Comment 2 Sabrina Lynch 2024-06-12 08:53:46 UTC Comment hidden (spam)
Comment 3 danisa 2024-12-16 02:15:42 UTC Comment hidden (spam)