ALT Linux repos
S: | 5.34.1-alt1 |
5.0: | 5.8.9-alt2 |
4.1: | 5.8.8-alt19.M41.1 |
4.0: | 5.8.8-alt14 |
+updates: | 5.8.8-alt14 |
3.0: | 5.8.7-alt2 |
Group :: Development/Perl
RPM: perl
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: perl-5.24.1-alt-at-MM_Unix-shabang.patch
Download
Download
commit dd4e0dd2ec3e090c346606a65f68c806397ce772
Author: Alexey Tourbin <at@altlinux.ru>
Date: Sun Apr 24 22:56:29 2011 +0400
ExtUtlis/MM_Unix.pm (fixin): shebang patch
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
index 4140432..24db9fb 100644
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
@@ -1113,44 +1113,26 @@
my ( $self, @files ) = @_;
for my $file (@files) {
- my $file_new = "$file.new";
- my $file_bak = "$file.bak";
-
- open( my $fixin, '<', $file ) or croak "Can't process '$file': $!";
+ open my $fh, "+<", $file or croak "Can't process '$file': $!";
+ my @stat = stat $fh;
local $/ = "\n";
- chomp( my $line = <$fixin> );
+ chomp( my $line = <$fh> );
next unless $line =~ s/^\s*\#!\s*//; # Not a shebang file.
my $shb = $self->_fixin_replace_shebang( $file, $line );
next unless defined $shb;
- open( my $fixout, ">", "$file_new" ) or do {
- warn "Can't create new $file: $!\n";
- next;
- };
+ # Read the rest and rewind.
+ local $/;
+ my $rest = <$fh>;
+ seek $fh, 0, 0;
# Print out the new #! line (or equivalent).
local $\;
- local $/;
- print $fixout $shb, <$fixin>;
- close $fixin;
- close $fixout;
-
- chmod 0666, $file_bak;
- unlink $file_bak;
- unless ( _rename( $file, $file_bak ) ) {
- warn "Can't rename $file to $file_bak: $!";
- next;
- }
- unless ( _rename( $file_new, $file ) ) {
- warn "Can't rename $file_new to $file: $!";
- unless ( _rename( $file_bak, $file ) ) {
- warn "Can't rename $file_bak back to $file either: $!";
- warn "Leaving $file renamed as $file_bak\n";
- }
- next;
- }
- unlink $file_bak;
+ print $fh $shb, $rest;
+ truncate $fh, tell $fh;
+ close $fh;
+ utime @stat[8,9] => $file if @stat; # preserve timestamps
}
continue {
system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';