Bug #76412 Freshly built mysql client crashes in libedit/terminal.c:334
Submitted: 20 Mar 2015 17:30 Modified: 24 Nov 2015 22:49
Reporter: Sveta Smirnova (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.6.23, 5.7.5 OS:Linux (Suse 13.2)
Assigned to: CPU Architecture:Any

[20 Mar 2015 17:30] Sveta Smirnova
Description:
MySQL command line client, built from GitHub sources crashes at login attempt:

sveta@linux-85fm:~/build/mysql-5.6/mysql-test> ../bin/mysql -h127.0.0.1 -uroot -P13000 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-debug-log Source distribution

Copyright (c) 2000, 2015, 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.

Segmentation fault

How to repeat:
1. Install Suse 13.2, apply all updates

Linux linux-85fm.site 3.16.7-7-desktop #1 SMP PREEMPT Wed Dec 17 18:00:44 UTC 2014 (762f27a) x86_64 x86_64 x86_64 GNU/Linux

2. Clone 5.6 branch from MySQL GitHub repo.

3. Compile it with option -DWITH_DEBUG=1

4. While cmake will be running it will complain about missed packages, such as ncurses-devel. Install them

5. Install MySQL server and clients somewhere

6. cd install dir/mysql-test, start any MTR test case:

./mtr --start --suite=rpl rpl_alter --mysqld=--gtid_mode=ON --mysqld=--log-slave-updates --mysqld=--enforce-gtid-consistency  --mysqld=--binlog-format=row &

7. Try to connect to MySQL server:

sveta@linux-85fm:~/build/mysql-5.6/mysql-test> gdb ../bin/mysql
GNU gdb (GDB; openSUSE 13.2) 7.8
Copyright (C) 2014 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-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
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"...

warning: /etc/gdbinit.d/gdb-heap.py: No such file or directory
Reading symbols from ../bin/mysql...done.
(gdb) set args -h127.0.0.1 -uroot -P13000 test
(gdb) run
Starting program: /home/sveta/build/mysql-5.6/bin/mysql -h127.0.0.1 -uroot -P13000 test
Got object file from memory but can't read symbols: File truncated.
Missing separate debuginfos, use: zypper install glibc-debuginfo-2.19-16.9.1.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.23-debug-log Source distribution

Copyright (c) 2000, 2015, 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.
0x00000000004ec71f in terminal_alloc (el=0xa8cfa0, t=0x751e00 <tstr>, cap=0xffffffffffffd0e0 <error: Cannot access memory at address 0xffffffffffffd0e0>) at /home/sveta/src/mysql-server/cmd-line-utils/libedit/terminal.c:334
334             if (cap == NULL || *cap == '\0') {
Missing separate debuginfos, use: zypper install libgcc_s1-gcc49-debuginfo-4.9.0+r211729-2.1.7.x86_64 libncurses5-debuginfo-5.9-52.2.3.x86_64 libstdc++6-debuginfo-4.8.3+r212056-2.2.4.x86_64
(gdb)

Bug exists in both 5.6 and 5.7 versions. Version 5.5 is not affected (client from 5.5 can be used to connect to 5.6 server).
[23 Mar 2015 14:10] MySQL Verification Team
I couldn't repeat on OpenSuSe after a complete update (i.e I didn't get complain to install ncurses-devel).

Your MySQL connection id is 1
Server version: 5.6.23-debug-log Source distribution

Copyright (c) 2000, 2015, 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.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW VARIABLES LIKE "%DIR%";
+-----------------------------------------+------------------------------------------------------+
| Variable_name                           | Value                                                |
+-----------------------------------------+------------------------------------------------------+
| basedir                                 | /home/miguel/test/5.6d                               |
| binlog_direct_non_transactional_updates | ON                                                   |
| character_sets_dir                      | /home/miguel/test/5.6d/share/charsets/               |
| datadir                                 | /home/miguel/test/5.6d/mysql-test/var/mysqld.1/data/ |
| ignore_db_dirs                          |                                                      |
| innodb_data_home_dir                    |                                                      |
| innodb_fil_make_page_dirty_debug        | 0                                                    |
| innodb_log_group_home_dir               | ./                                                   |
| innodb_max_dirty_pages_pct              | 75                                                   |
| innodb_max_dirty_pages_pct_lwm          | 0                                                    |
| innodb_undo_directory                   | .                                                    |
| lc_messages_dir                         | /home/miguel/test/5.6d/share/                        |
| plugin_dir                              | /home/miguel/test/5.6d/lib/plugin/                   |
| slave_load_tmpdir                       | /home/miguel/test/5.6d/mysql-test/var/tmp/mysqld.1   |
| tmpdir                                  | /home/miguel/test/5.6d/mysql-test/var/tmp/mysqld.1   |
+-----------------------------------------+------------------------------------------------------+                                                                                            
15 rows in set (0.00 sec)                                                                                                                                                                     

mysql> exit
Bye
miguel@vbopensuse:~/test/5.6d/bin> cat /etc/SuSE-release
openSUSE 13.2 (x86_64)
VERSION = 13.2
CODENAME = Harlequin
# /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead
miguel@vbopensuse:~/test/5.6d/bin>
[23 Apr 2015 21:17] Sveta Smirnova
After installing libedit-devel, libncurses6-32bit and ncurses-devel-32bit issue is resolved. You are welcome to either close the bug or change CmakeLists.txt for additional checks.
[17 Jul 2015 13:07] Georgi Kodinov
Changing category for the extra cmake checks.
[24 Nov 2015 22:49] MySQL Verification Team
Thank you for the feedback.