On Fri, Nov 21, 2008 at 11:52 PM, Eric Wilhelm
<[EMAIL PROTECTED]> wrote:
> # from David Golden
> # on Friday 21 November 2008 20:21:
>
>> my $files = $self->rscan_dir($dir);
>>- Archive::Tar->create_archive("$file.tar.gz", 1, @$files);
>>+ my $tar = Archive::Tar->new;
>>+ $tar->add_files( @$files );
>>+ for my $f ( $tar->get_files ) {
>>+ $f->mode( $f->mode & ~022 ); # chmod go-w
>>+ }
>>+ $tar->write( "$file.tar.gz", 1 );
>
> That looks right. What was the deal about the directories in the RT
> ticket?
>
>> http://rt.cpan.org/Ticket/Display.html?id=39804
>From my quick test on making a dist tarball on my Windows laptop, it
looked like Archive::Tar would add files with mode 0444 but
directories with 0777. The code I added is just the guts of
Archive::Tar::create_archive, but with the loop to mask modes
inserted. The tarball created afterwards had directories that were
0755, so that should be sufficient to close the ticket.
N.B. This doesn't address what happens if someone on Win32 sets the
"tar" argument and uses an external tar program that gets permissions
wrong, but at least the default behavior will be "safe". I would
support forcing Archive::Tar on Win32, but that probably requires
warning people if they ask for an external tar program, etc. and that
patch seemed like more than my tuits at the time.
-- David