Index: innobackup =================================================================== --- innobackup (Revision 91) +++ innobackup (Arbeitskopie) @@ -738,7 +738,7 @@ # database copy_incremental_to_full_backup(); } else { - $options = $options . " $backup_dir/backup-my.cnf"; + $options = $options . " '$backup_dir/backup-my.cnf'"; } # run ibbackup as a child process @@ -748,7 +748,7 @@ $rcode = system("$cmdline"); if ($rcode) { # failure - Die "\n$prefix ibbackup failed"; + Die "$prefix ibbackup failed"; } } @@ -832,7 +832,7 @@ $options = $options . " --incremental $option_lsn"; } $cmdline = "$option_ibbackup_binary $options $config_file " - ."$backup_config_file"; + ."'$backup_config_file'"; # run ibbackup as a child process $now = current_time(); @@ -885,7 +885,7 @@ # run mysql as a child process with a pipe connection $now = current_time(); print "$now $prefix Starting mysql with options: $options\n"; - $mysql_pid = open(*MYSQL_WRITER, "| mysql $options >$mysql_stdout 2>$mysql_stderr ") or Die "Failed to spawn mysql child process: $!"; + $mysql_pid = open(*MYSQL_WRITER, "| mysql $options >'$mysql_stdout' 2>'$mysql_stderr' ") or Die "Failed to spawn mysql child process: $!"; MYSQL_WRITER->autoflush(1); $now = current_time(); print "$now $prefix Connected to database with mysql child process (pid=$mysql_pid)\n"; @@ -919,13 +919,13 @@ while (index($stdout, $hello_message) < 0) { sleep 2; if ($mysql_pid && $mysql_pid == waitpid($mysql_pid, &WNOHANG)) { - my $reason = `cat $mysql_stderr`; + my $reason = `cat '$mysql_stderr'`; $mysql_pid = ''; kill_child_processes(); die "mysql child process has died: $reason"; } - $stdout = `cat $mysql_stdout`; - $stderr = `cat $mysql_stderr`; + $stdout = `cat '$mysql_stdout'`; + $stderr = `cat '$mysql_stderr'`; if ($stderr) { # mysql has reported an error, do exit kill_child_processes(); @@ -1122,12 +1122,21 @@ if ($mysql_pid && (-1 == ($rcode = waitpid($mysql_pid, &WNOHANG)) || $rcode == $mysql_pid)) { - my $reason = `cat $mysql_stderr`; + my $reason = `cat '$mysql_stderr'`; print "Pipe to mysql child process broken: $reason at"; system("date +'%H:%M:%S'"); exit(1); } else { - Die "Broken pipe"; + # We don't use other pipes explicitly. + # Must be stdout from writing a message. + # Verify by writing a message to stderr. + # If this fails, redirect stderr to stdout. + print STDERR "Warning: Broken pipe on stdout\n" + or open STDERR, ">&STDOUT" + and print "Warning: Broken pipe on stderr\n"; + # From now on, use stderr for messages, which possibly has just + # been redirected to stdout. + open STDOUT, ">&STDERR"; } }