Bug 788077

Summary: mysql fails to rebuild with debug enabled
Product: Red Hat Enterprise Linux 6 Reporter: Karel Volný <kvolny>
Component: mysqlAssignee: Tom Lane <tgl>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: byte, hhorak, psklenar
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-07 16:14:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Karel Volný 2012-02-07 12:05:20 UTC
Description of problem:
Trying to rebuild mysql with debug enabled leads to fail.

Version-Release number of selected component (if applicable):
mysql-5.1.61-1.el6_2.1.src.rpm.spec

How reproducible:
always

Steps to Reproduce:
1. install mysql source package
2. modify mysql spec file to configure --with-debug

# diff mysql-5.1.61-1.el6_2.1.src.rpm.spec~ mysql-5.1.61-1.el6_2.1.src.rpm.spec
228c228
<       --without-debug \
---
>       --with-debug \

3. rebuild from spec
# rpmbuild --define='runselftest 0' -bb mysql-5.1.61-1.el6_2.1.src.rpm.spec
  
Actual results:
cc1: warnings being treated as errors
complete.c: In function 'fnprint':
complete.c:676: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result
make[2]: *** [complete.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/root/rpmbuild/BUILD/mysql-5.1.61/cmd-line-utils/readline'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/rpmbuild/BUILD/mysql-5.1.61/cmd-line-utils'
make: *** [all-recursive] Error 1


Expected results:
no errors, packages built

Additional info:
https://tcms.engineering.redhat.com/run/15755/ says this has worked before ...

Comment 1 Petr Sklenar 2012-02-07 12:46:20 UTC
I can confirm that building is possible with such a modification of spec file in 
mysql-5.1.52-1.el6_0.1.src.rpm

and not with mysql-5.1.61-1.el6_2.1.src.rpm - latest errata version

Comment 2 Tom Lane 2012-02-07 15:58:21 UTC
This is, more or less by definition, not a bug in Red Hat's packaging of mysql.

More generally, I'm unwilling to take on a contract of "guarantee that mysql builds warning-free on compiler versions other than what upstream uses".  The only supportable fix from my point of view would be to remove -Werror from the compiler options used in a debug build, which seems to rather miss the point.  So I'm inclined to consider this NOTABUG, or at least a request that would have to be directed to upstream not me.

Comment 3 RHEL Program Management 2012-02-07 16:14:36 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.

Comment 4 Karel Volný 2012-02-08 09:22:53 UTC
(In reply to comment #2)
> More generally, I'm unwilling to take on a contract of "guarantee that mysql
> builds warning-free on compiler versions other than what upstream uses".

well, may I doubt that it builds warning-free even for them?

anyways, we need to be able to compile with debug to test CVE-2010-3836 (if we don't want to drop this from our testsuite)

I've already updated the testcase - https://tcms.engineering.redhat.com/case/74473/ - but:

> The only supportable fix from my point of view would be to remove -Werror from
> the compiler options used in a debug build,

please could you specify how to do this exactly, for manual testing?

Comment 5 Tom Lane 2012-02-08 15:04:19 UTC
(In reply to comment #4)
> (In reply to comment #2)
> > More generally, I'm unwilling to take on a contract of "guarantee that mysql
> > builds warning-free on compiler versions other than what upstream uses".
> 
> well, may I doubt that it builds warning-free even for them?

Well, I can't speculate as to their testing practices, but I would think that for development it's pretty important to be able to make a debug build.

> anyways, we need to be able to compile with debug to test CVE-2010-3836 (if we
> don't want to drop this from our testsuite)

I don't remember that specific CVE, but if it's only applicable to debug builds then it never has and never will affect what we ship, so I have no problem with not testing it.

> > The only supportable fix from my point of view would be to remove -Werror from
> > the compiler options used in a debug build,
> 
> please could you specify how to do this exactly, for manual testing?

IIRC it's the last reference to -Werror in the configure script that would need to be patched out.  There are some earlier places that temporarily add it to CXXFLAGS, but you don't want to muck with those for fear of breaking configure probes.

Comment 6 Karel Volný 2012-11-11 21:56:41 UTC
just FTR, still bad luck with mysql-5.1.66

#       source='complete.c' object='complete.o' libtool=no 
gcc -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1 -I. -I../../include -I../../include -I../../include -I../..   -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -Wdeclaration-after-statement -g  -DSAFE_MUTEX -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC   -DUNIV_LINUX -DUNIV_LINUX -c complete.c
cc1: warnings being treated as errors
complete.c: In function 'fnprint':
complete.c:676: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result
make[2]: *** [complete.o] Error 1



... and yes, it works after patching out -Werror, I've did it with this trick:

--- mysql.spec~ 2012-11-11 16:40:05.000000000 -0500
+++ mysql.spec  2012-11-11 16:40:51.000000000 -0500
@@ -227,6 +227,8 @@
 CXXFLAGS="$CFLAGS -felide-constructors -fno-rtti -fno-exceptions"
 export CFLAGS CXXFLAGS
 
+sed -i -e "s/-Werror//g" configure
+
 # mysql 5.1.30 fails regression tests on x86 unless we use --with-big-tables,
 # suggesting that upstream doesn't bother to test the other case ...
 # note: the with-plugin and without-plugin options do actually work; ignore

Comment 7 Karel Volný 2013-01-31 11:32:34 UTC
and here's 5.1.67 failure:

#       source='complete.c' object='complete.o' libtool=no 
gcc -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1 -I. -I../../include -I../../include -I../../include -I../..   -Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror -Wdeclaration-after-statement -g  -DSAFE_MUTEX -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC   -DUNIV_LINUX -DUNIV_LINUX -c complete.c
cc1: warnings being treated as errors
complete.c: In function 'fnprint':
complete.c:676: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result
make[2]: *** [complete.o] Error 1