b5d680cdec4733c90e11a800e610cece51699e03
[packages/mysql.git] / bug-44278.patch
1 http://bugs.mysql.com/bug.php?id=44278
2 http://lists.mysql.com/commits/80079?f=plain
3
4 From: Jim Winstead
5 Date: August 4 2009 7:00pm
6 Subject: bzr commit into mysql-5.1-bugteam branch (jimw:3055) Bug#44278
7 List-Archive: http://lists.mysql.com/commits/80079
8 X-Bug: 44278
9 MIME-Version: 1.0
10 Content-Type: multipart/mixed; boundary="===============1792034184=="
11
12 --===============1792034184==
13 MIME-Version: 1.0
14 Content-Type: text/plain; charset="us-ascii"
15 Content-Transfer-Encoding: 7bit
16 Content-Disposition: inline
17
18 #At file:///Users/jimw/my/mysql-5.1-fixes/ based on revid:jimw@stripped
19
20  3055 Jim Winstead      2009-08-04
21       mysqlhotcopy did not handle the encoding of schema names in the filesystem, so
22       schemas with most non-alphanumeric characters in their name could not be
23       backed up. (Bug #44278).
24
25     modified:
26       scripts/mysqlhotcopy.sh
27 === modified file 'scripts/mysqlhotcopy.sh'
28 --- Percona-Server-5.6.14-rel62.0/scripts/mysqlhotcopy.sh~      2013-12-20 14:56:59.000000000 +0200
29 +++ Percona-Server-5.6.14-rel62.0/scripts/mysqlhotcopy.sh       2013-12-20 14:58:39.183005974 +0200
30 @@ -222,7 +222,7 @@ my ($tgt_dirname, $to_other_database);
31  $to_other_database=0;
32  if (defined($tgt_name) && $tgt_name =~ m:^\w+$: && @db_desc <= 1)
33  {
34 -    $tgt_dirname = "$datadir/$tgt_name";
35 +    $tgt_dirname = "$datadir/" . encode_identifier_as_filename($tgt_name);
36      $to_other_database=1;
37  }
38  elsif (defined($tgt_name) && ($tgt_name =~ m:/: || $tgt_name eq '.')) {
39 @@ -285,7 +285,7 @@ foreach my $rdb ( @db_desc ) {
40      }
41  
42      ## get list of files to copy
43 -    my $db_dir = "$datadir/$db";
44 +    my $db_dir = "$datadir/" . encode_identifier_as_filename($db);
45      opendir(DBDIR, $db_dir ) 
46        or die "Cannot open dir '$db_dir': $!";
47  
48 @@ -353,7 +353,8 @@ if (defined($tgt_name) && length $tgt_na
49      elsif ($opt{method} =~ /^scp\b/) 
50      {   # we have to trust scp to hit the target
51         foreach my $rdb ( @db_desc ) {
52 -           $rdb->{target} = "$tgt_dirname/$rdb->{src}";
53 +           $rdb->{target} = "$tgt_dirname/" .
54 +                             encode_identifier_as_filename($rdb->{src});
55         }
56      }
57      else
58 @@ -361,7 +362,8 @@ if (defined($tgt_name) && length $tgt_na
59        die "Last argument ($tgt_dirname) is not a directory\n"
60         if (!(-e $tgt_dirname && -d $tgt_dirname ) );
61        foreach my $rdb ( @db_desc ) {
62 -       $rdb->{target} = "$tgt_dirname/$rdb->{src}";
63 +       $rdb->{target} = "$tgt_dirname/" .
64 +                         encode_identifier_as_filename($rdb->{src});
65        }
66      }
67    }
68 @@ -369,7 +371,8 @@ else {
69    die "Error: expected \$opt{suffix} to exist" unless ( exists $opt{suffix} );
70  
71    foreach my $rdb ( @db_desc ) {
72 -    $rdb->{target} = "$datadir/$rdb->{src}$opt{suffix}";
73 +    $rdb->{target} = "$datadir/" .
74 +                     encode_identifier_as_filename("$rdb->{src}$opt{suffix}");
75    }
76  }
77  
78 @@ -464,7 +464,8 @@
79      else {
80          mkdir($tgt_dirpath, 0750) or die "Can't create '$tgt_dirpath': $!\n"
81              unless -d $tgt_dirpath;
82 -        my @f_info= stat "$datadir/$rdb->{src}";
83 +        my @f_info= stat "$datadir/" .
84 +                         encode_identifier_as_filename($rdb->{src});
85          chown $f_info[4], $f_info[5], $tgt_dirpath;
86      }
87  }
88 @@ -471,7 +475,9 @@ my @failed = ();
89  
90  foreach my $rdb ( @db_desc )
91  {
92 -  my @files = map { "$datadir/$rdb->{src}/$_" } @{$rdb->{files}};
93 +  my @files = map { "$datadir/" .
94 +                    encode_identifier_as_filename($rdb->{src}) .
95 +                    "/$_" } @{$rdb->{files}};
96    next unless @files;
97    
98    eval { copy_files($opt{method}, \@files, $rdb->{target}); };
99 @@ -482,7 +488,8 @@ foreach my $rdb ( @db_desc )
100    if ($rdb->{index})
101    {
102      copy_index($opt{method}, \@files,
103 -              "$datadir/$rdb->{src}", $rdb->{target} );
104 +              "$datadir/" . encode_identifier_as_filename($rdb->{src}),
105 +               $rdb->{target} );
106    }
107    
108    if ( $opt{checkpoint} ) {
109 @@ -794,6 +801,20 @@ sub quote_names {
110    return "`$db`.`$table`";
111  }
112  
113 +#
114 +# In MySQL 5.1 and later, directory and table names are encoded on disk.
115 +# We use the server to figure out the encoded names, and just fall back
116 +# to the unencoded identifier if that fails.
117 +#
118 +sub encode_identifier_as_filename {
119 +  my ($ident)= @_;
120 +  my ($filename)= $dbh->selectrow_array(
121 +                    "SELECT BINARY(CAST(? AS CHAR CHARACTER SET FILENAME))",
122 +                    { RaiseError => 0 },
123 +                    $ident);
124 +  return $filename ? $filename : $ident;
125 +}
126 +
127  __END__
128  
129  =head1 DESCRIPTION
130
131
132 --===============1792034184==
133 MIME-Version: 1.0
134 Content-Type: text/bzr-bundle; charset="us-ascii";
135         name="bzr/jimw@stripped"
136 Content-Transfer-Encoding: 7bit
137 Content-Disposition: inline
138
139 # Bazaar merge directive format 2 (Bazaar 0.90)
140 # revision_id: jimw@stripped
141 # target_branch: file:///Users/jimw/my/mysql-5.1-fixes/
142 # testament_sha1: 21dd6f5b49582e2759b846d4abfe69e3f3c913d4
143 # timestamp: 2009-08-04 12:00:08 -0700
144 # source_branch: bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-\
145 #   5.1-bugteam/
146 # base_revision_id: jimw@stripped
147
148 # Begin bundle
149 IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWVQztd0AApl/gEh4YiBdZ///
150 +3c8oL////pQBe66qvPdunW5ninW21e3q7wJRCaDVPQmmNMgmCmzU1NqaG0aQaA02oZGmQSlNU/T
151 VPxU/SPRT9UAD1DIAAAAAyMJoA0E0mI1TANU9J6DU0eg0aajQMENPU0DPU9RGEkggTUeagAp+Knp
152 qYjTQGIA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sGmmuMZVqFCBSNrxOe
166 1u8ZNRFYlpIJ8BUC3JVpDFZrOcFFCfLYQvgKDk1XnlNzbtoYWNnZnOdpd1xSIMNwGxvDP6DoOkw2
167 pl5hM3b6mJBIIX60Y+1j4125WU3FTyoFp/jdLdXUzsrKqxVsI+qcja7ehndBBNJ+0H2QXLMZ3qBH
168 FAGAoUdOFHFxpvFI1G4vIl5QdjQOEJN9bCs0oCzt79cEwQIk5op3WF1axGUhk8sAXGlbb1y8g4LX
169 bmiyZEmcWa1wBzbEibDRjWTHw3CuUnINoRQfEcIfObkg0dkT7iLVyBfWvL1b8bLjSBwFqXSoha4w
170 GdVdwlqo1+O3KfgYi29khnSZaQ4DZEJdG6UidU923t5c7+djSySpCDzzCdQ0eWuT7KGEbLE+xnqa
171 QQo5ZtyZppSWgyyEdcTsbr5hDdryHDkn77hxB2NugTCzTtWyDBnj0X5IITKoGnpiQUY1zrCMUAzI
172 i5YoaO+QH6ULHPeeCi/kclxSRySB0wmuRQWk03igk2DoEimZCIPYV11pROQDVi9rSaDLLB4ZG+ks
173 rCmjodJw4TAnPDgyTCzpEd+jY8Wa3Ql4yVwEw+mvRcKqor1GECCy4uyopGRgGT2R9fMShRoIHZSW
174 TC23tYXz4vWnmUnAZq1JRn4TU1ySuF5QqhcjNY5oOAvw31oGIRPEh0yDZQnJkgEJTyiFxgSTBqhF
175 xDNuWFN4M70p7ZjEPCgWvXSM7ecSZW4fFxnHuCkSbHMM7LGmd1nUgqsouO2yLVoJUt4L93iAbYH1
176 V+tRCexYKb/DwJS6RC09X4Wo1vczNejREo9zZcNonSclxRzlnBsEuCY7p2aOVElUORgRVRiM773/
177 F3JFOFCQVDO13Q==
178
179
180 --===============1792034184==--
This page took 0.166385 seconds and 3 git commands to generate.