Bug 982212

Summary: Macro %filter_setup prevents %version to be expanded in .attr file
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: redhat-rpm-configAssignee: Florian Festi <ffesti>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: jonathan, pmatilai
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 15:58:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test.attr - Copy to /usr/lib/rpm/fileattrs/
none
test.tar - Copy to SOURCES (contains empty dir named test)
none
test-nofilter.spec - Copy to SPECS
none
test-filter.spec - Copy to SPECS
none
test-nofilter SRPM
none
test-filter SRPM none

Description Miro Hrončok 2013-07-08 12:08:20 UTC
Created attachment 770456 [details]
test.attr - Copy to /usr/lib/rpm/fileattrs/

Description of problem:

When macro %filter_setup is used in spec, suddenly, %{version} passed as an argument to script defined in /usr/lib/rpm/fileattrs/foo.attr stops exapnding.


Version-Release number of selected component (if applicable): 9.1.0-45.fc19


How reproducible: Always


Steps to Reproduce:

* All referenced files will be attached

1. Copy test.attr to /usr/lib/rpm/fileattrs/
2. Either copy test.tar to your rpmbuild/SOURCES and test-nofilter.spec and test-filter.spec to your SPECS, or unpack corresponding SRPMs
3. Run rpmbuild -ba on both files
4. Run rpm -q --provides -p on both generated binary RPMs (not debuginfo packages)

Actual results:
$ rpm -q --provides -p test-nofilter-1.0-1.fc19.x86_64.rpm 
test = 1.0
test-nofilter = 1.0-1.fc19
test-nofilter(x86-64) = 1.0-1.fc19
$ rpm -q --provides -p test-filter-1.0-1.fc19.x86_64.rpm 
test-filter = 1.0-1.fc19
test-filter(x86-64) = 1.0-1.fc19
test = %{version}


Expected results:
$ rpm -q --provides -p test-nofilter-1.0-1.fc19.x86_64.rpm 
test = 1.0
test-nofilter = 1.0-1.fc19
test-nofilter(x86-64) = 1.0-1.fc19
$ rpm -q --provides -p test-filter-1.0-1.fc19.x86_64.rpm 
test = 1.0
test-filter = 1.0-1.fc19
test-filter(x86-64) = 1.0-1.fc19

Additional info:

In test.attr is used echo for simplification. This bug is not limited to echo.

Other macros than %{version} might be affected too, but macros such as %{_datadir} or %{python_sitelib} work fine when used in path variable.

Comment 1 Miro Hrončok 2013-07-08 12:08:57 UTC
Created attachment 770457 [details]
test.tar - Copy to SOURCES (contains empty dir named test)

Comment 2 Miro Hrončok 2013-07-08 12:09:35 UTC
Created attachment 770459 [details]
test-nofilter.spec - Copy to SPECS

Comment 3 Miro Hrončok 2013-07-08 12:10:16 UTC
Created attachment 770460 [details]
test-filter.spec - Copy to SPECS

Comment 4 Miro Hrončok 2013-07-08 12:11:46 UTC
Created attachment 770461 [details]
test-nofilter SRPM

Comment 5 Miro Hrončok 2013-07-08 12:12:15 UTC
Created attachment 770462 [details]
test-filter SRPM

Comment 6 Panu Matilainen 2013-07-08 12:18:58 UTC
Yes, one of the unwanted side-effects of %filter_setup is that it switches rpmbuild to the "external dependency generator" mode where spec macros are not (and can not be made) available.

The answer is simply: dont use the fedora-specific %filter_setup. Rpm >= 4.9.x has built-in dependency filtering, use that instead:
http://rpm.org/wiki/PackagerDocs/DependencyGenerator

Comment 7 Miro Hrončok 2013-07-08 16:17:05 UTC
Shouldn't we obsolete %filter_setup (make it do nothing) and map %filter_provides_in to %__provides_exclude_from and %filter_from_provides to %__provides_exclude (and the same thing to requires)?

Comment 8 Panu Matilainen 2013-07-09 13:25:30 UTC
Optimally yes, but the two filtering methods differ too much for that.

Comment 9 Miro Hrončok 2013-07-09 17:29:04 UTC
Is there a workaround, how to pass version to .prov script, when old %filter_setup is used?

Comment 10 Fedora Admin XMLRPC Client 2014-11-14 07:24:47 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 11 Fedora End Of Life 2015-01-09 18:45:53 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

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 19 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 Fedora End Of Life 2015-02-17 15:58:06 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.