Avoid breaking on spaces in filenames. Closes: #618636

The runpipe interface is not a good one, it would be better to use
something that does not expose to the shell.

As a quick fix, quote filenames in runpipe calls. Too bad if you have a
quote character in a file though. Later need to find a better interface
or do full shell escaping.
This commit is contained in:
Joey Hess
2011-06-11 13:00:34 -04:00
parent 5b49be4d3d
commit 585fc93270
6 changed files with 25 additions and 19 deletions

View File

@@ -110,7 +110,7 @@ sub test {
return map { s/\n//; $_ }
grep {
! /unknown-section alien/
} $this->runpipe(1, "lintian $deb");
} $this->runpipe(1, "lintian '$deb'");
}
else {
return "lintian not available, so not testing";
@@ -130,7 +130,7 @@ sub getcontrolfile {
my $file=$this->filename;
if ($this->have_dpkg_deb) {
return $this->runpipe(1, "dpkg-deb --info $file $controlfile 2>/dev/null");
return $this->runpipe(1, "dpkg-deb --info '$file' $controlfile 2>/dev/null");
}
else {
# Solaris tar doesn't support O
@@ -139,10 +139,10 @@ sub getcontrolfile {
return "(mkdir /tmp/tar_out.$$ &&".
" cd /tmp/tar_out.$$ &&".
" tar xf - ./$file &&".
" cat $file; cd /; rm -rf /tmp/tar_out.$$)";
" tar xf - './$file' &&".
" cat '$file'; cd /; rm -rf /tmp/tar_out.$$)";
}
my $getcontrol = "ar -p $file control.tar.gz | gzip -dc | ".tar_out($controlfile)." 2>/dev/null";
my $getcontrol = "ar -p '$file' control.tar.gz | gzip -dc | ".tar_out($controlfile)." 2>/dev/null";
return $this->runpipe(1, $getcontrol);
}
}
@@ -212,11 +212,11 @@ sub scan {
my @filelist;
if ($this->have_dpkg_deb) {
@filelist=map { chomp; s:\./::; "/$_" }
$this->runpipe(0, "dpkg-deb --fsys-tarfile $file | tar tf -");
$this->runpipe(0, "dpkg-deb --fsys-tarfile '$file' | tar tf -");
}
else {
@filelist=map { chomp; s:\./::; "/$_" }
$this->runpipe(0, "ar -p $file data.tar.gz | gzip -dc | tar tf -");
$this->runpipe(0, "ar -p '$file' data.tar.gz | gzip -dc | tar tf -");
}
$this->filelist(\@filelist);
@@ -307,7 +307,7 @@ sub prep {
or die "patch error: $!";
# Look for .rej files.
die "patch failed with .rej files; giving up"
if $this->runpipe(1, "find $dir -name \"*.rej\"");
if $this->runpipe(1, "find '$dir' -name \"*.rej\"");
$this->do('find', '.', '-name', '*.orig', '-exec', 'rm', '{}', ';');
$this->do("chmod", 755, "$dir/debian/rules");