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

Owner: SHLOMIF [...]
Requestors: ak2 [...]

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


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 can be used attached to the 14128 issue ( 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/")' 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 ( 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");' # 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/ Archive-Zip-1.16/lib/Archive/ --- Archive-Zip-1.16.orig/lib/Archive/ 2005-08-12 13:25:19.136143089 +0400 +++ Archive-Zip-1.16/lib/Archive/ 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 [...]
Download (untitled) / with headers
text/plain 541b
This is still needed in 1.18, but it now applies to Archive/Zip/ p4 diff -du ... ==== Archive-Zip/lib/Archive/Zip/ - Archive-Zip/lib/Archive/Zip/ ==== @@ -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 : - Incorrect file permissions after extraction. - Archive-Zip did not set the file permissions correctly in extractToFileNamed(). - Added t/10_chmod.t and t/data/ Changed lib/Archive/Zip/ - 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 infrastructure.

Please report any issues with to