Description:
I'm reporting what appears a long standing issue:
See https://bugs.mysql.com/bug.php?id=45562
when you launch the command line client, right after you enter your credentials, the command line client segfaults.
This problem is not fixed. Why has it persisted for so long?
I first encountered it in 5.6 (but the issue seems to have existed even longer based on the above post. In any case, I can report this problem still exists in 8.1
How to repeat:
simply compile mysql 8.1 (or even 5.6). This issue does not appear to be tied to any release.
When I compiled 5.6, I used gcc 4.9. When I compiled 8.0.11, I used gcc 8.1. Either way, the command line client crashes after entering credentials. Here is the output when ran under gdb:
-$ gdb --args mysql -h localhost -u root --port=10001 -p --socket=/home/estevens/database/mysql_8.1/mysql.sock GNU gdb (GDB) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from mysql...done.
(gdb) run
Starting program: /home/estevens/bin/mysql -h localhost -u root --port=10001 -p --socket=/home/estevens/database/mysql_8.1/mysql.sock
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 8.0.11 Source distribution
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Program received signal SIGSEGV, Segmentation fault.
0x00000000004bcdb6 in terminal_alloc (el=0xbd3180, t=<optimized out>,
cap=0xffffffffffffc3d0 <error: Cannot access memory at address 0xffffffffffffc3d0>)
at /home/estevens/software/mysql-8.0.11/extra/libedit/terminal.c:334
warning: Source file is more recent than executable.
334 if (cap == NULL || *cap == '\0') {
(gdb) bt
#0 0x00000000004bcdb6 in terminal_alloc (el=0xbd3180, t=<optimized out>,
cap=0xffffffffffffc3d0 <error: Cannot access memory at address 0xffffffffffffc3d0>)
at /home/estevens/software/mysql-8.0.11/extra/libedit/terminal.c:334
Suggested fix:
The fix is the same fix that has been proposed in the past (https://bugs.mysql.com/bug.php?id=45562):
comment out "char buf[TC_BUFSIZE]"
change "area = buf" to "area = NULL"
In 8.1, there are two occurrences of each; therefore, the below sed commands will do it:
sed -ine 's#char buf\[TC_BUFSIZE\]#//char buf[TC_BUFSIZE]#g' extra/libedit/terminal.c
sed -ine 's/area = buf/area = NULL/g' extra/libedit/terminal.c