List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:July 9 2004 12:30pm
Subject:bk commit into 4.0 tree (serg:1.1893)
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of serg. When serg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1893 04/07/09 14:30:51 serg@stripped +1 -0
  mysqlhotcopy:
    fix MYI copying with scp
    safer tempfile creation

  scripts/mysqlhotcopy.sh
    1.43 04/07/09 14:30:48 serg@stripped +8 -8
    fix MYI copying with scp
    safer tempfile creation

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	serg
# Host:	serg.mylan
# Root:	/usr/home/serg/Abk/mysql-4.0

--- 1.42/scripts/mysqlhotcopy.sh	Tue May 25 21:00:12 2004
+++ 1.43/scripts/mysqlhotcopy.sh	Fri Jul  9 14:30:48 2004
@@ -8,6 +8,7 @@
 use DBI;
 use Sys::Hostname;
 use File::Copy;
+use File::Temp;
 
 =head1 NAME
 
@@ -626,7 +627,6 @@
 sub copy_index
 {
   my ($method, $files, $source, $target) = @_;
-  my $tmpfile="$opt_tmpdir/mysqlhotcopy$$";
   
   print "Copying indices for ".@$files." files...\n" unless $opt{quiet};  
   foreach my $file (@$files)
@@ -652,23 +652,23 @@
       }
       close OUTPUT	   || die "Error on close of $to: $!\n";
     }
-    elsif ($opt{method} eq 'scp')
+    elsif ($opt{method} =~ /^scp\b/)
     {
-      my $tmp=$tmpfile;
-      open(OUTPUT,">$tmp") || die "Can\'t create file $tmp: $!\n";
-      if (syswrite(OUTPUT,$buff) != length($buff))
+      my ($fh, $tmp)=tempfile('mysqlhotcopy-XXXXXX', DIR => $opt_tmpdir);
+      die "Can\'t create/open file in $opt_tmpdir\n";
+      if (syswrite($fh,$buff) != length($buff))
       {
 	die "Error when writing data to $tmp: $!\n";
       }
-      close OUTPUT	     || die "Error on close of $tmp: $!\n";
-      safe_system("scp $tmp $to");
+      close $fh || die "Error on close of $tmp: $!\n";
+      safe_system("$opt{method} $tmp $to");
+      unlink $tmp;
     }
     else
     {
       die "Can't use unsupported method '$opt{method}'\n";
     }
   }
-  unlink "$tmpfile" if  ($opt{method} eq 'scp');
 }
 
 
Thread
bk commit into 4.0 tree (serg:1.1893)Sergei Golubchik9 Jul