Bug #8984 mysql does not build if <unistd.h> defines read or write as a macro
| Submitted: | 5 Mar 2005 21:30 | Modified: | 29 Mar 2005 21:08 |
|---|---|---|---|
| Reporter: | [ name withheld ] | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Compiling | Severity: | S3 (Non-critical) |
| Version: | 4.1.10 | OS: | Linux (Linux) |
| Assigned to: | Sergei Golubchik | CPU Architecture: | Any |
[29 Mar 2005 18:39]
MySQL Verification Team
Thank you for submitting this bug. However, we provide official binaries for the platform in question and hence will not handle compilation-related bugs for this platform. To download MySQL binaries for this platform, please go to: http://dev.mysql.com/downloads/
[29 Mar 2005 21:08]
Sergei Golubchik
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html
Additional info:
Fixed in 4.1.11
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Per the C spec, the system headers may legally define function-like macros corresponding to any function they provide. In particular recent Red Hat versions of <unistd.h> do this for read(), breaking vio code that assumes it can use "read" as a random function pointer name. Attached is a minimal workaround; it would likely be better to change the pointer's name. How to repeat: Try to build 4.1.10 on devel tip Fedora. Suggested fix: diff -Naur mysql-4.1.10.orig/include/violite.h mysql-4.1.10/include/violite.h --- mysql-4.1.10.orig/include/violite.h 2005-02-12 15:37:32.000000000 -0500 +++ mysql-4.1.10/include/violite.h 2005-03-05 14:41:20.000000000 -0500 @@ -138,8 +138,9 @@ #if defined(HAVE_VIO) && !defined(DONT_MAP_VIO) #define vio_delete(vio) (vio)->viodelete(vio) #define vio_errno(vio) (vio)->vioerrno(vio) -#define vio_read(vio, buf, size) (vio)->read(vio,buf,size) -#define vio_write(vio, buf, size) (vio)->write(vio, buf, size) +/* need parens in case read and write are defined as macros by system hdrs */ +#define vio_read(vio, buf, size) ((vio)->read)(vio,buf,size) +#define vio_write(vio, buf, size) ((vio)->write)(vio, buf, size) #define vio_blocking(vio, set_blocking_mode, old_mode)\ (vio)->vioblocking(vio, set_blocking_mode, old_mode) #define vio_is_blocking(vio) (vio)->is_blocking(vio) diff -Naur mysql-4.1.10.orig/vio/test-ssl.c mysql-4.1.10/vio/test-ssl.c --- mysql-4.1.10.orig/vio/test-ssl.c 2005-02-12 15:37:34.000000000 -0500 +++ mysql-4.1.10/vio/test-ssl.c 2005-03-05 14:42:39.000000000 -0500 @@ -115,7 +115,7 @@ { /* child, therefore, client */ char xbuf[100]; - int r = client_vio->read(client_vio,xbuf, sizeof(xbuf)); + int r = vio_read(client_vio, xbuf, sizeof(xbuf)); if (r<=0) { my_free((gptr)ssl_acceptor,MYF(0)); my_free((gptr)ssl_connector,MYF(0)); @@ -130,7 +130,7 @@ else { const char* s = "Huhuhuh"; - int r = server_vio->write(server_vio,(gptr)s, strlen(s)); + int r = vio_write(server_vio,(gptr)s, strlen(s)); if (r<=0) { my_free((gptr)ssl_acceptor,MYF(0)); my_free((gptr)ssl_connector,MYF(0)); diff -Naur mysql-4.1.10.orig/vio/test-sslclient.c mysql-4.1.10/vio/test-sslclient.c --- mysql-4.1.10.orig/vio/test-sslclient.c 2005-02-12 15:37:32.000000000 -0500 +++ mysql-4.1.10/vio/test-sslclient.c 2005-03-05 14:43:21.000000000 -0500 @@ -83,7 +83,7 @@ /* Now we have TCP conncetion. Start SSL negotiation. */ read(client_vio->sd,xbuf, sizeof(xbuf)); sslconnect(ssl_connector,client_vio,60L); - err = client_vio->read(client_vio,xbuf, sizeof(xbuf)); + err = vio_read(client_vio,xbuf, sizeof(xbuf)); if (err<=0) { my_free((gptr)ssl_connector,MYF(0)); fatal_error("client:SSL_read");