From: Steve Peters Date: Wed, 2 Aug 2006 17:47:34 +0000 (+0000) Subject: Upgrade to Archive-Tar-1.30. Since change #27571 is not included, X-Git-Tag: accepted/trunk/20130322.191538~17217 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f38c1908cf9793644d5d867fb064b79b773c2c16;p=platform%2Fupstream%2Fperl.git Upgrade to Archive-Tar-1.30. Since change #27571 is not included, the bleadperl version is bumped to 1.30_01. p4raw-link: @27571 on //depot/perl: 376cc5ea9119d14a5a36f394fef8e7874a59a876 p4raw-id: //depot/perl@28653 --- diff --git a/lib/Archive/Tar.pm b/lib/Archive/Tar.pm index 322bea3..b0f2080 100644 --- a/lib/Archive/Tar.pm +++ b/lib/Archive/Tar.pm @@ -1,5 +1,5 @@ ### the gnu tar specification: -### http://www.gnu.org/software/tar/manual/html_mono/tar.html +### http://www.gnu.org/software/tar/manual/tar.html ### ### and the pax format spec, which tar derives from: ### http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html @@ -14,7 +14,7 @@ use vars qw[$DEBUG $error $VERSION $WARN $FOLLOW_SYMLINK $CHOWN $CHMOD $DEBUG = 0; $WARN = 1; $FOLLOW_SYMLINK = 0; -$VERSION = "1.29_02"; +$VERSION = "1.30_01"; $CHOWN = 1; $CHMOD = 1; $DO_NOT_USE_PREFIX = 0; @@ -435,6 +435,9 @@ sub extract { my @args = @_; my @files; + # use the speed optimization for all extracted files + local($self->{cwd}) = cwd() unless $self->{cwd}; + ### you requested the extraction of only certian files if( @args ) { for my $file ( @args ) { @@ -538,7 +541,7 @@ sub _extract_file { ### it's a relative path ### } else { - my $cwd = cwd(); + my $cwd = (defined $self->{cwd} ? $self->{cwd} : cwd()); my @dirs = File::Spec::Unix->splitdir( $dirs ); my @cwd = File::Spec->splitdir( $cwd ); $dir = File::Spec->catdir( @cwd, @dirs ); @@ -1236,6 +1239,45 @@ method call instead. } } +=head2 $tar->setcwd( $cwd ); + +C needs to know the current directory, and it will run +C I time it extracts a I entry from the +tarfile and saves it in the file system. (As of version 1.30, however, +C will use the speed optimization described below +automatically, so it's only relevant if you're using C). + +Since C doesn't change the current directory internally +while it is extracting the items in a tarball, all calls to C +can be avoided if we can guarantee that the current directory doesn't +get changed externally. + +To use this performance boost, set the current directory via + + use Cwd; + $tar->setcwd( cwd() ); + +once before calling a function like C and +C will use the current directory setting from then on +and won't call C internally. + +To switch back to the default behaviour, use + + $tar->setcwd( undef ); + +and C will call C internally again. + +If you're using C's C method, C will +be called for you. + +=cut + +sub setcwd { + my $self = shift; + my $cwd = shift; + + $self->{cwd} = $cwd; +} =head2 $bool = $tar->has_io_string @@ -1429,13 +1471,18 @@ The default is C<1>. =head2 $Archive::Tar::DO_NOT_USE_PREFIX -By default, C will try to put paths that are over -100 characters in the C field of your tar header. However, -some older tar programs do not implement this spec. To retain -compatibility with these older versions, you can set the -C<$DO_NOT_USE_PREFIX> variable to a true value, and C -will use an alternate way of dealing with paths over 100 characters -by using the C feature. +By default, C will try to put paths that are over +100 characters in the C field of your tar header, as +defined per POSIX-standard. However, some (older) tar programs +do not implement this spec. To retain compatibility with these older +or non-POSIX compliant versions, you can set the C<$DO_NOT_USE_PREFIX> +variable to a true value, and C will use an alternate +way of dealing with paths over 100 characters by using the +C feature. + +Note that clients who do not support the C +feature will not be able to read these archives. Such clients include +tars on C, C and C. The default is C<0>. @@ -1537,6 +1584,17 @@ have incompatible filetypes and still expect things to work). For other filetypes, like C and C we'll warn that the extraction of this particular item didn't work. +=item I'm using WinZip, or some other non-POSIX client, and files are not being extracted properly! + +By default, C is in a completely POSIX-compatible +mode, which uses the POSIX-specification of C to store files. +For paths greather than 100 characters, this is done using the +C. Non-POSIX-compatible clients may not support +this part of the specification, and may only support the C functionality. To facilitate those clients, you can set the +C<$Archive::Tar::DO_NOT_USE_PREFIX> variable to C. See the +C section for details on this variable. + =item How do I extract only files that have property X from an archive? Sometimes, you might not wish to extract a complete archive, just @@ -1619,6 +1677,31 @@ to an uploaded file, which might be a compressed archive. =back +=head1 SEE ALSO + +=over 4 + +=item The GNU tar specification + +C + +=item The PAX format specication + +The specifcation which tar derives from; C< http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html> + +=item A comparison of GNU and POSIX tar standards; C + +=item GNU tar intends to switch to POSIX compatibility + +GNU Tar authors have expressed their intention to become completely +POSIX-compatible; C + +=item A Comparison between various tar implementations + +Lists known issues and incompatibilities; C + +=back + =head1 AUTHOR This module by