* Fix a longstanding bug I was only recently told about: When converting

from rpm, ignore the icky file owners and perms from the cpio archive,
     and query rpm for the real set that it overrides in the control data
     structure. Closes: #151546
This commit is contained in:
joey
2002-07-09 00:54:38 +00:00
parent 92a03172da
commit eb41790008
3 changed files with 34 additions and 1 deletions

View File

@@ -176,6 +176,30 @@ sub unpack {
or die "error moving unpacked files into the default prefix directory: $!";
}
if ($> == 0) {
# rpm files have two sets of permissions; the set in the cpio
# archive, and the set in the control data; which override them.
# The set in the control data are more correct, so let's use those.
open (GETPERMS, 'rpm --queryformat \'[%{FILEMODES} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]\' -qp '.$this->filename.' |');
while (<GETPERMS>) {
chomp;
my ($mode, $owner, $group, $file) = split(/ /, $_, 4);
$mode = $mode & 07777; # remove filetype
my $uid = getpwnam($owner);
if (! defined $uid) {
print STDERR "WARNING: $file is owned by a user ($owner) not on this system; using root instead";
$uid=0;
}
my $gid = getgrnam($group);
if (! defined $gid) {
print STDERR "WARNING: $file is owned by a group ($group) not on this system; using group root instead";
$gid=0;
}
chown($uid, $gid, $file) || die "failed chowning $file to $uid\:$gid\: $!";
chmod($mode, $file) || die "failed changing mode of $file to $mode\: $!";
}
}
# When cpio extracts the file, any child directories that are
# present, but whose parent directories are not, end up mode 700.
# This next block corrects that to 755, which is more reasonable.

View File

@@ -364,7 +364,7 @@ unless (@ARGV) {
if (! -w '.') {
die("Cannot write to current directory. Try moving to /tmp and re-running alien.\n");
}
if ($> ne 0) {
if ($> != 0) {
if ($destformats{deb} && ! $generate && ! $single) {
die "Must run as root to convert to deb format (or you may use fakeroot).\n";
}

9
debian/changelog vendored
View File

@@ -1,3 +1,12 @@
alien (8.15) unstable; urgency=low
* Fix a longstanding bug I was only recently told about: When converting
from rpm, ignore the icky file owners and perms from the cpio archive,
and query rpm for the real set that it overrides in the control data
structure. Closes: #151546
-- Joey Hess <joeyh@debian.org> Mon, 8 Jul 2002 20:52:48 -0400
alien (8.14) unstable; urgency=low
* Enabled Getopt::Long Bundling, see comment in alien.pl. Closes: #152148