Bug #50337 --defaults-file=~/something doesn't work anymore
Submitted: 14 Jan 2010 15:48 Modified: 7 Mar 2010 1:13
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.5.99-m3 OS:Linux (64)
Assigned to: Marc ALFF CPU Architecture:Any
Tags: regression

[14 Jan 2010 15:48] Guilhem Bichot
Description:
using latest next-mr-bugfixing revision-id:olav@sun.com-20100114123942-ie1pbuub6qg6ll9n

./sql/mysqld --defaults-file=~/defaults
Could not open required defaults file: ~/defaults
Fatal error in defaults handling. Program aborted

A few days ago it worked (when I had revision-id:guilhem@mysql.com-20100106153111-85776eajdrd4yxxa).
Bug also exists in latest 6.0-codebase-bugfixing.

How to repeat:
Create ~/defaults with some options, like this:
[mysqld]
port=3392
language=./sql/share/english
datadir=something
pid-file=something/pid
socket=something/sock
skip-grant-tables
gdb
skip-innodb

and do
./sql/mysqld --defaults-file=~/defaults
make sure that $HOME is set (otherwise it's understandable that ~ doesn't work).

Suggested fix:
I have reviewed WL#4876/WL#2360 and believe it's caused by it (shame on me for not spotting it ;-). Before opening ~/defaults, we need to replace ~ by the real home; we get this real home from $HOME, in my_init(). But after WL#4876, options are parsed before my_init() (for a good reason), so when they are parsed, home_dir is NULL (unset).
Suggestion: set home_dir in my_basic_init(), not my_init().
[18 Jan 2010 9:01] Sveta Smirnova
Thank you for the report.

Verified as described.
[25 Jan 2010 18:00] 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/98109

2974 Marc Alff	2010-01-25
      Bug#50337 --defaults-file=~/something doesn't work anymore
      
      Before this fix, opening a configuration file located under "~" failed.
      To evaluate the "~" path, home_dir needs to be initialized.
      The 'home_dir' variable was initialized too late in my_init().
      
      This fix:
      - moved the home_dir initialization from my_init() to my_basic_init(),
        using getenv("HOME"))
      - moved the initialization of my_umask / my_umask_dir also to
        my_basic_init(), to have all the my_umask / my_umask_dir init code in the
        same place.
      
      The second part is not strictly required, but makes the code more
      maintainable.
      
      Tested the fix manually.
      
      No MTR tests added, because MTR should not access or modify the $HOME
      directory of the user running tests.
[26 Jan 2010 3:53] 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/98139

2974 Marc Alff	2010-01-25
      Bug#50337 --defaults-file=~/something doesn't work anymore
      
      Before this fix, opening a configuration file located under "~" failed.
      To evaluate the "~" path, home_dir needs to be initialized.
      The 'home_dir' variable was initialized too late in my_init().
      
      This fix:
      - moved the home_dir initialization from my_init() to my_basic_init(),
        using getenv("HOME"))
      - moved the initialization of my_umask / my_umask_dir also to
        my_basic_init(), to have all the my_umask / my_umask_dir init code in the
        same place.
      
      The second part is not strictly required, but makes the code more
      maintainable.
      
      Tested the fix manually.
      
      No MTR tests added, because MTR should not access or modify the $HOME
      directory of the user running tests.
[26 Jan 2010 21:31] Marc ALFF
Patch queued in:
- mysql-next-mr-marc
- mysql-6.0-codebase-marc
[3 Feb 2010 16:11] Marc ALFF
See related Bug#50880
[13 Feb 2010 8:37] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100213083436-9pesg4h55w1mekxc) (version source revid:luis.soares@sun.com-20100211135109-t63avry9fqpgyh78) (merge vers: 6.0.14-alpha) (pib:16)
[13 Feb 2010 8:39] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100213083327-cee4ao3jpg33eggv) (version source revid:luis.soares@sun.com-20100211135018-1f9dbghg0itszigo) (pib:16)
[13 Feb 2010 13:19] Marc ALFF
Doc team:
- regression introduced in mysql-next-mr (betony)
- fixed in mysql-next-mr (celosia)

Never affected a GA version.
[13 Feb 2010 17:55] Paul DuBois
No changelog entry needed. Did not appear in any released version.

Setting report to Need Merge pending push of Celosia to release tree.
[6 Mar 2010 11:03] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20100213160132-nx1vlocxuta76txh) (merge vers: 5.5.99-m3) (pib:16)
[7 Mar 2010 1:13] Paul DuBois
No changelog entry needed.