(Take 2: even "RT-Send-CC: perl6-internals at perl.org" is
not getting out to the mailing list.)
URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17507
On 2002-09-22, I opened this ticket and submitted a patch.
On 2002-12-11, I updated (in RT) the ticket with more info,
and brought the patch up-to-date with CVS. RT did not echo
the update to the mailing list, so no one but me saw the update.
I have appended a copy of the update for peer review, and
for the mailing list archives.
I have attached the most current version,
step_move_if_diff_v3.patch Unless any objections are raised,
please apply.
--
Hope this helps,
Bruce Gray
>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.
Here is an updated version of the patch; it applies cleanly
to the current CVS tree. First version suffered from
Warnock's Dilemma, and was in DOS format.
The new patch, (step_move_if_diff_v2.patch), obsoletes
the old patch (step_move_if_diff.patch).
These are the files that the patch cleans up:
classes/Makefile.tmp
core_pmcs.c.tmp
docs/Makefile.tmp
include/parrot/config.h.tmp
include/parrot/core_pmcs.h.tmp
include/parrot/has_header.h.tmp
languages/bf/Makefile.tmp
languages/imcc/Makefile.tmp
languages/jako/Makefile.tmp
languages/Makefile.tmp
languages/miniperl/Makefile.tmp
languages/perl6/Makefile.tmp
languages/scheme/Makefile.tmp
lib/Parrot/PMC.pm.tmp
libparrot.def.tmp
Makefile.tmp
myconfig.tmp
test.c.tmp
Index: 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
--- config/gen/config_h.pl 3 Sep 2002 07:08:35 -0000 1.4
+++ config/gen/config_h.pl 26 Dec 2002 21:56:52 -0000
@@ -37,7 +37,7 @@
close HH;
- copy_if_diff("$hh.tmp", $hh);
+ move_if_diff("$hh.tmp", $hh);
}
1;
Index: config/gen/core_pmcs.pl
===================================================================
RCS file: /cvs/public/parrot/config/gen/core_pmcs.pl,v
retrieving revision 1.4
diff -u -r1.4 core_pmcs.pl
--- config/gen/core_pmcs.pl 28 Oct 2002 13:58:00 -0000 1.4
+++ config/gen/core_pmcs.pl 26 Dec 2002 21:56:52 -0000
@@ -38,7 +38,7 @@
close OUT;
- copy_if_diff("$file.tmp", $file);
+ move_if_diff("$file.tmp", $file);
}
sub generate_c {
@@ -93,7 +93,7 @@
close OUT;
- copy_if_diff("$file.tmp", $file);
+ move_if_diff("$file.tmp", $file);
}
sub generate_pm {
@@ -129,7 +129,7 @@
close OUT;
- copy_if_diff("$file.tmp", $file);
+ move_if_diff("$file.tmp", $file);
}
1;
Index: lib/Parrot/Configure/Step.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Configure/Step.pm,v
retrieving revision 1.11
diff -u -r1.11 Step.pm
--- lib/Parrot/Configure/Step.pm 12 Dec 2002 11:21:36 -0000 1.11
+++ lib/Parrot/Configure/Step.pm 26 Dec 2002 21:56:53 -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)=@_;
@@ -121,7 +127,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 {