Bug 1200761 - "%license FILENAME" in %files -f list-of-files is expanded to package's license field
"%license FILENAME" in %files -f list-of-files is expanded to package's licen...
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
21
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-03-11 07:05 EDT by Tomas Radej
Modified: 2017-05-30 09:34 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1386639 (view as bug list)
Environment:
Last Closed: 2015-03-27 06:16:00 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Tomas Radej 2015-03-11 07:05:36 EDT
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 06:16:00 EDT
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 Radej 2015-03-30 04:16:32 EDT
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 11:38:50 EDT
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 06:51:15 EDT
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 03:46:32 EDT
(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.