Bug #44736 mysqld_safe's my_which() is broken and doesn't find 'logger'
Submitted: 8 May 2009 4:13 Modified: 26 Jun 2009 2:25
Reporter: Stef Walter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:5.1.34. 5.1 bzr OS:Any (FreeBSD, Linux)
Assigned to: Staale Smedseng CPU Architecture:Any
Tags: Contribution

[8 May 2009 4:13] Stef Walter
Description:
When started with the --syslog option, mysqld_safe fails with this message:

090508 03:54:50 mysqld_safe --syslog requested, but no 'logger' program found.  Please ensure that 'logger' is in your PATH, or do not specify the --syslog option to mysqld_safe.

The logger program is present:

# which logger
/usr/bin/logger

How to repeat:
Configure mysqld to run with the --syslog option

Suggested fix:
The function my_which() near line 63 of mysqld_safe is broken and very likely hasn't been tested. Use of the --syslog option is the only thing that triggers a call to my_which(). 

The following patch fixes the problem:

--- scripts/mysqld_safe.orig	2009-05-08 03:55:41.000000000 +0000
+++ scripts/mysqld_safe	2009-05-08 03:56:09.000000000 +0000
@@ -68,5 +68,5 @@
   for file
   do
-    for dir in "$PATH"
+    for dir in $PATH
     do
       if [ -f "$dir/$file" ]
[8 May 2009 5:25] Sveta Smirnova
Thank you for the report.

Verified as described.

In version 6.0 this looks to be fixed, although can not find existent bug report about this.
[8 May 2009 7:34] Stef Walter
Patch which fixes the problem

Attachment: mysqld_safe_my_which.patch (text/x-patch), 251 bytes.

[8 May 2009 16:11] Stef Walter
This is the commit that broke my_which(): 

http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1/revision/2806.38.2

It adds quoting to various shell variables. Most of them are valid changes, but the changes to line 69 are almost clearly broken and untested.
[25 May 2009 16:22] 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/74897

2910 Staale Smedseng	2009-05-25
      Bug #44736 mysqld_safe's my_which() is broken and 
      doesn't find 'logger'
      
      Due to a variable quoting mistake, the $PATH environment
      variable isn't parsed correctly when searching for the
      existence of the desired executable(s) (logger in this 
      case).
      
      This patch removes the quotes.
[28 May 2009 8:21] Bugs System
Pushed into 5.1.36 (revid:joro@sun.com-20090528073639-yohsb4q1jzg7ycws) (version source revid:staale.smedseng@sun.com-20090525162140-si1aiu6jpx3wgpas) (merge vers: 5.1.36) (pib:6)
[1 Jun 2009 20:32] Paul DuBois
Noted in 5.1.36 changelog.

mysqld_safe could fail to find the logger program.

Setting report to NDI pending push into 6.0.x.
[17 Jun 2009 19:28] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090616183122-chjzbaa30qopdra9) (version source revid:staale.smedseng@sun.com-20090525171556-ctp29n9hnqbt2mrj) (merge vers: 6.0.12-alpha) (pib:11)
[26 Jun 2009 2:25] Paul DuBois
Noted in 5.4.4 changelog.
[12 Aug 2009 22:29] Paul DuBois
Noted in 5.4.2 changelog because next 5.4 version will be 5.4.2 and not 5.4.4.
[15 Aug 2009 1:48] Paul DuBois
Ignore previous comment about 5.4.2.
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 2009 13:48] Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 2009 16:33] Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[16 Jan 2010 1:06] Paul DuBois
Noted in 5.5.0 changelog.