Bug#619550: File::Temp CLEANUP + chdir gotcha still remains

Joey Hess joeyh at debian.org
Fri Mar 25 00:23:53 UTC 2011


Package: perl-modules
Version: 5.10.1-18
Severity: normal

Bug #479317 explains a gotcha with use of File::Temp::tempdir(CLEANUP => 1).
If the code chdirs into the temp dir, which is a common thing to do,
and then exits without chdiring out, which is not an uncommon thing,
the cleanup code will fail to run.

The bug was closed because it was at least made not to crash the
program. However, this gotcha still remains. A program that has
combined these two common things will be subject to emitting strange
error messages:

cannot remove path when cwd is /home/e-test/tmp/cQei_Q1aVi

.. and leaving behind temp dirs.

I now have at least 3 programs that work around this problem by

END {
	chdir("/)";
}

It's very annoying to have to remember this bug and add this to my code
every time I pull File::Temp into a program.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.37-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages perl-modules depends on:
ii  perl                          5.10.1-18  Larry Wall's Practical Extraction 

perl-modules recommends no packages.

perl-modules suggests no packages.

-- no debconf information

-- 
see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/perl-maintainers/attachments/20110324/6e834d78/attachment.pgp>


More information about the Perl-maintainers mailing list