can't backup tables with $ in name

Bug #417178 reported by Ryan Huddleston
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraBackup moved to https://jira.percona.com/projects/PXB
Fix Released
Medium
Aleksandr Kuzminsky

Bug Description

innobackupex-1.5.1 is not able to backup tables with $ in the names as it results in this error:

tar: ea/reptmptbl14b74a892eed.ibd: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
innobackupex: tar returned with exit code 2.
innobackupex: Error: Failed to stream 'ea/reptmptbl14b74a892eed$1.ibd': at /usr/bin/innobackupex-1.5.1 line 452.

The problem appears to be becuase the system() call it causing the shell to interpret the $1 above as a shell variable.

I attempted to work around the issue below:

--- innobackupex-1.5.1 2009-08-21 15:49:32.878463000 -0700
+++ /usr/bin/innobackupex-1.5.1 2009-08-21 14:46:11.000000000 -0700
@@ -5,6 +5,7 @@
 #
 # Copyright 2003, 2009 Innobase Oy. All Rights Reserved.
 #
+$ENV{'PATH'} = '/usr/local/bin:/bin:/usr/bin:/home/rhuddleston/bin:/usr/local/rnt/bin/:/usr/local/rnt/sbin:/usr/local/bin:/sbin:/usr/sbin';

 use strict;
 use Getopt::Long;
@@ -882,6 +883,7 @@
                 print STDERR "$prefix from original InnoDB data directory '$orig_ibdata_dir'\n";
                 foreach my $a (split(/;/, $orig_innodb_data_file_path)) {
                     my $path = (split(/:/,$a))[0];
+ $path=~s/\$/\\\$/g;
                     if($option_remote_host) {
                         print STDERR "$prefix Backing up file '$orig_ibdata_dir/$path'\n";
                         system("scp $option_scp_opt '$orig_ibdata_dir/$path' '$option_remote_host:$backup_dir/$path'")
@@ -950,6 +952,7 @@
                         } elsif($option_stream eq 'tar') {
                             my $ret = 0;
                             my $file_name = substr($file, rindex($file, '/') + 1);
+ $file_name=~s/\$/\\\$/g;
                             if (!$option_tar4ibd) {
                                 $ret = system("cd $orig_datadir; tar cf - -b 32 $subdir/$file_name") >> 8;
                             } else {
@@ -1555,6 +1558,7 @@
     if ($option_stream) {
         my $filename_dir = substr($filename, 0, rindex($filename, '/') - 1);
         my $filename_name = substr($filename, rindex($filename, '/') + 1);
+ $filename_name=~s/\$/\\\$/g;
         if ($option_stream eq 'tar') {
             system("cd $filename_dir; tar cf - $filename_name")
                 and Die "Failed to stream '$filename_name': $!";
@@ -1867,6 +1871,7 @@
             } elsif($option_stream eq 'tar') {
                 my $ret = 0;
                 my $file_name = substr($file, rindex($file, '/') + 1);
+ $file_name=~s/\$/\\\$/g;
                 $ret = system("cd $source_dir; tar cf - $database/$file_name") >> 8;
                 if ($ret == 1) {
                     print STDERR "$prefix If you use GNU tar, this warning can be ignored.\n";

You should consider escaping anything that may be interpreted by the shel but in our case it's only $. Seems that you may have issue with # though.

thanks,

-Ryan

Changed in percona-xtrabackup:
assignee: nobody → Aleksandr Kuzminsky (akuzminsky)
importance: Undecided → Medium
status: New → Confirmed
Changed in percona-xtrabackup:
status: Confirmed → Triaged
Changed in percona-xtrabackup:
status: Triaged → In Progress
status: In Progress → Fix Committed
Changed in percona-xtrabackup:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXB-537

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.