Skip Menu |
 

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 64147
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)

Attachments
0002-mirror-set-the-modification-time-before-renaming-the.patch



Subject: [PATCH] mirror: set modification time in an atomic way
Download (untitled) / with headers
text/plain 140b
mirror() should set the modification time of the mirrored file *before* the temporary file is renamed. Patch attached. Regards, Slaven
Subject: 0002-mirror-set-the-modification-time-before-renaming-the.patch
From efda27ea996de3f039b6f85e6022512633048831 Mon Sep 17 00:00:00 2001 From: Slaven Rezic <slaven@rezic.de> Date: Wed, 22 Dec 2010 16:50:45 +0100 Subject: [PATCH 2/2] mirror: set the modification time *before* renaming the temporary file --- lib/LWP/UserAgent.pm | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/LWP/UserAgent.pm b/lib/LWP/UserAgent.pm index fe93fe1..4303d13 100644 --- a/lib/LWP/UserAgent.pm +++ b/lib/LWP/UserAgent.pm @@ -868,13 +868,14 @@ sub mirror chmod 0777, $file; unlink $file; } - rename( $tmpfile, $file ) - or die "Cannot rename '$tmpfile' to '$file': $!\n"; # make sure the file has the same last modification time if ( my $lm = $response->last_modified ) { - utime $lm, $lm, $file; + utime $lm, $lm, $tmpfile; } + + rename( $tmpfile, $file ) + or die "Cannot rename '$tmpfile' to '$file': $!\n"; } } # The local copy is fresh enough, so just delete the temp file -- 1.7.0.3


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.