Bug #808 mysqlhotcopy ignores .my.cnf defaults
Submitted: 7 Jul 2003 20:06 Modified: 8 Jul 2003 8:14
Reporter: Larry Stone Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.13 OS:Solaris (Solaris 2.8 (sparc))
Assigned to: Jani Tolonen

[7 Jul 2003 20:06] Larry Stone
Description:
The mysqlhotcopy client ignores the client's .my.cnf configuration files.
All of the other clients read .my.cnf (using my_print_defaults if necessary
for script-based programs), so this seems to be an oversight.
The manual (chapter 4) says:
"mysqlhotcopy reads the groups [client] and [mysqlhotcopy] from the option files."

The patch below fixes the problem.

How to repeat:
Add options under [client] in your .my.cnf, then 
invoke mysqlhotcopy without username or password options and observe that it does not set them from .my.cnf. 

Suggested fix:
*** mysqlhotcopy.orig   Wed May 14 18:28:52 2003
--- mysqlhotcopy        Mon Jul  7 22:45:24 2003
***************
*** 81,86 ****
--- 81,101 ----
      die @_, $OPTIONS;
  }
  
+ ## get defaults from my.cnf, .my.cnf files:
+     my $my_print_defaults = 'my_print_defaults';
+     if ($0 =~ m#/#) {
+         my ($mybindir) = ($0 =~ m#(^.+)/[^/]+$#);
+         $my_print_defaults = "${mybindir}/my_print_defaults"
+           if length($mybindir);
+     }
+     my @defops = `$my_print_defaults client mysqlhotcopy`;
+     if ($?) { 
+         warn "Failed to invoke $my_print_defaults, cannot read defaults from files."; 
+     } else {
+       chop @defops;
+       splice @ARGV, 0, 0, @defops;
+     }
+ 
  my %opt = (
      user      => scalar getpwuid($>),
      noindices => 0,
[8 Jul 2003 8:14] Sergei Golubchik
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/

fixed. thanks