Skip to content

Commit

Permalink
Merge pull request #7 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 d17a704 + 2da1a8e commit 03e5f93
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 8 deletions.
22 changes: 22 additions & 0 deletions .gitignore
@@ -0,0 +1,22 @@
autom4te.cache
Makefile
Makefile.am
Makefile.in
aclocal.m4
config.cache
config.guess
config.h.in
config.log
config.status
config.sub
configure
configure.in
depcomp
install-sh
missing
mkinstalldirs
stamp-h
*.pot
Makefile.am.common
autodocs-*
*.ami
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.17.6
2.17.6.1
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-restore.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.6.1

-------------------------------------------------------------------
Thu Jan 5 15:10:33 CET 2012 - locilka@suse.cz

Expand Down
5 changes: 5 additions & 0 deletions src/.gitignore
@@ -0,0 +1,5 @@
Makefile
Makefile.in
*.ybc
.dep
restore
14 changes: 7 additions & 7 deletions src/Restore.ycp
Expand Up @@ -699,7 +699,7 @@
boolean lastvolume = true;

// test if archive is multi volume - use -v parameter to get file descriptions
map detailresult = (map) SCR::Execute(.target.bash_output, "/bin/tar -v -t -f " + filename);
map detailresult = (map) SCR::Execute(.target.bash_output, "/bin/tar -v -t -f '" + String::Quote(filename) + "'");

list<string> stdout = splitstring(detailresult["stdout"]:"", "\n");
string firstline = stdout[0]:"";
Expand Down Expand Up @@ -728,7 +728,7 @@
string tmpfile = tempdir + "/" + sformat("%1", num) + ".tar";

// copy multi volume part to temp directory
integer exit = (integer) SCR::Execute(.target.bash, "/bin/cp " + filename + " " + tmpfile);
integer exit = (integer) SCR::Execute(.target.bash, "/bin/cp '" + String::Quote(filename) + "' '" + String::Quote(tmpfile) + "'");

if (exit == 0)
{
Expand Down Expand Up @@ -914,7 +914,7 @@
y2milestone("mountpoint: %1", mountpoint);

// get archive contents
map result = (map) SCR::Execute(.target.bash_output, "/bin/tar -t -f " + filename);
map result = (map) SCR::Execute(.target.bash_output, "/bin/tar -t -f '" + String::Quote(filename) + "'");

// check tar exit value
if (result["exit"]:-1 != 0)
Expand Down Expand Up @@ -992,7 +992,7 @@ It was probably not created by the backup module.
infofiles = infofiles + (compressed_packages_info ? "info/packages_info.gz" : "info/packages_info");

// unpack info files
result = (map) SCR::Execute(.target.bash_output, "/bin/tar -C '" + String::Quote (tempdir) + "' -x -f " + filename + " " + infofiles + " 2> /dev/null");
result = (map) SCR::Execute(.target.bash_output, "/bin/tar -C '" + String::Quote (tempdir) + "' -x -f '" + String::Quote(filename) + "' " + infofiles + " 2> /dev/null");

date = (string) SCR::Read(.target.string, tempdir + "/info/date");
comment = (string) SCR::Read(.target.string, tempdir + "/info/comment");
Expand Down Expand Up @@ -1498,18 +1498,18 @@ It was probably not created by the backup module.
string param = " ";

foreach(string f, volumeparts, ``{
param = param + "-f " + f + " ";
param = param + "-f '" + String::Quote(f) + "' ";
}
);

string command = locale_modifications + "echo q | /bin/tar -C " + tempdir + " -x -M " + param + fileinarchive + " 2> /dev/null";
string command = locale_modifications + "echo q | /bin/tar -C " + tempdir + " -x -M " + param + "'" + String::Quote(fileinarchive) + "' 2> /dev/null";
y2milestone ("Running command: %1", command);

started = (boolean) SCR::Execute(.background.run, command);
}
else
{
string command = locale_modifications + "/bin/tar -C " + tempdir + " -x -f " + filename + " " + fileinarchive;
string command = locale_modifications + "/bin/tar -C " + tempdir + " -x -f '" + String::Quote(filename) + "' '" + String::Quote(fileinarchive) + "'";
y2milestone ("Running command: %1", command);

started = (boolean) SCR::Execute(.background.run, command);
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 03e5f93

Please sign in to comment.