| Bug #4276 | Confusing error message if socket file path is too long | ||
|---|---|---|---|
| Submitted: | 24 Jun 2004 19:04 | Modified: | 26 Jun 2004 19:35 |
| Reporter: | Kent Boortz | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 4.1 | OS: | All that set HAVE_SYS_UN_H |
| Assigned to: | Sergei Golubchik | CPU Architecture: | Any |
[26 Jun 2004 19:35]
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.3

Description: The error message 040624 17:59:14 Can't start server : Bind on unix socket: Address already in use 040624 17:59:14 Do you already have another mysqld server running on socket: \ /users/kboortz/daily/tmp/mysql-4.1.3-beta-nightly-20040623/mysql-4.1.3-beta-nightly-20040623/mysql-test/var/tmp/master.sock ? is a bit confusing in this case. The real reason for the failure is that the socket file path is too long. Before terminating it will also give a buffer overrun in the strmov() call. The patch below should correct the problem. The suggested fix use sizeof() to make sure the size is correct. The struct is defined in "/usr/include/sys/un.h" on Linux with the constant 108 hardcoded into it but the same struct is defined in "/usr/include/linux/un.h" using UNIX_PATH_MAX. I don't know if "struct sockaddr_un" is defined in any standard. kent Linux build 2.4.26 #4 SMP Mon Jun 7 00:10:41 CEST 2004 i686 unknown How to repeat: Start mysqld with --socket=PATH where PATH is longer than 108 characters. Suggested fix: *** sql/mysqld.cc.ORIG Thu Jun 24 17:55:34 2004 --- sql/mysqld.cc Thu Jun 24 18:11:48 2004 *************** *** 1253,1258 **** --- 1253,1264 ---- { DBUG_PRINT("general",("UNIX Socket is %s",mysqld_unix_port)); + if (strlen(mysqld_unix_port) > (sizeof(UNIXaddr.sun_path) - 1)) + { + sql_print_error("The socket file path is too long (> %d): %s", + sizeof(UNIXaddr.sun_path) - 1, mysqld_unix_port); + unireg_abort(1); + } if ((unix_sock= socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { sql_perror("Can't start server : UNIX Socket "); /* purecov: inspected */