From dd38b4e86dfe840020a5d63318661fe225e93758 Mon Sep 17 00:00:00 2001 From: Christopher Huhn Date: Aug 15 2013 09:09:22 +0000 Subject: Correctly handle RPMs with whitespace in their path --- diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index 97af9e0..2c02e6f 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -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 () { 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 () { chomp; my ($mode, $owner, $group, $file) = split(/ /, $_, 4);