Subject: | Error message on copying of symlink |
Date: | Sun, 17 Dec 2006 13:37:06 +0100 |
To: | bug-File-Copy-Recursive [...] rt.cpan.org |
From: | Olaf Gellert <olaf.gellert [...] intrusion-lab.net> |
Hi,
I try to copy a directory recursively which contains some
symlinks:
Show quoted text
> ls -l /home/gellert/keys
/home/gellert/keys
/home/gellert/keys/keyfile.txt
/home/gellert/keys/keylink.txt -> keyfile.txt
Now I call:
File::Copy::Recursive::dircopy("/home/gellert/keys", "/home/gellert/keys2");
I get the following error message:
Use of uninitialized value in -e at
/usr/lib/perl5/site_perl/5.8.7/File/Copy/Recursive.pm line 184.
Copying a symlink (/home/gellert/keys) whose target does not exist at
./fasel.pl line 5
The directory and the symlinks are copied correctly, though. This is
the part of the code of Recursive.pm (starting at line 179):
for my $file (@files) {
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 || !-e readlink($_[0])) ) {
carp "Copying a symlink ($_[0]) whose target does not exist"
if !-e readlink($_[0]);
symlink readlink($org), $new or return;
}
I wonder why "readlink" is called on $_[0] (which in this case
is the directory "/home/gellert/keys"), while the actual link
to be copied seems to be $org and the new destination is $new.
I am using File::Copy::Recursive 0.29, but in the changes to
0.30 no relevant change for this issue is noted.
Regards, Olaf
--
Dipl.Inform. Olaf Gellert INTRUSION-LAB.NET
Senior Researcher, www.intrusion-lab.net
PKI - and IDS - Services olaf.gellert@intrusion-lab.net