From 2a0c64fca6c94cad5b5978328763688d77ced891 Mon Sep 17 00:00:00 2001 From: short <> Date: Fri, 28 Jun 2002 01:01:35 +0000 Subject: [PATCH] Fixed reversed matching order of the extensions list 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 --- bin/exx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/exx b/bin/exx index d176d27..12de60d 100755 --- a/bin/exx +++ b/bin/exx @@ -8,7 +8,7 @@ use warnings; 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? @@ -30,7 +30,7 @@ die "Syntax: $0 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; } @@ -44,7 +44,9 @@ for my $fname (@ARGV) { } 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#^/#; -- 1.8.3.1