Bug #38180 options are read from ~/my.cnf instead of ~/.my.cnf
Submitted: 16 Jul 2008 17:24 Modified: 28 Jul 2008 15:33
Reporter: Timothy Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:5.0.66, 5.1 bzr, 6.0.6 bzr OS:Any (Unix)
Assigned to: Timothy Smith CPU Architecture:Any
Tags: my.cnf, Options, regression

[16 Jul 2008 17:24] Timothy Smith
Description:
Options are read from ~/my.cnf instead of ~/.my.cnf, after the fix for Bug #20748.  This affects all MySQL programs (mysqld, mysql, mysqldump, etc.), since they all use the same underlying routines.

A workaround is:

$ ln -s .my.cnf "$HOME/my.cnf"

This bug is in the released 5.0.66 version, and not in 5.0.64.

This bug is also in the main 6.0 branch (not yet released), and in the 5.1-bugteam team branch.

How to repeat:
Create a ~/.my.cnf with the following contents:

[client]
socket=/TEST

Then run:

./bin/mysql --help --verbose | egrep '(my.cnf|^socket)'
                      order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /home/tsmith/m/bzr/60/install/etc/my.cnf /home/tsmith/my.cnf 
socket                            (No default value)

Notice "/home/tsmith/my.cnf" and "(No default value)", instead of "/home/tsmith/.my.cnf" and "/TEST".

Suggested fix:
This is caused by the fix for Bug #20748.  "~/" is being expanded to the full path while normalizing directory names.  Later, we look for the initial "~" to determine if the "." should be prepended to the config file name.

Probably the best fix is to use cleanup_dirname() instead of unpack_dirname() in mysys/default.c:add_directory().

It should be possible to add a test for this by setting $HOME to $MYSQLTEST_VARDIR/tmp and calling the mysql client
[16 Jul 2008 17:33] Timothy Smith
Minor correction on versions:  this bug is in the main 5.1 branch (not released), not just 5.1-bugteam team branch.
[16 Jul 2008 22:34] 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/49895

2638 Timothy Smith	2008-07-16
      Bug #38180  	options are read from ~/my.cnf instead of ~/.my.cnf
      
      Pull out some of unpack_dirname() into normalize_dirname(); this
      new function does not expand "~" to the home directory.  Use this
      function in unpack_dirname(), and use it during init_default_directories()
      to remove duplicate entries without losing track of which directory
      is a user's home dir.
[16 Jul 2008 22:58] 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/49897

2638 Timothy Smith	2008-07-16
      Bug #38180  	options are read from ~/my.cnf instead of ~/.my.cnf
      
      Pull out some of unpack_dirname() into normalize_dirname(); this
      new function does not expand "~" to the home directory.  Use this
      function in unpack_dirname(), and use it during init_default_directories()
      to remove duplicate entries without losing track of which directory
      is a user's home dir.
[16 Jul 2008 23:07] 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/49898

2638 Timothy Smith	2008-07-16
      Bug #38180  	options are read from ~/my.cnf instead of ~/.my.cnf
      
      Pull out some of unpack_dirname() into normalize_dirname(); this
      new function does not expand "~" to the home directory.  Use this
      function in unpack_dirname(), and use it during init_default_directories()
      to remove duplicate entries without losing track of which directory
      is a user's home dir.
[17 Jul 2008 15:57] Paul DuBois
Noted in 5.0.66a changelog.

The fix for Bug#20748 caused a problem such that on Unix, MySQL
programs looked for options in ~/my.cnf rather than the standard
location of ~/.my.cnf.
[17 Jul 2008 17:09] 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/49957

2648 Timothy Smith	2008-07-17 [merge]
      Merge in changes from mysql-5.0.66a-release into 5.0.
      
      Includes fix for Bug #38180, "options are read from ~/my.cnf instead of ~/.my.cnf"
[17 Jul 2008 17:45] 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/49961

2703 Timothy Smith	2008-07-17 [merge]
      Up-merge 5.0.66a-release changes (via 5.0) into 5.1.
      
      Includes fix for Bug #38180, "options are read from ~/my.cnf instead of ~/.my.cnf"
[18 Jul 2008 15:41] 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/50044

2582 Jonathan Perkin	2008-07-18 [merge]
      Merge fix for bug#38180 from mysql-5.0.66a-release
[18 Jul 2008 15:43] 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/50047

2582 Jonathan Perkin	2008-07-18 [merge]
      Merge fix for bug#38180 from mysql-5.0.66a-release
[18 Jul 2008 15:45] 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/50048

2582 Jonathan Perkin	2008-07-18 [merge]
      Merge fix for bug#38180 from mysql-5.0.66a-release
[18 Jul 2008 18:34] 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/50055

2582 Timothy Smith	2008-07-18 [merge]
      Cherry-pick merge from mysql-5.0.66a-release:
      
        Bug #38180    options are read from ~/my.cnf instead of ~/.my.cnf
        
        Pull out some of unpack_dirname() into normalize_dirname(); this
        new function does not expand "~" to the home directory.  Use this
        function in unpack_dirname(), and use it during init_default_directories()
        to remove duplicate entries without losing track of which directory
        is a user's home dir.
[18 Jul 2008 21:46] 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/50062

2672 Timothy Smith	2008-07-18
      Cherry-pick fix for Bug #38180, from mysql-5.0.66a-release branch.
[18 Jul 2008 22:03] 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/50063

2672 Timothy Smith	2008-07-18
      Cherry-pick fix for Bug #38180, from mysql-5.0.66a-release branch.
[21 Jul 2008 4:22] Bugs System
Pushed into 5.0.66
[21 Jul 2008 4:29] Bugs System
Pushed into 5.0.66
[21 Jul 2008 4:33] Bugs System
Pushed into 5.0.66
[21 Jul 2008 9:37] Bugs System
Pushed into 6.0.6-alpha
[23 Jul 2008 9:37] Bugs System
Pushed into 5.0.68  (revid:kpettersson@mysql.com-20080722105515-spaji7abvxqq7mge) (pib:2)
[23 Jul 2008 13:08] Bugs System
Pushed into 6.0.7-alpha  (revid:serg@mysql.com-20080722121106-wy84j0yvceyu72zr) (pib:2)
[28 Jul 2008 12:58] Georgi Kodinov
Pushed into 5.1.28
[28 Jul 2008 13:45] Bugs System
Pushed into 5.0.68  (revid:kpettersson@mysql.com-20080722105515-spaji7abvxqq7mge) (pib:2)
(Retry automatic marking, to ensure nothing is missed. cm01)
[28 Jul 2008 15:33] Paul DuBois
Noted in 5.1.28, 6.0.7 changelogs.
[28 Jul 2008 16:46] Bugs System
Pushed into 5.1.28  (revid:timothy.smith@sun.com-20080719034818-fl16isu2i7fj47lb) (version source revid:timothy.smith@sun.com-20080719034818-fl16isu2i7fj47lb) (pib:3)
[15 Aug 2008 9:47] 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/51708

2583 Jonathan Perkin	2008-08-15 [merge]
      Merge from mysql-5.0.67-release
[13 Sep 2008 23:10] Bugs System
Pushed into 6.0.6-alpha  (revid:timothy.smith@sun.com-20080716225845-p822e62xnhy7g27b) (version source revid:klewis@mysql.com-20080715185946-x4iqy1c9qzyqtx0g) (pib:3)
[6 May 2009 20:23] Bugs System
Pushed into 5.0.82 (revid:chad@mysql.com-20090506130632-s1cl4ygdj9rt2rrz) (version source revid:chad@mysql.com-20090506130632-s1cl4ygdj9rt2rrz) (merge vers: 5.0.82) (pib:6)
[28 May 2009 8:21] Bugs System
Pushed into 5.1.36 (revid:joro@sun.com-20090528073639-yohsb4q1jzg7ycws) (version source revid:jimw@mysql.com-20090515174051-ndjvfd1e9hc9k9c3) (merge vers: 5.1.36) (pib:6)
[17 Jun 2009 19:28] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090616183122-chjzbaa30qopdra9) (version source revid:joro@sun.com-20090515134506-5mq3a8fafgbkx6u1) (merge vers: 6.0.12-alpha) (pib:11)
[26 Aug 2009 13:45] 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:32] 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)