Extraction-overwriting cowardly no longer supported
- fixes/workarounds flaw in FORMAT_TAR_GZ with already-existing content inside
Fixed FORMAT_TAR_GZ && vs. || bash bug for non-archive-dir-ed archives
use IO::Handle;
use Cwd qw(chdir cwd);
use IO::Handle;
use Cwd qw(chdir cwd);
-use constant FORMAT_TAR_GZ=>'tar xzf $pathname;i=`echo *`;echo "$i"|grep -q " " || test * = $base &&'
+use constant FORMAT_TAR_GZ=>'tar xzf $pathname;i=`echo *`;echo "$i"|grep -q " " || test * != $base ||'
.'(mv "$i" "$i".$$;(set +x;mv "$i".$$/* .);rmdir "$i".$$)';
use constant FORMATS=>{
"rpm" =>'rpm2cpio $pathname|cpio -id --quiet', #-v #FIXME: --sparse doesn't work, why?
.'(mv "$i" "$i".$$;(set +x;mv "$i".$$/* .);rmdir "$i".$$)';
use constant FORMATS=>{
"rpm" =>'rpm2cpio $pathname|cpio -id --quiet', #-v #FIXME: --sparse doesn't work, why?
my $origdir=cwd;
for my $fname (@ARGV) {
my @parsed;
my $origdir=cwd;
for my $fname (@ARGV) {
my @parsed;
- for my $fmt (sort { length $a<=>length $b; } keys %{+FORMATS}) {
+ for my $fmt (sort { length $b<=>length $a; } keys %{+FORMATS}) {
(my $fmtt=$fmt)=~s/(\W)/\\$1/g;
last if @parsed=$fname=~m#^(.*?)([^/]+)([.=])($fmtt)$#i;
}
(my $fmtt=$fmt)=~s/(\W)/\\$1/g;
last if @parsed=$fname=~m#^(.*?)([^/]+)([.=])($fmtt)$#i;
}
} while ($cmdtry);
-r $pathname && !-d $pathname or die "Archive not readable: $pathname";
my($extdir)=(-e $base && !-d $base ? "$base.dir" : $base);
} while ($cmdtry);
-r $pathname && !-d $pathname or die "Archive not readable: $pathname";
my($extdir)=(-e $base && !-d $base ? "$base.dir" : $base);
- -d $extdir or mkdir $extdir or die "Unable to create directory \"$extdir\": $!";
+ # Extraction-overwriting cowardly not supported:
+ # -d $extdir or ...
+ mkdir $extdir or die "Unable to create directory \"$extdir\": $!";
chdir $extdir or die "Unable to chdir to \"$extdir\": $!";
$pathname="../$pathname" if $pathname!~m#^/#;
$path ="../$path" if $path !~m#^/#;
chdir $extdir or die "Unable to chdir to \"$extdir\": $!";
$pathname="../$pathname" if $pathname!~m#^/#;
$path ="../$path" if $path !~m#^/#;