Bug #51553 document that ~/.my.cnf means $HOME/.my.cnf
Submitted: 26 Feb 2010 13:59 Modified: 26 Feb 2010 18:59
Reporter: Axel Schwenke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S4 (Feature request)
Version:any OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[26 Feb 2010 13:59] Axel Schwenke
Description:
The online manual in http://dev.mysql.com/doc/refman/5.1/en/option-files.html mentions that the user option file is ~/.my.cnf. It does not say how the home directory of the user is determined. It seems that the $HOME environment variable is used for that, so the file is looked for as $HOME/.my.cnf.

How to repeat:
set some client option in ~/.my.cnf, then run a command line tool like so:

env -i mysql
env -u HOME mysql

and see how it not finds ~/.my.cnf

Suggested fix:
Either add some words that the $HOME environment variable is used or simpy replace "~/.my.cnf" with "$HOME/.my.cnf". This would mix nicely with $MYSQL_HOME/my.cnf that is also used there.
[26 Feb 2010 16:52] Davi Arnaut
The value of $HOME is used for performing tilde expansion. No $HOME, no tilde expansion either.
[26 Feb 2010 16:54] Davi Arnaut
At least for bash.
[26 Feb 2010 17:11] Axel Schwenke
Davi,

I agree that in most cases $HOME is used to find the homedir. But there are also getpw(3), getpwnam(3), getpwuid(3) for the same purpose. Our tools evaluate only $HOME and nothing else. This should be documented.

And just for the records; "man bash" says:

Tilde Expansion
... the tilde is replaced with the value of the shell parameter HOME. If HOME is unset, the home directory of the user executing the shell is substituted instead.
[26 Feb 2010 18:49] Paul DuBois
"Our tools evaluate only $HOME and nothing else."

mysys/default.c:init_default_directories():

#if !defined(__WIN__) && !defined(__NETWARE__)
  errors += add_directory(alloc, "~/", dirs);
#endif
[26 Feb 2010 18:59] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

Added:

~ represents the current user's home directory (the value of $HOME).