Bug #29634 mysqld_safe does not set err_log variable, error log file is not created
Submitted: 9 Jul 2007 1:06 Modified: 20 Dec 2007 17:02
Reporter: Anatoly Pidruchny (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.20 OS:Any
Assigned to: Timothy Smith CPU Architecture:Any
Tags: qc

[9 Jul 2007 1:06] Anatoly Pidruchny
Description:
When starting MySQL server with mysqld_safe&, the following two error messages are printed:

usage: touch [-amc] [-t [[CC]YY]MMDDhhmm[.SS] | -r ref_file] file ...
usage: chown [-R] [-h] owner[:group] file ...

And no error file is created. The reason is that the err_log variable is not set when line 398 of the mysqld_safe script is executed. There is an easy workaround. If --log-error option is used then the err_log variable is assigned a value and no error messages are printed and the specified error log file is created and used.

This problem is a new for release 5.1.20. Looks like it happens because the new variable and option syslog was added.

How to repeat:
Stop MySQL server and then run:

mysqld_safe&

Suggested fix:
I think the problem is that the variable syslog is initialized with 2, not with 0 or 1. The value 2 causes problems later. Either the syslog variable should be initialized with 0 or 1, or some checks later in the script should be changed to handle the value 2 of the syslog variable properly.
[9 Jul 2007 9:33] Sveta Smirnova
Thank you for the report.

Please specify operating system you use.
[9 Jul 2007 12:22] Anatoly Pidruchny
Hi Sveta,

I was testing on HP-UX 11.11. But I do not think the bug is specific only for this OS. For your convenience I am attaching the output from running the command:

/bin/sh -x mysqld_safe&

/Anatoly.
[9 Jul 2007 12:22] Anatoly Pidruchny
Output from "/bin/sh -x mysqld_safe"

Attachment: bug29634_output.txt (text/plain), 3.05 KiB.

[9 Jul 2007 20:40] Anatoly Pidruchny
Hi Sveta,

As another workaround, I just changed the line 18 in the mysqld_safe script to initialize syslog variable with 0:

mysqld_safe:18: syslog=0

I do not need logging to syslog by default (and before options are even parsed). After that mysqld_safe script works fine for me.

/Anatoly.
[9 Jul 2007 22:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/30575

ChangeSet@1.2547, 2007-07-09 16:10:43-06:00, tsmith@sita.local +1 -0
  Bug #29634: mysqld_safe does not set err_log variable, error log file is not created
  
  Dont touch & chmod the err_log file if using syslog (mysqld_safe)
[9 Jul 2007 22:10] Timothy Smith
Anatoly,

Hi!  Thanks for finding this.  I thought I'd already fixed it, but it's not fixed in the current source tree.  I will have a patch ready soon.

Your workarounds are fine.  Or,
[9 Jul 2007 22:13] Timothy Smith
Patch pending review:

http://lists.mysql.com/commits/30575
[10 Jul 2007 13:26] Bugs System
Pushed into 5.1.21-beta
[18 Jul 2007 19:06] Paul DuBois
Noted in 5.1.21 changelog.

mysqld_safe produced error messages and did not create the error log
file under some circumstances.
[20 Dec 2007 17:02] Daniel Fischer
This has since been fixed, there is no occurence of '$syslog' in mysqld_safe.sh right now.