Bug #17217 mysql command-line client seg-faults tee-ing to non-existant file
Submitted: 8 Feb 2006 0:56 Modified: 16 Feb 2006 11:37
Reporter: David Hillman Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:3.23.58 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[8 Feb 2006 0:56] David Hillman
Description:
mysql> show status\T /home/hillman/incident.2/status
mysql: Can't create/write to file '/home/hillman/incident.2/status' (Errcode: 2)
Logging to file '/home/hillman/incident.2/status'
Segmentation fault

   The mysql client could handle this user-error a bit more gracefully than by seg-faulting.

How to repeat:
query \T non-existant-file
[8 Feb 2006 10:19] Valeriy Kravchuk
Thank you for a problem report. Is it giving you segfault for SHOW STATUS only or for any SQL statement?
[8 Feb 2006 20:41] David Hillman
any query...

mysql -ugotmisk5 -p -hdb2
select NOW() from dual \T /home/nobody/test.out
mysql: Can't create/write to file '/home/nobody/test.out' (Errcode: 2)
Logging to file '/home/nobody/test.out'
Segmentation fault
[8 Feb 2006 20:42] David Hillman
Clarification: if the file simply doesn't exist, it will be created.  if the file doesn't exist, and the user doesn't have permission to create it, a seg-fault results.
[15 Feb 2006 14:06] Valeriy Kravchuk
Verified just as described with mysql client of 3.23.59-BK:

openxs@suse:~/dbs/3.23> bin/mysql --version;
bin/mysql  Ver 11.18 Distrib 3.23.59, for suse-linux (i686)
openxs@suse:~/dbs/3.23> bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Didn't find any fields in table 't'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.19

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show status\T /root/status;
bin/mysql: Can't create/write to file '/root/status;' (Errcode: 13)
Logging to file '/root/status;'
Segmentation fault

Later versions work as expected:

openxs@suse:~/dbs/3.23> mysql --version
mysql  Ver 14.12 Distrib 5.0.18, for pc-linux-gnu (i686) using readline 5.0
openxs@suse:~/dbs/3.23> mysql -uroot --socket=/tmp/mysql.sock test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.19

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show status\T /root/status;
mysql: Can't create/write to file '/root/status;' (Errcode: 13)
Error logging to file '/root/status;'
    -> ;
+-----------------------------------+-----------+
| Variable_name                     | Value     |
+-----------------------------------+-----------+
| Aborted_clients                   | 2         |
| Aborted_connects                  | 0         |
| Binlog_cache_disk_use             | 0         |
| Binlog_cache_use                  | 0         |
| Bytes_received                    | 469       |
| Bytes_sent                        | 7377      |
...
[16 Feb 2006 11:37] Sergei Golubchik
mysql command line client from 3.23 is out of development.
use a client from 5.0, as it doesn't have this bug.