Subject: | local extra fields can only be read for directories |
Date: | Mon, 05 Jan 2015 00:17:28 +0100 |
To: | bug-Archive-Zip [...] rt.cpan.org |
From: | Reiner Herrmann <reiner [...] reiner-h.de> |
Hi,
I discovered that local extra fields can only be read from directories
in zip archives.
Here is an example:
Create a simple zip archive:
# mkdir -p directory/subdir{1,2}
# echo content0 > directory/file0
# echo content1 > directory/subdir1/file1
# echo content2 > directory/subdir2/file2
# zip -r -0 file.zip directory/
...
Run a simple script that prints the cd and local extra fields:
# cat test.pl
use Archive::Zip;
my $zip = Archive::Zip->new("file.zip");
foreach my $file (sort $zip->memberNames()) {
my $member = $zip->memberNamed($file);
print "$file:\n";
print " CD extra field: " . unpack("H*", $member->cdExtraField()) . "\n";
print " Local extra field: " . unpack("H*", $member->localExtraField()) . "\n";
}
# perl test.pl
directory/:
CD extra field: 5554050003cec6a95475780b000104e803000004e8030000
Local extra field: 5554090003cec6a954d0c6a95475780b000104e803000004e8030000
directory/file0:
CD extra field: 5554050003cec6a95475780b000104e803000004e8030000
Local extra field:
directory/subdir1/:
CD extra field: 5554050003d7c6a95475780b000104e803000004e8030000
Local extra field: 5554090003d7c6a954ecc6a95475780b000104e803000004e8030000
directory/subdir1/file1:
CD extra field: 5554050003d7c6a95475780b000104e803000004e8030000
Local extra field:
directory/subdir2/:
CD extra field: 5554050003dcc6a95475780b000104e803000004e8030000
Local extra field: 5554090003dcc6a954ecc6a95475780b000104e803000004e8030000
directory/subdir2/file2:
CD extra field: 5554050003dcc6a95475780b000104e803000004e8030000
Local extra field:
The local extra fields of the individual files can not be accessed, even though they
are really there (confirmed with a hex editor).
The Archive::Zip version is 1.39 on perl 5.20.1.
Message body not shown because it is not plain text.