On Sun, May 04, 2008 at 02:48:20PM -0400, Joey Hess wrote:

> This seems to be an incompatability introduced in perl 5.10.
> pristine-tar creates a temp directory with File::Temp and chdirs into
> it. At exit, File::Temp calls rmtree to delete the temp directory. After
> deleting the directory, rmtree tries to chdir back to that location so
> as to not "leave the client code in an unexpected directory". But it's
> deleted the directory, so of course this fails!

> [EMAIL PROTECTED]:~>perl -e 'use File::Temp; my $t=File::Temp::tempdir(TMPDIR 
> => 1, CLEANUP => 1); mkdir("$t/foo"); chdir "$t/foo"; print "now exiting\n"'
> now exiting
> cannot chdir to /home/joey/tmp/7mbcKCVWya/foo from /home/joey/tmp/7mbcKCVWya: 
> No such file or directory, aborting. at /usr/share/perl/5.10/File/Temp.pm 
> line 893
> END failed--call queue aborted.

Both File::Temp and File::Path::rmtree are doing mostly the right thing
here, it's a bit hard to say what should be fixed. The paranoia in
rmtree() isn't unfounded at all, there have been several CVEs due
to race conditions and the like.

File::Temp could of course call rmtree in an eval block and catch this
particular error, but I think making sure the problem is a chdir() made
by the user and not a maze of malicious links or the like is non-trivial.

I'm tempted to say this should just be documented on the File::Temp side
too and left at that, but let's see what upstream thinks.
-- 
Niko Tyni   [EMAIL PROTECTED]



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to