Description:
I think I found a problem in mysqlhotcopy script. When I use a regexp like this :
$ mysqlhotcopy database_name./^table_name$/
mysqlhotcopy don't process table_name, it's possible to bypass this if I add backquotes to "table_name" like this :
$ mysqlhotcopy database_name./^`table_name`$/
In this case mysqlhotcopy is able to apply the regexp on "table_name" but not the files of the database, so the process is not complete. The problem is when it checks the regexp the tables name are already backquoted in the array, not the files.
How to repeat:
$ mysqlhotcopy database_name./^table_name$/
Suggested fix:
I don't know how to make a patch and I'm not a Perl programmer ;) But here is a diff of the modifications I made because I absolutly needed a working mysqlhotcopy.
--------------------------------8<--------------------------------
--- /usr/bin/mysqlhotcopy       2005-01-13 04:35:05.000000000 +0100
+++ mysqlhotcopy                2005-01-25 17:18:49.149811727 +0100
@@ -280,11 +280,17 @@
         $t_regex = qr/$t_regex/;           ## make regex string from
                                            ## user regex
 
+        ## generate an array of tables without backquotes.
+        my @regex_tables;
+        foreach my $tbl (@dbh_tables) {
+            $tbl =~ s/`//g;
+            push @regex_tables, $tbl;
+        }
         ## filter (out) tables specified in t_regex
         print "Filtering tables with '$t_regex'\n" if $opt{debug};
         @dbh_tables = ( $negated 
-                        ? grep { $_ !~ $t_regex } @dbh_tables
-                        : grep { $_ =~ $t_regex } @dbh_tables );
+                        ? grep { $_ !~ $t_regex } @regex_tables
+                        : grep { $_ =~ $t_regex } @regex_tables );
     }
 
     ## get list of files to copy
-------------------------------->8--------------------------------
Someone would certainly be able to write this clean :)
  
 
 
 
 
Description: I think I found a problem in mysqlhotcopy script. When I use a regexp like this : $ mysqlhotcopy database_name./^table_name$/ mysqlhotcopy don't process table_name, it's possible to bypass this if I add backquotes to "table_name" like this : $ mysqlhotcopy database_name./^`table_name`$/ In this case mysqlhotcopy is able to apply the regexp on "table_name" but not the files of the database, so the process is not complete. The problem is when it checks the regexp the tables name are already backquoted in the array, not the files. How to repeat: $ mysqlhotcopy database_name./^table_name$/ Suggested fix: I don't know how to make a patch and I'm not a Perl programmer ;) But here is a diff of the modifications I made because I absolutly needed a working mysqlhotcopy. --------------------------------8<-------------------------------- --- /usr/bin/mysqlhotcopy 2005-01-13 04:35:05.000000000 +0100 +++ mysqlhotcopy 2005-01-25 17:18:49.149811727 +0100 @@ -280,11 +280,17 @@ $t_regex = qr/$t_regex/; ## make regex string from ## user regex + ## generate an array of tables without backquotes. + my @regex_tables; + foreach my $tbl (@dbh_tables) { + $tbl =~ s/`//g; + push @regex_tables, $tbl; + } ## filter (out) tables specified in t_regex print "Filtering tables with '$t_regex'\n" if $opt{debug}; @dbh_tables = ( $negated - ? grep { $_ !~ $t_regex } @dbh_tables - : grep { $_ =~ $t_regex } @dbh_tables ); + ? grep { $_ !~ $t_regex } @regex_tables + : grep { $_ =~ $t_regex } @regex_tables ); } ## get list of files to copy -------------------------------->8-------------------------------- Someone would certainly be able to write this clean :)