Bug 1200761 - "%license FILENAME" in %files -f list-of-files is expanded to package's license field
Summary: "%license FILENAME" in %files -f list-of-files is expanded to package's licen...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-11 11:05 UTC by Tomas 'Sheldon' Radej
Modified: 2017-05-30 13:34 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
: 1386639 (view as bug list)
Environment:
Last Closed: 2015-03-27 10:16:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Reproducer SRPM (5.92 KB, application/x-rpm)
2015-03-11 11:05 UTC, Tomas 'Sheldon' Radej
no flags Details

Description Tomas 'Sheldon' Radej 2015-03-11 11:05:36 UTC
Created attachment 1000349 [details]
Reproducer SRPM

Description of problem:
This problem occurs if "%files -f list-of-files" is used. If list-of-files contains a line "%license FILENAME", the "%license" tag is expanded to the contents of the package's License field as specified in the SPEC, instead of being understood as a %files directive.

Version-Release number of selected component (if applicable):
rpm-4.12.0.1-4.fc21.x86_64

How reproducible:
Always

Steps to Reproduce:
1. put %files -f list-of-files in the SPEC, where list-of-files contains at least one line containing "%license FILENAME" (as in attached SRPM)
2. build

Actual results:
Rpmbuild outputs error: File must begin with "/": MIT

Expected results:
Package compiles, FILENAME is marked as license file.

Additional info:
Building the attached RPM reproduces the bug as described. Problem occurs in F22 and rawhide as well.

Comment 1 Florian Festi 2015-03-27 10:16:00 UTC
Thanks for reporting and providing the reproducer! There is some special code to hide the %license macro within the %files section. This code is missing from the part that parses the file manifest (which happens later in the build process).

Fixed upstream as 5d4d5e40c5a2634960385731743dc891ce9f1253

Comment 2 Tomas 'Sheldon' Radej 2015-03-30 08:16:32 UTC
Thank you very much.

One more question, if I may - is there a convenient way to track when this fix makes it into the Fedora repositories? I'll need to disable the workaround that I am currently using in my package (using %%license in list-of-files). Thanks.

Comment 3 Florian Festi 2015-03-30 15:38:50 UTC
By default this will be added to the next RPM release witch will hide rawhide in the F23 development cycle and will be announced loudly. 

Feel free to reopen the bug and demand a backport to (a) specific Fedora release(s) if this is important enough for you.

Comment 4 Thierry Vignaud 2016-10-19 10:51:15 UTC
This is also broken if one uses %expand
See eg: https://bugs.mageia.org/show_bug.cgi?id=16818

Example is to change line 117 of http://svnweb.mageia.org/packages/cauldron/boost/current/SPECS/boost.spec?revision=1014876&view=markup#96
from:
%%doc LICENSE_1_0.txt
to:
%%license LICENSE_1_0.txt

This breaks as badly.

IMHO the overlapping name with the tag license was hazardous...

Comment 5 Panu Matilainen 2016-10-31 07:46:32 UTC
(In reply to Thierry Vignaud from comment #4)
> IMHO the overlapping name with the tag license was hazardous...

Well the whole spec thing is hazardous... that %doc happens to works there is not much more than luck. As for %license, the damage was already done some 18 years ago, see https://github.com/rpm-software-management/rpm/commit/8fa9463826e3aef7ed763b2d1d6bb0937e91b8cd, recent rpm versions just resurrected the long broken feature + enhanced it.


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