# New Ticket Created by Bruce Gray # Please include the string: [perl #17507] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17507 >
Problem: *.tmp files, especially Makefile.tmp files, not being cleaned up. Cause: lib/Parrot/Configure/Step.pm provides copy_if_diff as an export, and also uses it internally. Sub copy_if_diff does not clean up the copied-from file, but it should in *some* cases. In other cases, the copied-from file is a not a temporary, and should not be removed. Solution: This patch adds 'move_if_diff', and changes 'copy' to 'move' only where appropriate. Hope this helps, Bruce Gray -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/38281/31135/6fa30a/step_move_if_diff.patch
Index: parrot/config/gen/config_h.pl =================================================================== RCS file: /cvs/public/parrot/config/gen/config_h.pl,v retrieving revision 1.4 diff -u -r1.4 config_h.pl --- parrot/config/gen/config_h.pl 3 Sep 2002 07:08:35 -0000 1.4 +++ parrot/config/gen/config_h.pl 22 Sep 2002 21:47:25 -0000 @@ -37,7 +37,7 @@ close HH; - copy_if_diff("$hh.tmp", $hh); + move_if_diff("$hh.tmp", $hh); } 1; Index: parrot/config/gen/core_pmcs.pl =================================================================== RCS file: /cvs/public/parrot/config/gen/core_pmcs.pl,v retrieving revision 1.1 diff -u -r1.1 core_pmcs.pl --- parrot/config/gen/core_pmcs.pl 5 Sep 2002 17:58:01 -0000 1.1 +++ parrot/config/gen/core_pmcs.pl 22 Sep 2002 21:47:25 -0000 @@ -37,7 +37,7 @@ close OUT; - copy_if_diff("$file.tmp", $file); + move_if_diff("$file.tmp", $file); } sub generate_c { @@ -92,7 +92,7 @@ close OUT; - copy_if_diff("$file.tmp", $file); + move_if_diff("$file.tmp", $file); } sub generate_pm { @@ -127,7 +127,7 @@ close OUT; - copy_if_diff("$file.tmp", $file); + move_if_diff("$file.tmp", $file); } 1; Index: parrot/lib/Parrot/Configure/Step.pm =================================================================== RCS file: /cvs/public/parrot/lib/Parrot/Configure/Step.pm,v retrieving revision 1.9 diff -u -r1.9 Step.pm --- parrot/lib/Parrot/Configure/Step.pm 4 Sep 2002 23:17:56 -0000 1.9 +++ parrot/lib/Parrot/Configure/Step.pm 22 Sep 2002 21:47:28 -0000 @@ -9,13 +9,13 @@ @EXPORT=(); -@EXPORT_OK=qw(prompt genfile copy_if_diff +@EXPORT_OK=qw(prompt genfile copy_if_diff move_if_diff cc_gen cc_build cc_run cc_clean cc_run_capture); %EXPORT_TAGS=( inter => ['prompt'], auto => [qw(cc_gen cc_build cc_run cc_clean cc_run_capture)], - gen => [qw(genfile copy_if_diff)] + gen => [qw(genfile copy_if_diff move_if_diff)] ); my $redir_err = (($ENV{COMSPEC} || "")=~ /command\.com/i) ? "" : "2>&1"; @@ -76,6 +76,12 @@ utime $now, $now, $to; } +sub move_if_diff { + my ($from, $to, $ignorePattern) = @_; + copy_if_diff($from, $to, $ignorePattern); + unlink $from; +} + sub genfile { my($source, $target, %options)=@_; @@ -108,7 +114,7 @@ close IN or die "Can't close $source: $!"; close OUT or die "Can't close $target: $!"; - copy_if_diff("$target.tmp", $target, $options{ignorePattern}); + move_if_diff("$target.tmp", $target, $options{ignorePattern}); } sub cc_gen {