[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

5.10 incompatability in File::Temp causes cleanup to fail if chdired into subdir of temp dir



Stefano Zacchiroli wrote:
> A git repository which yesterday was using properly pristine-tar to
> checkout a tarball, is today failing with exit code 2 (though actually
> *after* the tarball has been checked out properly). Here is a console
> log showing the problem:
> 
>   $ pristine-tar checkout sexplib310_3.7.4.orig.tar.gz
>   cannot chdir to /tmp/pristine-tar.9maly5vk6r/workdir/sexplib310-3.7.4 from /tmp/pristine-tar.9maly5vk6r: No such file or directory, aborting. at /usr/share/perl5/File/Temp.pm line 901
>   END failed--call queue aborted at /usr/bin/pristine-tar line 724.
>   pristine-tar: failed to generate tarball

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!

Simple test case:

joey@kodama:~>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.

I doubt this only affects pristine-tar. I have put in the following
workaround in it, but really feel that this bug needs to be fixed in
perl, so reassigning.

# Workaround for bug #479317 in perl 5.10.
sub END {
	chdir("/");
}

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: