Bug#692360: extractMemberWithoutPaths: wrong manpage or wrong behaviour

Salvatore Bonaccorso carnil at debian.org
Sat Nov 24 16:19:17 UTC 2012


Control: tags -1 + confirmed

Hi Heiko

On Mon, Nov 05, 2012 at 12:36:21PM +0100, Heiko Schlittermann wrote:
> Package: libarchive-zip-perl
> Version: 1.30-6
> Severity: normal
> Tags: upstream
> 
> The manpage of Archive::Zip states:
> 
>    extractMemberWithoutPaths( $memberOrName [, $extractedName ] )
> 
>    Extract the given member, or match its name and extract it.  Does not use path information
>    (extracts into the current directory). Returns undef if member doesn't exist in this Zip.  If
>    optional second arg is given, use it as the name of the extracted member (its paths will be
>    deleted too). Otherwise, the internal filename of the member (minus paths) is used as the name of
>    the extracted file or directory. Returns "AZ_OK" on success.
> 
> It's not true. If you pass a pathname as the second argument
> 
>     - the leading directories(!) are created (should be noted in the man page, as
>       from my POV it's not common in the unix world.)
> 
>     - the pathname is used as the name for the extracted file
> 
> The man page states, that paths will be removed too from the second
> argument.
> 
> I'm not sure how to solve the problem. It could be fixed easily around
> line 202ff in Archive/Zip/Archive.pm, but I'd be afraid that this could
> break existing applications (at least mine ☺)
> 
> Here is some code to reproduce the behaviour:
> 
>     #! /usr/bin/perl
>     use 5.010;
>     use strict;
>     use warnings;
>     use Archive::Zip;
> 
>     my $DIR = "/tmp/$$.d/Xtract/";
> 
>     my $zipfile = shift // die "need name of zip file\n";
>     my $zip = new Archive::Zip $zipfile or die "Archive::Zip $zipfile: $!\n";
> 
>     foreach my $member ($zip->members) {
>         say $member->fileName;
>         $zip->extractMemberWithoutPaths($member, "$DIR/$name");
>     }
> 
>     system "find $DIR/ -ls";

Thanks for your report. I tried to reproduce and it seems you are
coorect (btw, in your example there was a missing assignment for
$name?).

I have forwarded this upstream. *big* warning: I'm not sure if it's
enough with the attached patch already. I only did a quick look right
now.

Regards,
Salvatore
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Strip-paths-in-extractMemberWithoutPaths-from-member.patch
Type: text/x-diff
Size: 1017 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20121124/1dbd1b03/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20121124/1dbd1b03/attachment.pgp>


More information about the pkg-perl-maintainers mailing list