I'm using rpm-4.8.0-0.beta1.5 which is supposed to fix a bug with %define, see http://www.redhat.com/archives/fedora-devel-list/2010-January/msg00093.html But I can still get very weird results: 1) take the example and move the first two lines after %prep, like this: --- snip --- Name: macroscope Version: 1.0 Release: 1 License: Testing Summary: Testing macro behavior %description %{summary} %prep %{!?foo: %define foo bar} %define dofoo() true echo 1: %{foo} %dofoo echo 2: %{foo} %files %defattr(-,root,root) --- snip --- 2) rpmbuild -b macroscope.spec The expansion is: 1: bar 2: %{foo} I believe both %{foo} should expand to the same.
This bug appears to have been reported against 'rawhide' during the Fedora 13 development cycle. Changing version to '13'. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
This message is a reminder that Fedora 13 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 13. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '13'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 13's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 13 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Moving to rawhide to avoid timeouting, this hasn't been addressed in later rpm versions either (and in fact, the attempted fix to %define scoping was reverted soon after introducing as it broke other things).
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle. Changing version to '19'. (As we did not run this process for some time, it could affect also pre-Fedora 19 development cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.) More information and reason for this action is here: https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19
Moving to rawhide to avoid timeouting,... Has anything happened with this?
Yes and no... rpm upstream now warns on this: [pmatilai@localhost rpm]$ ./rpmbuild -bp ~/rpmbuild/SPECS/macroscope.spec warning: Macro %foo defined but not used within scope Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.4HO5Nz + umask 022 + cd /home/pmatilai/rpmbuild/BUILD + echo 1: bar 1: bar + true + echo 2: '%{foo}' 2: %{foo} + exit 0 Rpm 4.12 can emit that warning too if macro tracing is on (eg place '%trace' at top of the spec'), disabled by default in part because of performance issues, and the upstream fix to that could be quite easily backported to 4.12 branch. However I find myself wondering more and more whether a saner solution to the whole scoping business exists, such as perhaps only treating %define as locally scoped within parametrized macros. But note that this is merely speculation at this point.
Yes, I have to agree that the current behaviour is very counter-intuitive.
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle. Changing version to '23'. (As we did not run this process for some time, it could affect also pre-Fedora 23 development cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.) More information and reason for this action is here: https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23
This message is a reminder that Fedora 23 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 23. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '23'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 23 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Maging to rawhide to avoid timeouting, the issue is still valid.
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle. Changing version to '26'.
Fixed upstream, hopefully for good, by actually changing the alleged scoping rules to what everybody expects and what always mostly worked. Ie macros defined within parametric macros are local and really removed when they go out of scope, everything else is global: https://github.com/rpm-software-management/rpm/commit/237f35f16f978bb20e4cafd78abfab1f2e5db480
In rawhide/F27 now as of rpm >= 4.13.90