Bug #12570 Compiling with gcc-4.0.2: sql/mysqld.cc: const char * conversation
Submitted: 13 Aug 2005 14:57 Modified: 21 Jul 2006 19:19
Reporter: Christian Hammers (Silver Quality Contributor) (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.11beta OS:Linux (Debian/GNU Linux)
Assigned to: Jim Winstead CPU Architecture:Any

[13 Aug 2005 14:57] Christian Hammers
Description:
if g++ -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr\"" -DDATADIR="\"/var/lib/mysql\"" -DSHAREDIR="\"/usr/share/mysql\"" -DHAVE_CONFIG_H -I. -
I. -I.. -I../innobase/include -I../ndb/include -I../ndb/include/ndbapi -I../include -I../include -I../regex -I.     -O3 -DDBUG_OFF -DBIG_JOI
NS=1 -felide-constructors -fno-rtti -O3   -fno-implicit-templates -fno-exceptions -fno-rtti  -MT hostname.o -MD -MP -MF ".deps/hostname.Tpo"
 -c -o hostname.o hostname.cc; \
then mv -f ".deps/hostname.Tpo" ".deps/hostname.Po"; else rm -f ".deps/hostname.Tpo"; exit 1; fi
mysqld.cc: In function 'int main(int, char**)':
mysqld.cc:3180: error: invalid conversion from 'const char*' to 'char*'
make[5]: *** [mysqld.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: Leaving directory `/tmp/buildd/mysql-dfsg-5.0-5.0.11beta/sql'
make[4]: *** [all-recursive] Error 1

How to repeat:
Try to build with gcc-4.0.2 and --with-libwrap.

Suggested fix:
--- sql/mysqld.cc.orig  2005-08-06 01:39:41.000000000 +0000
+++ sql/mysqld.cc       2005-08-13 14:50:57.429629361 +0000
@@ -3177,7 +3177,7 @@
   init_ssl();
 
 #ifdef HAVE_LIBWRAP
-  libwrapName= my_progname+dirname_length(my_progname);
+  libwrapName= (char *)my_progname+dirname_length(my_progname);
   openlog(libwrapName, LOG_PID, LOG_AUTH);
 #endif
[13 Aug 2005 17:59] Jorge del Conde
Thanks for your bug report.  Reproduced with 5.0.11 from bk
[1 Nov 2005 19:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/31752
[10 Nov 2005 19:44] Jim Winstead
Fixed in 4.1.16 and 5.0.17.
[10 Nov 2005 22:55] Jim Winstead
I mean it is fixed in 5.0.17. No change was made in the 4.1 tree.
[14 Nov 2005 19:29] Paul DuBois
No changelog entry needed.
[21 Jul 2006 18:07] Christian Hammers
My patch still applies to 5.0.22 and 5.0.23 (the version from the ftp server that had not yet been officially released) so I'm wondering if the bug is really fixed.

bye,

-christian-
[21 Jul 2006 18:10] Jim Winstead
Does it still fail without your patch? It should not. This bug was fixed in a different manner (fixing the type of libwrapName instead of adding a cast when assigning to libwrapName).
[21 Jul 2006 19:19] Christian Hammers
ACK, builds fine with GCC 4.1.2. Closing bug again. Thanks for the quick response.