Subject: | LWP::UserAgent::mirror is not atomic |
The quite old commit c99870f0b619684694cea2b0a0d998080e8cb3b0 introduced
a change which makes mirror() no longer atomic, because an unlink() is
done first, and then the rename() follows. Since perldoc perlport does
not mention a limitation for rename() (other than the probably non
relevant limitation on MSWin32 about moving directories), I suggest to
disable the block containing unlink() completely. See the attached patch.
Regards,
Slaven
Subject: | LWP-mirror-unlink.patch |
diff --git a/lib/LWP/UserAgent.pm b/lib/LWP/UserAgent.pm
index abec3f6..798fa38 100644
--- a/lib/LWP/UserAgent.pm
+++ b/lib/LWP/UserAgent.pm
@@ -863,7 +863,7 @@ sub mirror
# The file was the expected length.
else {
# Replace the stale file with a fresh copy
- if ( -e $file ) {
+ if ( 0 ) {
# Some dosish systems fail to rename if the target exists
chmod 0777, $file;
unlink $file;