mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-24 14:00:17 +00:00
Correctly handle RPMs with whitespace in their path
This commit is contained in:
committed by
Joey Hess
parent
7aee419bd2
commit
dd38b4e86d
@@ -161,11 +161,11 @@ sub unpack {
|
||||
|
||||
# Check if we need to use lzma to uncompress the cpio archive
|
||||
my $decomp='';
|
||||
if ($this->do("rpm2cpio ".$this->filename." | lzma -t -q > /dev/null 2>&1")) {
|
||||
if ($this->do("rpm2cpio '".$this->filename."' | lzma -t -q > /dev/null 2>&1")) {
|
||||
$decomp = 'lzma -d -q |';
|
||||
}
|
||||
|
||||
$this->do("rpm2cpio ".$this->filename." | (cd $workdir; $decomp cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>&1")
|
||||
$this->do("rpm2cpio '".$this->filename."' | (cd $workdir; $decomp cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>&1")
|
||||
or die "Unpacking of '".$this->filename."' failed";
|
||||
|
||||
# cpio does not necessarily store all parent directories in an
|
||||
@@ -174,7 +174,7 @@ sub unpack {
|
||||
# Find those directories and make them mode 755, which is more
|
||||
# reasonable.
|
||||
my %seenfiles;
|
||||
open (RPMLIST, "rpm2cpio ".$this->filename." | $decomp cpio -it --quiet |")
|
||||
open (RPMLIST, "rpm2cpio '".$this->filename."' | $decomp cpio -it --quiet |")
|
||||
or die "File list of '".$this->filename."' failed";
|
||||
while (<RPMLIST>) {
|
||||
chomp;
|
||||
@@ -184,7 +184,7 @@ sub unpack {
|
||||
foreach my $file (`cd $workdir; find ./`) {
|
||||
chomp $file;
|
||||
if (! $seenfiles{$file} && -d "$workdir/$file" && ! -l "$workdir/$file") {
|
||||
$this->do("chmod 755 $workdir/$file");
|
||||
$this->do("chmod 755 '$workdir/$file'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ sub unpack {
|
||||
# postinst.
|
||||
my %owninfo = ();
|
||||
my %modeinfo = ();
|
||||
open (GETPERMS, 'rpm --queryformat \'[%{FILEMODES} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]\' -qp '.$this->filename.' |');
|
||||
open (GETPERMS, 'rpm --queryformat \'[%{FILEMODES} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]\' -qp \''.$this->filename.'\' |');
|
||||
while (<GETPERMS>) {
|
||||
chomp;
|
||||
my ($mode, $owner, $group, $file) = split(/ /, $_, 4);
|
||||
|
||||
Reference in New Issue
Block a user