Skip Menu |
 

This queue is for tickets about the Archive-Zip CPAN distribution.

Report information
The Basics
Id: 14132
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: Archive-Zip

People
Owner: SHLOMIF [...] cpan.org
Requestors: ak2 [...] smr.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)

Attachments
Archive-Zip-1.16.chmod2.patch



Subject: Incorrect file permissions after extraction
Download (untitled) / with headers
text/plain 1.3k
Hello, Dir permissions are set as appropriate when extracting from an arch, yet file permissions are not set. To reproduce the issue test.zip can be used attached to the 14128 issue (http://rt.cpan.org/NoAuth/Bug.html?id=14128) It contains dir test_dir and file test_dir/test_file: #ls -lR . .: total 4 dr-xr-xr-x 2 nobody nobody 4096 Aug 11 13:19 test_dir ./test_dir: total 4 -r--r--r-- 1 nobody nobody 9 Aug 11 13:30 test_file Do extractTree into /tmp: #perl -MArchive::Zip -e' $z=Archive::Zip->new(); $z->read($ARGV[0]); $z->extractTree("", "/tmp/")' test.zip Extracted file has -rw-r--r-- perm instead of original-r--r--r--: #ls -l /tmp/test_dir/test_file -rw-r--r-- 1 root root 9 Aug 11 13:30 /tmp/test_dir/test_file The patch suggested for the issue 14128 (http://rt.cpan.org/NoAuth/Bug.html?id=14128) corrects this issue either. Yet if you use extractToFileNamed the problem remains: #perl -MArchive::Zip -e' $z=Archive::Zip->new(); $z->read($ARGV[0]); $z->memberNamed("test_dir/test_file")->extractToFileNamed("/tmp/test_dir/test_file");' test.zip # ls -l /tmp/test_dir/test_file -rw-r--r-- 1 root root 9 Aug 11 13:30 /tmp/test_dir/test_file I guess to correct this chmod() should be added in Archive::Zip::Member::extractToFileNamed before utime() Suggested patch is attached. Best regards Alexey Kravchuk
diff -ru Archive-Zip-1.16.orig/lib/Archive/Zip.pm Archive-Zip-1.16/lib/Archive/Zip.pm --- Archive-Zip-1.16.orig/lib/Archive/Zip.pm 2005-08-12 13:25:19.136143089 +0400 +++ Archive-Zip-1.16/lib/Archive/Zip.pm 2005-08-12 13:16:13.010874128 +0400 @@ -1821,6 +1821,7 @@ return _ioError("Can't open file $name for write") unless $status; my $retval = $self->extractToFileHandle($fh); $fh->close(); + chmod $self->unixFileAttributes() & 07777, $name or warn "Can't chmod() $name: $!"; utime( $self->lastModTime(), $self->lastModTime(), $name ); return $retval; }
Subject: Updated patch for 1.18
From: jloverso [...] mathworks.com
Download (untitled) / with headers
text/plain 541b
This is still needed in 1.18, but it now applies to Archive/Zip/Member.pm: p4 diff -du ... ==== Archive-Zip/lib/Archive/Zip/Member.pm#1 - Archive-Zip/lib/Archive/Zip/Member.pm ==== @@ -388,6 +388,8 @@ return _ioError("Can't open file $name for write") unless $status; my $retval = $self->extractToFileHandle($fh); $fh->close(); + chmod $self->unixFileAttributes() & 07777, $name + or return _error("Can't chmod() $name: $!") ; utime( $self->lastModTime(), $self->lastModTime(), $name ); return $retval; }
Download (untitled) / with headers
text/plain 514b
This was fixed in the trunk in r2423. Here is the log/Changes message: - Fixed http://rt.cpan.org/Ticket/Display.html?id=14132 : - Incorrect file permissions after extraction. - Archive-Zip did not set the file permissions correctly in extractToFileNamed(). - Added t/10_chmod.t and t/data/chmod.zip. Changed lib/Archive/Zip/Member.pm. - Reported by ak2 and jlv (Thanks!) - SHLOMIF wrote the test script. - (SHLOMIF) Thanks to all the people who reported and contributed.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.