Bug #6109 'mysql' command line client segfaults on 'quit' command
Submitted: 14 Oct 2004 21:04 Modified: 21 Oct 2004 12:43
Reporter: Konstantin Osipov (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1-bk OS:HP/UX (HPUX 11 (64 bit))
Assigned to: Jani Tolonen CPU Architecture:Any

[14 Oct 2004 21:04] Konstantin Osipov
Description:
If you issue more than one command in 'mysql' command-line tool, it segfaults
on exit.

The server is built with debug, 64-bit:

 $ ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-thread-safe-client --without-extra-tools --with-debug --disable-dependency-tracking

mysqldev@hpita2:~/kostja/mysql-4.1.6-gamma/tests> mysql test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.1.6-gamma-debug-log

No entry for terminal type "xterm";
using dumb terminal settings.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;
Empty set (0.04 sec)

mysql> quit
Segmentation fault (core dumped)
mysqldev@hpita2:~/kostja/mysql-4.1.6-gamma/tests> mysql test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 4.1.6-gamma-debug-log

No entry for terminal type "xterm";
using dumb terminal settings.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> quit
Bye
mysqldev@hpita2:~/kostja/mysql-4.1.6-gamma/tests> which mysql
/home/mysqldev/kostja/mysql-4.1.6-gamma/client/mysql
mysqldev@hpita2:~/kostja/mysql-4.1.6-gamma/tests> 

How to repeat:
See description.
[14 Oct 2004 21:09] Konstantin Osipov
As the following backtrace demonstrates, the bug is in the new readline:

mysqldev@hpita2:~/kostja/mysql-4.1.6-gamma/tests> gdb ../client/mysql    
HP gdb 4.2 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 4.2 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for warranty/support.
..
(gdb) set args -uroot
(gdb) run
Starting program: /home/mysqldev/kostja/mysql-4.1.6-gamma/tests/../client/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.1.6-gamma-debug-log

No entry for terminal type "xterm";
using dumb terminal settings.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> help

For the complete MySQL Manual online, visit:
   http://www.mysql.com/documentation

For info on technical support from MySQL developers, visit:
   http://www.mysql.com/support

For info on MySQL books, utilities, consultants, etc., visit:
   http://www.mysql.com/portal

List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
?         (\?) Synonym for `help'.

(cut)

For server side help, type 'help contents'

mysql> quit

Program received signal SIGSEGV, Segmentation fault (si_code: 1).
0x4160390:1 in strvis (dst=0x40141cc0 "\001", src=0x400d3c70 "help", flag=28)
    at np/vis.c:330
330             MAKEEXTRALIST(flag, extra, "");
Current language:  auto; currently c
(gdb) bt
#0  0x4160390:1 in strvis (dst=0x40141cc0 "\001", src=0x400d3c70 "help", 
    flag=28) at np/vis.c:330
#1  0x411ba30:0 in history_save (h=0x400d6510, 
    fname=0x400d6410 "/home/mysqldev/.mysql_history") at history.c:734
#2  0x411e400:0 in history (h=0x400d6510, ev=0x7ffff4d0, fun=18)
    at history.c:899
#3  0x40c70d0:0 in write_history (
    filename=0x400d6410 "/home/mysqldev/.mysql_history") at readline.c:951
#4  0x40631e0:0 in mysql_end (sig=0) at mysql.cc:463
#5  0x4061480:0 in main (argc=7, argv=0x400dc490) at mysql.cc:448
(gdb)
[21 Oct 2004 12:43] Jani Tolonen
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