Bug #1376 client utilities don't return useful exit status for usage errors
Submitted: 23 Sep 2003 5:05 Modified: 25 Sep 2003 23:58
Reporter: Tim Bunce Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version: OS:
Assigned to: CPU Architecture:Any

[23 Sep 2003 5:05] Tim Bunce
Description:
MySQL client utilities don't return useful exit status for usage errors such as bad options.

How to repeat:
$ mysql --foobar
mysql: unrecognized option `--foobar'
...
$ echo $?
0

$ mysqladmin --foobar
 ...
$ echo $?
0

Suggested fix:
Exit with non-zero status for invalid command line options. Trivial change.
[23 Sep 2003 5:11] Tim Bunce
Forgot to mention that the problem also includes invalid options that are read from configuration files (e.g. ~/.my.cnf).

I ran into this problem after I added an option (local-infile=1) to ~/.my.cnf

The option works fine for newer mysql clients, but older ones failed *and did not return a non-zero exit status*. This caused some batch jobs to fail in obscure ways that took time to track down.
[23 Sep 2003 5:15] Tim Bunce
You can cancel this bug report.

I've just confirmed that v4.0.12 clients do return a non-zero exit status.
(For various reasons I wasn't able to do that at the time I reported it.)

Sorry for troubling you.
[25 Sep 2003 23:58] Alexander Keremidarski
Tim,

Thank you for taking your time to investigate further and resolve this issue after reporing it.