develooper Front page | perl.perl5.porters | Postings from August 2012

RE: [PATCH] Fix File::Copy test failure on Windows

Thread Previous
From:
Steve Hay
Date:
August 28, 2012 10:35
Subject:
RE: [PATCH] Fix File::Copy test failure on Windows
Message ID:
1B32FF956ABF414C9BCE5E487A1497E70E3A979A@ukmail02.planit.group
Tony Cook wrote on 2012-08-27:
> On Mon, Aug 27, 2012 at 06:19:58PM +0100, Steve Hay wrote:
>> The attached patch fixes a failure in the new File::Copy tests added
>> by 43ddfa5614 (the ok(!copy...) test passes, but the
>> like($warn_message...) test fails because the code which sets the
>> expected warning isn't run on Windows).
>> 
>> However, I haven't applied it because it doesn't seem correct to me:
>> wouldn't it be more appropriate in this case for the copy to
>> "succeed", like the _eq($from, $to) case a few lines earlier in
>> Copy.pm does?
>> 
>> That can be achieved by changing the new return 0 which this patch
>> adds to return 1 and adjusting the test script accordingly, although
>> that would involve the test script replicating the same d_symlink /
>> d_readlink / d_link logic as Copy.pm has, which doesn't seem ideal
>> (unless *that* case is also changed to return 1...).
> 
> Sorry for the test failure, I thought I'd tested on Win32 back when I
> originally wrote it, so only tested on Linux this time around.
> 
> copy() is documented to fail when you try to copy a file over itself,
> and it does in several cases.
> 
> 754f2cd0b changed it to the current inconsistent behaviour.
> 

Ah, good spot! In light of that, I've committed my original fix
(a008494330) and also reverted the inconsistency introduced by 754f2cd0b
(39b80fd98d). Hopefully that won't cause anyone any nasty surprises
since it just puts it back to how it's long been documented anyway.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About