develooper Front page | perl.module.build | Postings from November 2008

PATCH: Fix Archive::Tar permissions

Thread Next
From:
David Golden
Date:
November 21, 2008 20:21
Subject:
PATCH: Fix Archive::Tar permissions
Message ID:
5d4beb40811212021x64516ab3x71060234ffb845bd@mail.gmail.com
On Fri, Nov 21, 2008 at 10:05 PM, Eric Wilhelm
<scratchcomputing@gmail.com> wrote:
> Is anybody working on a patch?

Sure.  Here it is, since I can't commit back to the repository.
(Anyone want to give me a commit bit -- svn.perl.org username
"dagolden"?)

Index: lib/Module/Build/Base.pm
===================================================================
--- lib/Module/Build/Base.pm    (revision 12098)
+++ lib/Module/Build/Base.pm    (working copy)
@@ -3788,7 +3788,12 @@
     # hack so that the resulting archive is compatible with older clients.
     $Archive::Tar::DO_NOT_USE_PREFIX = 0;
     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 );
   }
 }

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About