| Bug #68118 | 5.6.x mysql_install_db perl script not always showing error messages | ||
|---|---|---|---|
| Submitted: | 18 Jan 2013 12:27 | Modified: | 1 Mar 2013 17:14 |
| Reporter: | Hartmut Holzgraefe | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Installing | Severity: | S3 (Non-critical) |
| Version: | mysql-5.6.9 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
[18 Jan 2013 13:58]
Valeriy Kravchuk
This is easy to verify:
[valerii.kravchuk@cisco1 mysql-5.6.9-rc-linux-glibc2.5-x86_64]$ fgrep -rn 'error(' scripts/mysql_install_db | grep -v opt
415: error("Specify either --basedir or --srcdir, not both");
453:open (TEMPL, $cfg_template) or error("Could not open config template");
454:open (CFG, "> $copy_cfg_file") or error("Could not open config file");
[21 Jan 2013 10:33]
Erlend Dahl
Still the case on latest 5.6 sources.
[6 Feb 2013 15:19]
Hartmut Holzgraefe
how to reproduce: see bug #68117 not 68177
[6 Feb 2013 17:28]
Leandro Morgado
Hartmut is right, this is a simple case of error() being invoked with wrong parameter count. I have attached small patch and the full patched script:
--- mysql_install_db 2013-02-06 16:46:05.000000000 +0000
+++ mysql_install_db.lmorgado-16197542 2013-02-06 16:42:17.000000000 +0000
@@ -402,7 +402,8 @@
if ( $opt->{srcdir} and $opt->{basedir} )
{
- error("Specify either --basedir or --srcdir, not both");
+ error($opt,
+ "Specify either --basedir or --srcdir, not both");
}
if ( $opt->{srcdir} )
{
@@ -440,8 +441,8 @@
$copy_cfg_file =~ s/my.cnf/my-new.cnf/;
# Too early to print warning here, the user may not notice
}
-open (TEMPL, $cfg_template) or error("Could not open config template");
-open (CFG, "> $copy_cfg_file") or error("Could not open config file");
+open (TEMPL, $cfg_template) or error($opt, "Could not open config template");
+open (CFG, "> $copy_cfg_file") or error($opt, "Could not open config file");
while (<TEMPL>)
{
# Remove lines beginning with # *** which are template comments
[6 Feb 2013 17:29]
Leandro Morgado
diff -u mysql_install_db mysql_install_db.lmorgado-16197542
Attachment: diff-u (application/octet-stream, text), 874 bytes.
[6 Feb 2013 17:29]
Leandro Morgado
full script with patch
Attachment: mysql_install_db.lmorgado-16197542 (application/octet-stream, text), 31.88 KiB.
[6 Feb 2013 17:46]
Leandro Morgado
Just to clarify, I made the changes against 5.6.10 mysql_install_db
[8 Feb 2013 14:31]
David Damerell
This just hit us when we ran the mysql_install_db it simply stated "FATAL ERROR" without the message; could we also ask that in lines like those below.
open (TEMPL, $cfg_template) or error("Could not open config template");
open (CFG, "> $copy_cfg_file") or error("Could not open config file");
That you state which file couldn't be opened for reading/writing.
[1 Mar 2013 17:14]
Paul DuBois
Noted in 5.6.11, 5.7.1 changelogs. The Perl version of mysql_install_db mishandled some error messages.

Description: The error() routine in mysql_install_db.pl.in takes two parameters $opt and $text, but there are several invocations that just pass a single message parameter like error("some message") which lead to FATAL ERROR: messages being printed without the actual message text How to repeat: See e.g. Bug #68177 Suggested fix: Fix single-parameter calls to error(), or make it print the 1st parameter if called with just one parameter