develooper Front page | perl.perl5.porters | Postings from June 2008

[rt.cpan.org #36982] rmtree() makes symlink targets world-writable

From:
ntyni@iki.fi via RT
Date:
June 21, 2008 15:47
Subject:
[rt.cpan.org #36982] rmtree() makes symlink targets world-writable
Message ID:
rt-3.6.HEAD-18983-1214028717-177.36982-4-0@rt.cpan.org
Sat Jun 21 02:11:56 2008: Request 36982 was acted upon.
Transaction: Ticket created by ntyni@iki.fi
       Queue: File-Path
     Subject: rmtree() makes symlink targets world-writable
   Broken in: 2.04
    Severity: Critical
       Owner: Nobody
  Requestors: ntyni@iki.fi
      Status: new
 Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=36982 >


Hi,

as reported in <http://bugs.debian.org/487319>, when rmtree() encounters
a symlink, it will change the permissions of the link target to the
permissions of the link, usually 0777.

% touch foo
% ln -s foo bar
% ls -l foo bar
lrwxrwxrwx 1 niko niko 3 2008-06-21 09:06 bar -> foo
-rw-r--r-- 1 niko niko 0 2008-06-21 09:06 foo
% perl -e 'use File::Path rmtree; rmtree bar'
% ls -l foo bar                              
ls: cannot access bar: No such file or directory
-rwxrwxrwx 1 niko niko 0 2008-06-21 09:06 foo

This is with Perl 5.10.0, containing File-Path 2.04, but I have verified
it with the 2.06_04 CPAN version too.

There's a proposed patch by Ben Hutchings in the Debian report linked
above, please have a look.
-- 
Niko Tyni
ntyni@debian.org



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