Skip to content

Commit

Permalink
Merge pull request #6 from kobliha/Code-11-SP2
Browse files Browse the repository at this point in the history
Fixed path escaping also in SP2
  • Loading branch information
kobliha committed Nov 7, 2012
2 parents 4d7f71d + c2ce529 commit a65e6c3
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 14 deletions.
26 changes: 26 additions & 0 deletions .gitignore
@@ -0,0 +1,26 @@
Makefile
Makefile.am
Makefile.in
aclocal.m4
autom4te.cache
config.cache
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
configure.in
depcomp
install-sh
libtool
ltconfig
ltmain.sh
missing
mkinstalldirs
stamp-h*
*.pot
Makefile.am.common
autodocs-*
*.ami
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.17.12
2.17.13
2 changes: 2 additions & 0 deletions agents/.gitignore
@@ -0,0 +1,2 @@
Makefile
Makefile.in
2 changes: 2 additions & 0 deletions doc/.gitignore
@@ -0,0 +1,2 @@
Makefile
Makefile.in
3 changes: 3 additions & 0 deletions doc/autodocs/.gitignore
@@ -0,0 +1,3 @@
Makefile
Makefile.in
*.html
2 changes: 2 additions & 0 deletions package/.gitignore
@@ -0,0 +1,2 @@
*.spec
*.bz2
7 changes: 7 additions & 0 deletions package/yast2-backup.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Nov 2 11:27:29 UTC 2012 - locilka@suse.com

- Escaping shell paths that might contain spaces or special
characters (BNC #776078)
- 2.17.13

-------------------------------------------------------------------
Wed Sep 12 11:39:55 UTC 2012 - mfilka@suse.com

Expand Down
2 changes: 2 additions & 0 deletions scrconf/.gitignore
@@ -0,0 +1,2 @@
Makefile
Makefile.in
5 changes: 5 additions & 0 deletions src/.gitignore
@@ -0,0 +1,5 @@
Makefile
Makefile.in
*.ybc
.dep
backup
6 changes: 3 additions & 3 deletions src/Backup.ycp
Expand Up @@ -574,7 +574,7 @@ global define boolean PostBackup() ``{
*/

global define string get_archive_script_parameters(string file_list, string file_comment) ``{
string archive_options = " --verbose --files-info " + file_list + " --comment-file " + file_comment;
string archive_options = " --verbose --files-info '" + String::Quote(file_list) + "' --comment-file '" + String::Quote(file_comment) + "'";

if (size(complete_backup) > 0)
{
Expand All @@ -592,8 +592,8 @@ global define string get_archive_script_parameters(string file_list, string file

y2debug("nfsmount: %1, archive_name: %2", nfsmount, archive_name);

archive_options = archive_options + " --archive-name " + ((target_type == `file) ? archive_name :
sformat("%1/%2", nfsmount, archive_name));
archive_options = archive_options + " --archive-name '" + String::Quote((target_type == `file) ? archive_name :
sformat("%1/%2", nfsmount, archive_name)) + "'";

if (system)
{
Expand Down
7 changes: 4 additions & 3 deletions src/functions.ycp
Expand Up @@ -25,6 +25,7 @@ import "FileUtils";
import "Mode";
import "FileUtils";
import "Directory";
import "String";

textdomain "backup";

Expand Down Expand Up @@ -944,7 +945,6 @@ printf (\"%d%02d%02d%02d%02d%02d\", $year, $mon, $mday, $hour, $min, $sec);'");
return server + ":" + share + slash + filename;
}


/**
* Get available space in the directory
* @param directory selected directory
Expand All @@ -960,12 +960,13 @@ printf (\"%d%02d%02d%02d%02d%02d\", $year, $mon, $mday, $hour, $min, $sec);'");
return $[];
}

map result = (map)SCR::Execute(.target.bash_output, "/bin/df -P " + directory);
string cmd = sformat("/bin/df -P '%1'", String::Quote(directory));
map result = (map)SCR::Execute(.target.bash_output, cmd);
integer exit = result["exit"]:-1;

if (exit != 0)
{
y2warning("Command df failed, exit: %1", exit);
y2warning("Command %1 failed, exit: %2", cmd, exit);
return $[];
}

Expand Down
2 changes: 2 additions & 0 deletions src/scripts/.gitignore
@@ -0,0 +1,2 @@
Makefile
Makefile.in
16 changes: 9 additions & 7 deletions src/scripts/backup_archive.pl
Expand Up @@ -22,6 +22,7 @@

use File::Temp qw( tempdir );
use POSIX qw( strftime );
use File::Path qw(make_path);

# command line options
my $archive_name = '';
Expand Down Expand Up @@ -75,9 +76,9 @@ ($)
{
my $dirs = substr($f, 0, $ix);
if ($verbose) {
print "Running: /bin/mkdir -p $dirs 2> /dev/null\n";
print "Running: make_path $dirs\n";
}
system("/bin/mkdir -p $dirs 2> /dev/null"); # create directory with parents
make_path($dirs);
}
}

Expand Down Expand Up @@ -736,7 +737,8 @@ ($)
}

my $num_string = sprintf("%02d", $volume_num);
$tar_command .= " -M -V 'YaST2 backup:' -f $output_directory/${num_string}_$output_filename";
my $out_filename = "$output_directory/${num_string}_$output_filename";
$tar_command .= " -M -V 'YaST2 backup:' -f '".qq($out_filename)."'";

if ($multi_volume > 0)
{
Expand Down Expand Up @@ -803,16 +805,16 @@ ($)
else
{
# create standard (no multi volume) archive
$tar_command .= " -f $archive_name 2> /dev/null)";

$archive_name =~ s/\'/\'\\\'\'/g;
$tar_command .= " -f '$archive_name')";
print "Tar command: $tar_command\n";

system($tar_command);
}

print STDERR $!."\n";

if ($verbose)
{
print "/Tar result: $?\n";
}


2 changes: 2 additions & 0 deletions src/ui.ycp
Expand Up @@ -2690,6 +2690,8 @@ Aborting the backup.
{
if (substring(line, 0, size(id_tar_exit)) == id_tar_exit)
{
y2milestone ("Tar exit: %1\nErr: %2", line, SCR::Read (.process.read_stderr, backup_PID));

tar_result = tointeger(substring(line, size(id_tar_exit)));
}
else
Expand Down
11 changes: 11 additions & 0 deletions testsuite/.gitignore
@@ -0,0 +1,11 @@
Makefile
Makefile.in
site.exp
*.sum
*.log
tmp.out*
tmp.err*
tmp.log*
config
run
*.test

0 comments on commit a65e6c3

Please sign in to comment.