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