Bug 133651

Summary: /lib/libiw.so is compiled without RPM_OPT_FLAGS
Product: [Fedora] Fedora Reporter: Brian Stein <bstein>
Component: wireless-toolsAssignee: Brian Stein <bstein>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: bstevens, mattdm
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: 2006-08-29 22:55:49 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:
Bug Depends On:    
Bug Blocks: 133398    

Description Arjan van de Ven 2004-09-25 18:01:28 UTC
/lib/libiw.so is using -mtune=i386 as opposed to the i686 tuning options

Comment 1 Michael Schwendt 2004-09-27 18:58:57 UTC
Would this be considered bad form at Red Hat?

--- wireless-tools.spec.orig    2004-08-31 07:20:03.000000000 +0200
+++ wireless-tools.spec 2004-09-27 21:01:31.577324656 +0200
@@ -22,6 +22,8 @@
 %prep
 %setup -n wireless_tools.%{version}
 %patch1 -p1 -b .makefile
+sed -i 's/^\(CFLAGS.*\)-Os\(.*\)/\1\$(RPM_OPT_FLAGS) \2/' Makefile
+
 
 %build
 make clean


Comment 2 Rik van Riel 2004-09-27 19:11:02 UTC
Alternatively, patch the makefile so we can pass RPM_OPT_FLAGS on the
make command line ;)

--- wireless_tools.27/Makefile.makefile 2004-06-15 14:40:12.000000000
-0400
+++ wireless_tools.27/Makefile  2004-09-27 15:12:49.000000000 -0400
@@ -77,12 +77,15 @@
   LIBS= -lm
 endif
  
+ifndef RPM_OPT_FLAGS
+  RPM_OPT_FLAGS=
+endif
 # Other flags
 CFLAGS=-Os -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow \
        -Wpointer-arith -Wcast-qual -Winline -I.
 #CFLAGS=-O2 -W -Wall -Wstrict-prototypes -I.
 DEPFLAGS=-MMD
-XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) $(WELIB_FLAG)
+XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) $(WELIB_FLAG)
$(RPM_OPT_FLAGS) PICFLAG=-fPIC
  
 # Standard compilation targets


Comment 3 Rik van Riel 2004-09-27 19:29:48 UTC
OK, something like this seems to work. Just test compiled it.

Comment 4 Michael Schwendt 2004-09-27 19:41:13 UTC
The "sed" approach achieves a similar thing:

--- Makefile.orig       2004-09-27 21:41:23.863641856 +0200
+++ Makefile    2004-09-27 21:41:27.624070184 +0200
@@ -78,7 +78,7 @@
 endif
 
 # Other flags
-CFLAGS=-Os -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow \
+CFLAGS=$(RPM_OPT_FLAGS)  -W -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wshadow \
        -Wpointer-arith -Wcast-qual -Winline -I.
 #CFLAGS=-O2 -W -Wall -Wstrict-prototypes -I.
 DEPFLAGS=-MMD


So, you can pass RPM_OPT_FLAGS on the command-line, too (rpmbuild
exports it already).

If you patch the Makefile, you probably want to apply this (OPT_FLAGS
is not used anywhere in the tarball):

--- wireless-tools.spec.orig    2004-08-31 07:20:03.000000000 +0200
+++ wireless-tools.spec 2004-09-27 21:43:23.557445632 +0200
@@ -25,7 +25,7 @@
 
 %build
 make clean
-make OPT_FLAGS="$RPM_OPT_FLAGS" BUILD_SHARED=1 FORCE_WEXT_VERSION=16
+make BUILD_SHARED=1 FORCE_WEXT_VERSION=16
 
 %install
 rm -rf $RPM_BUILD_ROOT


Comment 5 Rik van Riel 2004-09-27 19:48:46 UTC
It does, but it doesn't look quite as future-proof.  I could imagine
the upstream maintainers adding something in front of the -Os one day,
causing the sed to remove an option it shouldn't remove...

I've applied the patch from comment #2, except using OPT_FLAGS instead
of RPM_OPT_FLAGS.  This way the Makefile does use the OPT_FLAGS
argument passed to it and things get compiled right.

Thanks for helping fix this. wireless-tools-0.27-pre25-2 should be
correct.

Comment 6 Michael Schwendt 2004-09-27 19:55:39 UTC
Okay. The sed expression does not remove anything else than -Os,
however. \1 and \2 put back the parts around -Os.

Comment 7 Matthew Miller 2006-07-10 20:52:40 UTC
Fedora Core 3 is now maintained by the Fedora Legacy project for security
updates only. If this problem is a security issue, please reopen and
reassign to the Fedora Legacy product. If it is not a security issue and
hasn't been resolved in the current FC5 updates or in the FC6 test
release, reopen and change the version to match.

Thank you!


Comment 8 Christopher Aillon 2006-08-29 22:55:49 UTC
This looks fixed anyway.