| Bug #70058 | Getting mysqld --help as root exits with 1 | ||
|---|---|---|---|
| Submitted: | 16 Aug 2013 7:38 | Modified: | 8 Jan 2014 16:57 |
| Reporter: | Honza Horak (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Tests: Server | Severity: | S3 (Non-critical) |
| Version: | 5.5.33, 5.6.13 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
[17 Aug 2013 9:32]
MySQL Verification Team
Hello Honza, Thank you for the report and contribution. Verified as described. Thanks, Umesh
[8 Jan 2014 16:57]
Paul DuBois
Noted in 5.5.37, 5.6.17, 5.7.4 changelogs. When run by root, mysqld --help --verbose exited with a nonzero error code after displaying the help message.

Description: I'm on Fedora and try to get verbose help as root: sudo /usr/libexec/mysqld --help --verbose It kinda works but the exit code is 1, which is not what I'd expect, since I wanted just help message. How to repeat: 1. su - 2. /usr/libexec/mysqld --help --verbose 3. echo $? Actual result: 1 Expected result: 0 Suggested fix: This is a patch that makes mysqld to exit with 0 when asking only for help. This patch is licensed under BSD license, so feel free to use it in whatever manner you would like. diff -up mariadb-5.5.32/sql/mysqld.cc.nofailonhelp mariadb-5.5.32/sql/mysqld.cc --- mariadb-5.5.32/sql/mysqld.cc.nofailonhelp 2013-08-16 09:07:16.408073121 +0200 +++ mariadb-5.5.32/sql/mysqld.cc 2013-08-16 09:07:54.535032731 +0200 @@ -1747,11 +1747,11 @@ extern "C" void unireg_abort(int exit_co if (opt_help) usage(); - if (exit_code) + if (!opt_help && exit_code) sql_print_error("Aborting\n"); clean_up(!opt_abort && (exit_code || !opt_bootstrap)); /* purecov: inspected */ DBUG_PRINT("quit",("done with cleanup in unireg_abort")); - mysqld_exit(exit_code); + mysqld_exit(opt_help ? 0 : exit_code); } static void mysqld_exit(int exit_code)