1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
From: Brendan O'Dea <bod@debian.org>
Date: Tue, 8 Mar 2005 19:30:38 +1100
Subject: Respect umask during installation
This is needed to satisfy Debian policy regarding group-writable
site directories.
---
cpan/ExtUtils-Install/lib/ExtUtils/Install.pm | 18 +++++++++---------
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 18 +++++++++---------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/cpan/ExtUtils-Install/lib/ExtUtils/Install.pm b/cpan/ExtUtils-Install/lib/ExtUtils/Install.pm
index 83db80d..b7ecd10 100644
--- a/cpan/ExtUtils-Install/lib/ExtUtils/Install.pm
+++ b/cpan/ExtUtils-Install/lib/ExtUtils/Install.pm
@@ -442,7 +442,7 @@ sub _can_write_dir {
return 0;
}
-=head2 _mkpath($dir,$show,$mode,$verbose,$dry_run)
+=head2 _mkpath($dir,$show,$verbose,$dry_run)
Wrapper around File::Path::mkpath() to handle errors.
@@ -459,15 +459,15 @@ writable.
=cut
sub _mkpath {
- my ($dir,$show,$mode,$verbose,$dry_run)=@_;
+ my ($dir,$show,$verbose,$dry_run)=@_;
if ( $verbose && $verbose > 1 && ! -d $dir) {
$show= 1;
- printf "mkpath(%s,%d,%#o)\n", $dir, $show, $mode;
+ printf "mkpath(%s,%d)\n", $dir, $show;
}
if (!$dry_run) {
my @created;
eval {
- @created = File::Path::mkpath($dir,$show,$mode);
+ @created = File::Path::mkpath($dir,$show);
1;
} or _choke("Can't create '$dir'","$@");
# if we created any directories, we were able to write and don't need
@@ -769,7 +769,7 @@ sub install { #XXX OS-SPECIFIC
_chdir($cwd);
}
foreach my $targetdir (sort keys %check_dirs) {
- _mkpath( $targetdir, 0, 0755, $verbose, $dry_run );
+ _mkpath( $targetdir, 0, $verbose, $dry_run );
}
foreach my $found (@found_files) {
my ($diff, $ffd, $origfile, $mode, $size, $atime, $mtime,
@@ -783,7 +783,7 @@ sub install { #XXX OS-SPECIFIC
$targetfile= _unlink_or_rename( $targetfile, 'tryhard', 'install' )
unless $dry_run;
} elsif ( ! -d $targetdir ) {
- _mkpath( $targetdir, 0, 0755, $verbose, $dry_run );
+ _mkpath( $targetdir, 0, $verbose, $dry_run );
}
print "Installing $targetfile\n";
@@ -823,7 +823,7 @@ sub install { #XXX OS-SPECIFIC
if ($pack{'write'}) {
$dir = install_rooted_dir(dirname($pack{'write'}));
- _mkpath( $dir, 0, 0755, $verbose, $dry_run );
+ _mkpath( $dir, 0, $verbose, $dry_run );
print "Writing $pack{'write'}\n" if $verbose;
$packlist->write(install_rooted_file($pack{'write'})) unless $dry_run;
}
@@ -1161,7 +1161,7 @@ sub pm_to_blib {
my($fromto,$autodir,$pm_filter) = @_;
my %dirs;
- _mkpath($autodir,0,0755) if defined $autodir;
+ _mkpath($autodir,0) if defined $autodir;
while(my($from, $to) = each %$fromto) {
if( -f $to && -s $from == -s $to && -M $to < -M $from ) {
print "Skip $to (unchanged)\n" unless $INSTALL_QUIET;
@@ -1186,7 +1186,7 @@ sub pm_to_blib {
} else {
my $dirname = dirname($to);
if (!$dirs{$dirname}++) {
- _mkpath($dirname,0,0755);
+ _mkpath($dirname,0);
}
}
if ($need_filtering) {
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
index 570fe52..cdedbea 100644
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
@@ -2338,7 +2338,7 @@ doc__install : doc_site_install
$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
pure_perl_install :: all
- $(NOECHO) $(MOD_INSTALL) \
+ $(NOECHO) umask 022; $(MOD_INSTALL) \
};
push @m,
@@ -2358,7 +2358,7 @@ q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \
pure_site_install :: all
- $(NOECHO) $(MOD_INSTALL) \
+ $(NOECHO) umask 022; $(MOD_INSTALL) \
};
push @m,
q{ read "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
@@ -2376,7 +2376,7 @@ q{ "$(INST_LIB)" "$(DESTINSTALLSITELIB)" \
"}.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{"
pure_vendor_install :: all
- $(NOECHO) $(MOD_INSTALL) \
+ $(NOECHO) umask 022; $(MOD_INSTALL) \
};
push @m,
q{ read "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
@@ -2408,8 +2408,8 @@ doc_vendor_install :: all
push @m, q{
doc_perl_install :: all
$(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
- -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
- -$(NOECHO) $(DOC_INSTALL) \
+ -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
+ -$(NOECHO) umask 022; $(DOC_INSTALL) \
"Module" "$(NAME)" \
"installed into" "$(INSTALLPRIVLIB)" \
LINKTYPE "$(LINKTYPE)" \
@@ -2419,8 +2419,8 @@ doc_perl_install :: all
doc_site_install :: all
$(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
- -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
- -$(NOECHO) $(DOC_INSTALL) \
+ -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
+ -$(NOECHO) umask 022; $(DOC_INSTALL) \
"Module" "$(NAME)" \
"installed into" "$(INSTALLSITELIB)" \
LINKTYPE "$(LINKTYPE)" \
@@ -2430,8 +2430,8 @@ doc_site_install :: all
doc_vendor_install :: all
$(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
- -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)"
- -$(NOECHO) $(DOC_INSTALL) \
+ -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
+ -$(NOECHO) umask 022; $(DOC_INSTALL) \
"Module" "$(NAME)" \
"installed into" "$(INSTALLVENDORLIB)" \
LINKTYPE "$(LINKTYPE)" \
|