What seems to have happened is that this code in lib/File/Path.pm in
Perl 5.8.8:

            chmod $rp | 0600, $root
              or carp "Can't make file $root writeable: $!"
                if $force_writeable;

was rewritten for 5.10 as:

            my $nperm = $perm & 07777 | 0600;
            if ($nperm != $perm and not chmod $nperm, $root) {
                if ($Force_Writeable) {
                    _error($arg, "cannot make file writeable", $canon);
                }
            }

This tests the $Force_Writeable variable only after attempting the
chmod, whereas the original correctly tested the $Force_Writeable
variable first.  This variable defines whether the OS requires write
permission when deleting a file, and is always false on Unix-like
systems including Debian.  I believe the correct code is:

            my $nperm = $perm & 07777 | 0600;
            if ($Force_Writeable && $nperm != $perm and not chmod $nperm, 
$root) {
                 _error($arg, "cannot make file writeable", $canon);
            }

All the other chmod calls in _rmtree appear to be dependent on whether
the directory entry being deleted is a directory (tested using lstat,
not stat) and the 'safe' word not being set.

Ben.

-- 
Ben Hutchings
Design a system any fool can use, and only a fool will want to use it.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to