Bug#692360: extractMemberWithoutPaths: wrong manpage or wrong behaviour
Heiko Schlittermann
hs at schlittermann.de
Mon Nov 5 11:36:21 UTC 2012
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";
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'stable-updates'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.5-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libarchive-zip-perl depends on:
ii perl [libcompress-raw-zlib-perl] 5.14.2-14
libarchive-zip-perl recommends no packages.
libarchive-zip-perl suggests no packages.
-- no debconf information
More information about the pkg-perl-maintainers
mailing list