develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [perl #24245] File::Copy::copy damages hard linked files

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
November 1, 2003 12:34
Subject:
Re: [perl #24245] File::Copy::copy damages hard linked files
Message ID:
20031101214011.162ecfc6.rgarciasuarez@free.fr
Slaven Rezic wrote:
> 
> Or just remove the "-l" tests. Below is a patch to File/Copy.pm and
> new tests for Copy.t. Someone with Win32 experience should add code
> for Win32 --- I see from perlport.pod that Win32 does support
> hardlinks, but device/inode is "not meaningful", so another means have
> to be found to determine the identity of files.

A few comments on this patch :

> --- bleedperl/lib/File/Copy.pm	Thu Aug 14 08:07:09 2003
> +++ bleedperl2/lib/File/Copy.pm	Sun Oct 19 18:39:17 2003
> @@ -77,10 +77,10 @@ sub copy {
>  	croak("'$from' and '$to' are identical (not copied)");
>      }
>  
> -    if ($Config{d_symlink} && $Config{d_readlink} &&
> +    if ((($Config{d_symlink} && $Config{d_readlink}) || $Config{d_link}) &&

I don't think that testing for d_readlink is necessary anymore, is it ?

>  	!($^O eq 'Win32' || $^O eq 'os2' || $^O eq 'vms')) {
>  	no warnings 'io'; # don't warn if -l on filehandle

This warning is no longer necessary, it seems.

> -	if ((-e $from && -l $from) || (-e $to && -l $to)) {
> +	if (-e $from || -e $to) {

Shouldn't that be -e $from && -e $to ?

>  	    my @fs = stat($from);
>  	    my @ts = stat($to);
>  	    if (@fs && @ts && $fs[0] == $ts[0] && $fs[1] == $ts[1]) {
> --- bleedperl/lib/File/Copy.t	Wed Aug  1 02:52:43 2001
> +++ bleedperl2/lib/File/Copy.t	Sun Oct 19 19:05:16 2003
...

Thread Previous | Thread Next


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