Bug 16818

Summary: rpm %license is expanded as License: variable within %{expand:.. } in spec top section
Product: Mageia Reporter: Barry Jackson <zen25000>
Component: RPM PackagesAssignee: RPM stack maintainers <rpmstack>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Normal CC: marja11, thierry.vignaud
Version: CauldronKeywords: UPSTREAM
Target Milestone: ---   
Hardware: All   
OS: Linux   
See Also: https://bugzilla.redhat.com/show_bug.cgi?id=1386639
Whiteboard:
Source RPM: rpm-4.13.0-0.rc1.10.mga6.src.rpm CVE:
Status comment:

Description Barry Jackson 2015-09-24 01:58:01 CEST
Description of problem:
This snippet from the boost-1.58 (soon to be in 1.59 too) spec works as expected:

    %{expand:%(for lib in %boostlibs; do lib2=${lib/-/_}; cat <<EOF
    %%files -n %%{libname$lib2}
    %%doc LICENSE_1_0.txt
    %{_libdir}/libboost_$lib*.so.%{version}
    EOF
    done)}

However if %doc is replaced with %license:

    %{expand:%(for lib in %boostlibs; do lib2=${lib/-/_}; cat <<EOF
    %%files -n %%{libname$lib2}
    %%license LICENSE_1_0.txt
    %{_libdir}/libboost_$lib*.so.%{version}
    EOF
    done)}

then %license is replaced with the content of the License: variable and the generated %files section is garbage.

This Red Hat bug describes a similar (but different related) issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1200761
and possibly related to:
https://github.com/rpm-software-management/rpm/commit/5d4d5e40c5a2634960385731743dc891ce9f1253

Why on earth did they decide on "%license" when %lic would have caused none of these issues?





Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.


Reproducible: 

Steps to Reproduce:
Barry Jackson 2015-09-24 02:00:29 CEST

CC: (none) => thierry.vignaud

Comment 1 Thierry Vignaud 2016-10-16 13:27:05 CEST
You'd better report this upstream at:
https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=rpm

It would be better if you could provides a small spec file showing the issue.
Comment 2 Thierry Vignaud 2016-10-19 13:00:52 CEST
Reported upstream at https://bugzilla.redhat.com/show_bug.cgi?id=1386639

Keywords: (none) => UPSTREAM
See Also: (none) => https://bugzilla.redhat.com/show_bug.cgi?id=1386639

Marja Van Waes 2016-10-28 20:20:30 CEST

CC: (none) => marja11
Assignee: bugsquad => rpmstack

Comment 3 Barry Jackson 2017-06-06 10:56:41 CEST
From upstream bug report:

Panu Matilainen 2016-12-16 04:19:02 EST

All you need is enough escapes to avoid it actually getting expanded inside %expand() because in the spec preamble %license is a macro referring to the contents of the license tag whereas inside %files %license is a spec directive/file attribute, not a macro. This gets the job done (dont ask):

%%%%license LICENSE_1_0.txt

So closing as invalid!

Status: NEW => RESOLVED
Resolution: (none) => INVALID