Subject: | dircopy fails if source directory is read only |
Trying to copy from a read only directory to a non existent new
directory fails.
I am running this on Linux, Ubuntu 11.10 with File::Copy::Recursive
v0.38.
The new destination directory is created, but inherits read only
permissions from the source directory before the rest of the files have
been copied.
Consequently, copying the rest of the source files into the newly
created destination directory fails with 'permission denied'
for example:
~$ ls -lhd /media/cdrom
dr-xr-xr-x 1 root root 2.0K 2012-02-18 10:35 /media/cdrom
dircopy('/media/cdrom', '/tmp/destination') will fail with 'Permission
Denied'.
A workaround, if you are not concerned by maintaining permissions on the
copied files is to set:
$File::Copy::Recursive::KeepMode = 0;
A longer-term fix requires directories to be created with writeable
permissions at first, then sync the permissions once we're done copying.