Bug 552944 - locally defined macros still buggy
Summary: locally defined macros still buggy
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 26
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Fedora Packaging Toolset Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-01-06 15:54 UTC by Stepan Kasal
Modified: 2017-08-22 11:40 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-22 11:40:48 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Stepan Kasal 2010-01-06 15:54:40 UTC
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.

Comment 1 Bug Zapper 2010-03-15 13:46:14 UTC
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

Comment 2 Bug Zapper 2011-06-02 16:59:10 UTC
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

Comment 3 Panu Matilainen 2011-06-17 12:46:13 UTC
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).

Comment 4 Fedora Admin XMLRPC Client 2012-04-13 23:08:12 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Fedora Admin XMLRPC Client 2012-04-13 23:11:38 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Fedora End Of Life 2013-04-03 18:19:10 UTC
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

Comment 7 Stepan Kasal 2014-10-20 12:56:07 UTC
Moving to rawhide to avoid timeouting,...

Has anything happened with this?

Comment 8 Panu Matilainen 2014-10-20 13:28:04 UTC
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.

Comment 9 Stepan Kasal 2015-05-04 15:01:14 UTC
Yes, I have to agree that the current behaviour is very counter-intuitive.

Comment 10 Jan Kurik 2015-07-15 15:20:12 UTC
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

Comment 11 Fedora End Of Life 2016-11-24 10:26:05 UTC
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.

Comment 12 Panu Matilainen 2016-11-24 11:58:09 UTC
Maging to rawhide to avoid timeouting, the issue is still valid.

Comment 13 Fedora End Of Life 2017-02-28 09:28:49 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 14 Panu Matilainen 2017-03-07 12:51:07 UTC
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

Comment 15 Panu Matilainen 2017-08-22 11:40:48 UTC
In rawhide/F27 now as of rpm >= 4.13.90


Note You need to log in before you can comment on or make changes to this bug.