Skip Menu |

This queue is for tickets about the File-Copy-Recursive CPAN distribution.

Report information
The Basics
Id: 21267
Status: resolved
Priority: 0/
Queue: File-Copy-Recursive

People
Owner: Nobody in particular
Requestors: bryan [...] meatspace.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.25
Fixed in: 0.26



Subject: fcopy() fails on blind symlinks with CopyLink == 0
When CopyLink == 0 and the source file is a blind symlink, fcopy() fails silently, and if invoked by dircopy(), dircopy() exits the current recursion level and continues, so a directory tree containing a blind link is copied only partially. For example, I have a directory containing: snap.nc -> snap.lnx86.nc where snap.lnx86.nc doesn't exist. This causes the open() at line 118 in File::Copy to fail. This condition should at least produce a warning. It would be useful to have an option to copy the link instead of the target if the target doesn't exist, i.e. act as if CopyLink == 1. This is perl, v5.8.5 built for i686-linux
From: bryan [...] meatspace.net
Here's a simple patch that causes the link to be copied instead of the (non-existent) target when $CopyLink == 0 On Fri Sep 01 14:55:22 2006, colmode wrote: Show quoted text
> When CopyLink == 0 and the source file is a blind symlink, fcopy() fails > silently, and if invoked by dircopy(), dircopy() exits the current > recursion level and continues, so a directory tree containing a blind > link is copied only partially. > > For example, I have a directory containing: > > snap.nc -> snap.lnx86.nc > > where snap.lnx86.nc doesn't exist. This causes the open() at line 118 > in File::Copy to fail. > > This condition should at least produce a warning. It would be useful to > have an option to copy the link instead of the target if the target > doesn't exist, i.e. act as if CopyLink == 1. > > This is perl, v5.8.5 built for i686-linux
--- Recursive.pm 2006-07-03 10:50:22.000000000 -0500 +++ /usr/local/share/perl5/site_perl/5.8.5/File/Copy/Recursive.pm 2006-09-01 14:50:16.809029000 -0500 @@ -104,7 +104,7 @@ if($path && !-d $path) { pathmk(File::Spec->catpath($volm,$path), $NoFtlPth); } - if(-l $_[0] && $CopyLink) { + if(-l $_[0] && ($CopyLink || ! -e readlink($_[0]))) { symlink readlink(shift()), shift() or return; } else { copy(@_) or return; @@ -177,7 +177,7 @@ my ($file_ut) = $file =~ m{ (.*) }xms; my $org = File::Spec->catfile($str, $file_ut); my $new = File::Spec->catfile($end, $file_ut); - if(-l $org && $CopyLink) { + if(-l $org && ($CopyLink || ! -e readlink($org))) { symlink readlink($org), $new or return; } elsif(-d $org) {
From: DMUEY [...] cpan.org
Show quoted text
> > snap.nc -> snap.lnx86.nc > > > > where snap.lnx86.nc doesn't exist. This causes the open() at line 118 > > in File::Copy to fail. > > > > This condition should at least produce a warning. It would be useful to > > have an option to copy the link instead of the target if the target > > doesn't exist, i.e. act as if CopyLink == 1.
Missing target symlink support is in 0.26. I'm uploading it now, please let me know how it works for you in this situation.
From: bryan [...] meatspace.net
On Wed Sep 06 18:54:34 2006, DMUEY wrote: Show quoted text
> > > snap.nc -> snap.lnx86.nc > > > > > > where snap.lnx86.nc doesn't exist. This causes the open() at line
> 118
> > > in File::Copy to fail. > > > > > > This condition should at least produce a warning. It would be
> useful to
> > > have an option to copy the link instead of the target if the
> target
> > > doesn't exist, i.e. act as if CopyLink == 1.
> > Missing target symlink support is in 0.26. I'm uploading it now, > please let me know how it > works for you in this situation.
Works now under the conditions that caused the original bug report.
On Fri Sep 08 15:13:49 2006, colmode wrote: Show quoted text
> On Wed Sep 06 18:54:34 2006, DMUEY wrote:
> > > > snap.nc -> snap.lnx86.nc > > > > > > > > where snap.lnx86.nc doesn't exist. This causes the open() at line
> > 118
> > > > in File::Copy to fail. > > > > > > > > This condition should at least produce a warning. It would be
> > useful to
> > > > have an option to copy the link instead of the target if the
> > target
> > > > doesn't exist, i.e. act as if CopyLink == 1.
> > > > Missing target symlink support is in 0.26. I'm uploading it now, > > please let me know how it > > works for you in this situation.
> > Works now under the conditions that caused the original bug report. >
Sorry, didn't realize that adding a comment would re-open the bug. Looks like I don't have privs to close it. This bug tracker is kinda clunky.
Ok, this time resolving worked