Bug 587818

Summary: missing %{__strip} corrupts mingw binaries during rpmbuild
Product: [Fedora] Fedora Reporter: Eric Blake <eblake>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: erik-fedora, fedora-mingw, ffesti, jnovy, pmatilai, vleolml
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-08 12:48:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Eric Blake 2010-04-30 23:27:43 UTC
Description of problem:
When building cross-compiled mingw binaries, it is common practice to override %{__strip}, since the cross-toolchain must run i686-pc-mingw32-strip rather than native strip in order to avoid corrupting the resulting binary (see also bug 571686 for an example of this override).  However, this override currently only works if redhat-rpm-config is installed, because stock rpm doesn't honor the %{__strip} override during %{__os_install_post}

Version-Release number of selected component (if applicable):
$ rpm -q rpm redhat-rpm-config
rpm-4.7.2-1.fc12.i686
redhat-rpm-config-9.0.3-18.fc12.noarch


How reproducible:
Always.


Steps to Reproduce:
1. With redhat-rpm-config uninstalled:
$ rpm --showrc | grep -C2 brp-strip
-14: __os_install_post
  %{_rpmconfigdir}/brp-compress
  %{_rpmconfigdir}/brp-strip
  %{_rpmconfigdir}/brp-strip-static-archive
  %{_rpmconfigdir}/brp-strip-comment-note
%{nil}
-14: __patch /usr/bin/patch

2. With redhat-rpm-config installed:
-14: __os_install_post	
    /usr/lib/rpm/redhat/brp-compress 
    %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip}} 
    /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} 
    /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} 
    /usr/lib/rpm/brp-python-bytecompile 
    /usr/lib/rpm/redhat/brp-python-hardlink 

  
Actual results:
Notice how plain rpm calls brp-strip with no arguments, which means it blindly calls native strip(1).

Expected results:
Notice how redhat-rpm-config calls brp-strip with an argument of %{__strip} - this is essential to pull off the mingw override.


Additional info:

Comment 1 Panu Matilainen 2010-05-06 08:33:24 UTC
FWIW, the redhat-rpm-config way of passing strip + objdump as arguments to the brp-strip* went to rpm.org upstream some time ago already, it's just a matter of getting it into Fedora too. Marking this as MODIFIED for easy spotting when preparing the next rpm update...

Comment 2 Bug Zapper 2010-11-03 15:55:54 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  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 '12'.

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 12'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 12 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 Eric Blake 2010-11-03 16:02:59 UTC
Still present in F14, so bumping the version field:
rpm-4.8.1-5.fc14.x86_64
redhat-rpm-config-9.1.0-5.fc14.noarch

Comment 4 Vassili Leonov 2011-03-29 09:46:19 UTC
Another manifestation of this bug, confirmed on fresh, updated as of 2011.03.29 F14 i386, is that when some (not all!) RPMS for ming32 are rebuilt, and when error messages of this kind:

strip:/home/vleo/rpmbuild/BUILDROOT/mingw32-gsm-1.0.14-mt.fc14.i386/usr/i686-pc-mingw32/sys-root/mingw/lib/libgsm.a(libgsm_la-add.o): Unable to recognise the format of file: File format not recognized

from the rpmbuild process are ignored, other packages dependent on these improperly built RPMs will fail to build as well. For example, ming32-libgsm built without redhat-rpm-config would not be usable for ffmpeg build, with configure message like this (tail config.log):

i686-pc-mingw32-gcc -o /tmp/ffconf.kcYisU51.exe /tmp/ffconf.7bQViuE8.o -lm -lpthreadGC2 -lbz2 -lz -lpsapi -lgsm
/usr/i686-pc-mingw32/sys-root/mingw/lib/libgsm.dll.a: could not read symbols: Archive has no index; run ranlib to add one
ERROR: libgsm not found

I don't know what priority should be, but SEVERITY for this bug should be higher, because of its indirect effects.

Comment 5 Panu Matilainen 2012-05-08 12:48:39 UTC
Apparently this never got fixed in F14 which obviously is long into EOL by now, doh. Its fixed in Fedora >= 15 though.