From e7e9f10486b93a7db57c47467ae81b4f6c647072 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 May 2010 20:54:30 -0400 Subject: [PATCH] Support RPMs containing ghost files. (Patch by Ben Webb, who would get his patches applied quicker if he actually communicated them to the program's author.) --- Alien/Package/Rpm.pm | 15 ++++++++++----- debian/changelog | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index 39d54a4..c56a8ca 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -274,12 +274,17 @@ sub unpack { if (defined($owninfo{$file}) && (($mode & 07000) > 0)) { $modeinfo{$file} = sprintf "%lo", $mode; } - if ($> == 0) { - $this->do("chown", "$uid:$gid", "$workdir/$file") - || die "failed chowning $file to $uid\:$gid\: $!"; + # Note that ghost files exist in the metadata but not + # in the cpio archive, so check that the file exists + # before trying to access it + if (-e "$workdir/$file") { + if ($> == 0) { + $this->do("chown", "$uid:$gid", "$workdir/$file") + || die "failed chowning $file to $uid\:$gid\: $!"; + } + $this->do("chmod", sprintf("%lo", $mode), "$workdir/$file") + || die "failed changing mode of $file to $mode\: $!"; } - $this->do("chmod", sprintf("%lo", $mode), "$workdir/$file") - || die "failed changing mode of $file to $mode\: $!"; } $this->owninfo(\%owninfo); $this->modeinfo(\%modeinfo); diff --git a/debian/changelog b/debian/changelog index f19cb02..7411c91 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,9 @@ alien (8.81) UNRELEASED; urgency=low (Patch by Duane Waddle, on a bug tracking system I don't frequent, that was about the "expire" it 4 days from now. We got lucky Duane, but please use the Debian BTS next time!) + * Support RPMs containing ghost files. + (Patch by Ben Webb, who would get his patches applied quicker if he + actually communicated them to the program's author.) -- Joey Hess Wed, 28 Apr 2010 11:29:19 -0400