Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
in spec files, lines starting with '#' should be treated as comments and have no influence on the build process. However, this is not always the case.
Version-Release number of selected component (if applicable):
RPM-Version 4.8.0
RPM-Version 4.7.2
(probably others as well)
How reproducible:
Steps to Reproduce:
1. create a spec file test.spec:
# test.spec
%{!?version: %define version 1.0}
%{!?name: %define name test}
%{!?release: %define release 1.0}
# %define is_client nothing # this line is commented out
%{!?is_client: %define is_client 1}
Summary: Test of the rpm build system
Name: %{name}
Version: %{version}
Release: %{release}
License: GPL
Provides: %{name} = %{version}
%description
Test of the rpm build system
%prep
echo "the value of is_client is --%{is_client}--"
2. run rpmbuild -ba test.spec
Actual results:
rpmbuild -ba /usr/src/rpmbuild/SPECS/test.spec
Ausführung(%prep): /bin/sh -e /var/tmp/rpm-tmp.enFbre
+ umask 022
+ cd /usr/src/rpmbuild/BUILD
+ echo the value of is_client is --nothing # this line is commented out--
the value of is_client is --nothing # this line is commented out--
+ exit 0
Prüfe auf nicht gepackte Datei(en): /usr/lib/rpm/check-files /usr/src/rpmbuild/BUILDROOT/test-1.0-1.0.i386
Erstellt: /usr/src/rpmbuild/SRPMS/test-1.0-1.0.src.rpm
Expected results:
Ausführung(%prep): /bin/sh -e /var/tmp/rpm-tmp.lFcTLx
+ umask 022
+ cd /usr/src/rpmbuild/BUILD
+ echo the value of is_client is --1--
the value of is_client is --1--
+ exit 0
Prüfe auf nicht gepackte Datei(en): /usr/lib/rpm/check-files /usr/src/rpmbuild/BUILDROOT/test-1.0-1.0.i386
Erstellt: /usr/src/rpmbuild/SRPMS/test-1.0-1.0.src.rpm
Additional info:
the value should be 1 in this case (which one could use for instance in a %if statement). It should not be influenced by something on a line starting with '#'
Hi Panu,
Ok, but intuitively I wouldn't understand %define itself as a macro.
If the macros which are already defined are expanded inside a comment, it wouldn't matter because the line is commented out anyway. The documentation explicitly speaks about multiline macros, that would add new lines which then "run out of the commented area", that's plausible. But %define rather seems to be a command than a macro, because it is not replaced by anything, but defines a macro.
I would recommend to add an extra note to the documentation, that everything (including %define) is interpreted even on lines starting with a '#'-sign. The example with the %configure-macro nicely illustrates the problem with multiline macros, but the issue with %define is not that obvious.
I must admit, that I have found the list of builtin macros (http://www.rpm.org/wiki/PackagerDocs/Macros#BuiltinMacros) now, which includes %define. But since this is different from the C-preprocessor for example, I would at least add the link to this list on the page of the documentation you have posted.
best regards,
Martin
Description of problem: in spec files, lines starting with '#' should be treated as comments and have no influence on the build process. However, this is not always the case. Version-Release number of selected component (if applicable): RPM-Version 4.8.0 RPM-Version 4.7.2 (probably others as well) How reproducible: Steps to Reproduce: 1. create a spec file test.spec: # test.spec %{!?version: %define version 1.0} %{!?name: %define name test} %{!?release: %define release 1.0} # %define is_client nothing # this line is commented out %{!?is_client: %define is_client 1} Summary: Test of the rpm build system Name: %{name} Version: %{version} Release: %{release} License: GPL Provides: %{name} = %{version} %description Test of the rpm build system %prep echo "the value of is_client is --%{is_client}--" 2. run rpmbuild -ba test.spec Actual results: rpmbuild -ba /usr/src/rpmbuild/SPECS/test.spec Ausführung(%prep): /bin/sh -e /var/tmp/rpm-tmp.enFbre + umask 022 + cd /usr/src/rpmbuild/BUILD + echo the value of is_client is --nothing # this line is commented out-- the value of is_client is --nothing # this line is commented out-- + exit 0 Prüfe auf nicht gepackte Datei(en): /usr/lib/rpm/check-files /usr/src/rpmbuild/BUILDROOT/test-1.0-1.0.i386 Erstellt: /usr/src/rpmbuild/SRPMS/test-1.0-1.0.src.rpm Expected results: Ausführung(%prep): /bin/sh -e /var/tmp/rpm-tmp.lFcTLx + umask 022 + cd /usr/src/rpmbuild/BUILD + echo the value of is_client is --1-- the value of is_client is --1-- + exit 0 Prüfe auf nicht gepackte Datei(en): /usr/lib/rpm/check-files /usr/src/rpmbuild/BUILDROOT/test-1.0-1.0.i386 Erstellt: /usr/src/rpmbuild/SRPMS/test-1.0-1.0.src.rpm Additional info: the value should be 1 in this case (which one could use for instance in a %if statement). It should not be influenced by something on a line starting with '#'