* When reloating files from a rpm, run the mv command directly,

not in a subshell; this is safer especially if odd filenames are
     involved.
   * When converting from rpm, only chmod each directory once, it was doing
     it many times for some directories before.
   * Fixed chmodding to use the correct path to the directory. This fixes
     file permissions in rpm's converted to other formats, a bug introduced
     at 7.0.
   * Fixed some undefined value warnings (which pointed out real but rare
     bugs).
   * Fixed a rare, but bad little bug. If you ran alien in a directory that
     had the suid/sgid bit set (as my home directory does), and generated
     debs and probably other formats, it generated packages with the root
     directory suid/sgid.
This commit is contained in:
joey
2000-05-09 21:42:41 +00:00
parent c3fab64d37
commit 5fbc1b52bc
4 changed files with 36 additions and 9 deletions

View File

@@ -237,6 +237,10 @@ sub unpack {
my $workdir = $this->name."-".$this->version; my $workdir = $this->name."-".$this->version;
mkdir $workdir, 0755 || mkdir $workdir, 0755 ||
die "unable to mkdir $workdir: $!"; die "unable to mkdir $workdir: $!";
# If the parent directory is suid/sgid, mkdir will make the root
# directory of the package inherit those bits. That is a bad thing,
# so explicitly force perms to 755.
chmod 0755, $workdir;
$this->unpacked_tree($workdir); $this->unpacked_tree($workdir);
} }

View File

@@ -213,7 +213,7 @@ sub getpatch {
my @patches; my @patches;
foreach my $dir (@_) { foreach my $dir (@_) {
push @patches,glob("$dir/".$this->name."_".$this->version."-".$this->revision."*.diff.gz"); push @patches, glob("$dir/".$this->name."_".$this->version."-".$this->release."*.diff.gz");
} }
unless (@patches) { unless (@patches) {
# Try not matching the revision, see if that helps. # Try not matching the revision, see if that helps.

View File

@@ -84,7 +84,8 @@ sub scan {
foreach my $field (keys(%fieldtrans)) { foreach my $field (keys(%fieldtrans)) {
$_=`LANG=C rpm -qp $file --queryformat \%{$field}`; $_=`LANG=C rpm -qp $file --queryformat \%{$field}`;
$field=$fieldtrans{$field}; $field=$fieldtrans{$field};
$this->$field($_) if $_ ne '(none)'; $_='' if $_ eq '(none)';
$this->$field($_);
} }
# Get the conffiles list. # Get the conffiles list.
@@ -153,31 +154,32 @@ sub unpack {
# Test to see if the package contains the prefix directory already. # Test to see if the package contains the prefix directory already.
if (defined $this->prefixes && ! -e "$workdir/".$this->prefixes) { if (defined $this->prefixes && ! -e "$workdir/".$this->prefixes) {
# Get the files to move. # Get the files to move.
my $filelist=join ' ',glob("$workdir/*"); my @filelist=glob("$workdir/*");
# Now, make the destination directory. # Now, make the destination directory.
my $collect=$workdir; my $collect=$workdir;
foreach (split m:/:, $this->prefixes) { foreach (split m:/:, $this->prefixes) {
if ($_ ne undef) { # this keeps us from using anything but relative paths. if ($_ ne '') { # this keeps us from using anything but relative paths.
$collect.="$_/"; $collect.="$_/";
mkdir $collect,0755 || die "unable to mkdir $collect: $!"; mkdir $collect,0755 || die "unable to mkdir $collect: $!";
} }
} }
# Now move all files in the package to the directory we made. # Now move all files in the package to the directory we made.
system "mv $filelist $workdir/".$this->prefixes && system "mv", @filelist, "$workdir/".$this->prefixes &&
die "error moving unpacked files into the default prefix directory: $!"; die "error moving unpacked files into the default prefix directory: $!";
} }
# When cpio extracts the file, any child directories that are # When cpio extracts the file, any child directories that are
# present, but whose parent directories are not, end up mode 700. # present, but whose parent directories are not, end up mode 700.
# This next block correctsthat to 755, which is more reasonable. # This next block corrects that to 755, which is more reasonable.
# #
# Of course, this whole thing assumes we get the filelist in sorted # Of course, this whole thing assumes we get the filelist in sorted
# order. # order.
my $lastdir=''; my $lastdir='';
my %tochmod;
foreach my $file (@{$this->filelist}) { foreach my $file (@{$this->filelist}) {
$file=~s/^\///; $file=~s/^\///;
if (($lastdir && $file=~m:^\Q$lastdir\E/[^/]*$: eq undef) || !$lastdir) { if (($lastdir && $file !~ m:^\Q$lastdir\E/[^/]*$:) || !$lastdir) {
# We've found one of the nasty directories. Fix it # We've found one of the nasty directories. Fix it
# up. # up.
# #
@@ -191,11 +193,13 @@ sub unpack {
my $dircollect=''; my $dircollect='';
foreach my $dir (split(/\//,$file)) { foreach my $dir (split(/\//,$file)) {
$dircollect.="$dir/"; $dircollect.="$dir/";
chmod 0755,$dircollect; # TADA! # Use a hash to prevent duplicate chmods.
$tochmod{"$workdir/$dircollect"}=1;
} }
} }
$lastdir=$file if -d "./$file"; $lastdir=$file if -d "./$file";
} }
chmod 0755, keys %tochmod if %tochmod;
return 1; return 1;
} }

19
debian/changelog vendored
View File

@@ -1,3 +1,22 @@
alien (7.2) unstable; urgency=low
* When reloating files from a rpm, run the mv command directly,
not in a subshell; this is safer especially if odd filenames are
involved.
* When converting from rpm, only chmod each directory once, it was doing
it many times for some directories before.
* Fixed chmodding to use the correct path to the directory. This fixes
file permissions in rpm's converted to other formats, a bug introduced
at 7.0.
* Fixed some undefined value warnings (which pointed out real but rare
bugs).
* Fixed a rare, but bad little bug. If you ran alien in a directory that
had the suid/sgid bit set (as my home directory does), and generated
debs and probably other formats, it generated packages with the root
directory suid/sgid.
-- Joey Hess <joeyh@debian.org> Tue, 9 May 2000 14:13:15 -0700
alien (7.1) unstable; urgency=low alien (7.1) unstable; urgency=low
* Corrected checking of system() in Deb::prep. Closes: #63396 * Corrected checking of system() in Deb::prep. Closes: #63396