Bug#528544: TMPDIR not honored when opening an anonymous temporary file

Niko Tyni ntyni at debian.org
Tue Jun 9 20:40:57 UTC 2009


This is a bug report for perl from Niko Tyni <ntyni at debian.org>,
generated with the help of perlbug 1.39 running under perl 5.11.0.


-----------------------------------------------------------------
In <http://bugs.debian.org/528544>, Norbert Buchmuller <norbi at nix.hu>
requests that opening an anonymous temporary file with the idiom
`open($fh, '+>', undef)' should use $ENV{TMPDIR} instead of hardcoding
/tmp.

I'm attaching a patch against current blead based on his original one.

I'm uneasy on failing when TMPDIR is set but doesn't exist or isn't
writable. The obvious alternative is to stat it every time and fall back
on /tmp if necessary.

Also, should we worry about tainting issues?
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=wishlist
---
Site configuration information for perl 5.11.0:

Configured by niko at Sat May 30 21:54:25 EEST 2009.

Summary of my perl5 (revision 5 version 11 subversion 0) configuration:
  Local Commit: e97df03b198389a9fe2eb71def8423a0bfbf6df8
  Ancestor: f6085ff72b72f58d9b82bcc722d8a8fe8438b807
  Platform:
    osname=linux, osvers=2.6.26-2-openvz-amd64, archname=x86_64-linux-gnu-thread-multi
    uname='linux minerva 2.6.26-2-openvz-amd64 #1 smp wed may 13 16:46:17 utc 2009 x86_64 gnulinux '
    config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=x86_64-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.11 -Darchlib=/usr/lib/perl/5.11 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.11.0 -Dsitearch=/usr/local/lib/perl/5.11.0 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -DDEBUGGING=-g -Doptimize=-O2 -Dusedevel -Duseshrplib -Dlibperl=libperl.so.5.11.0 -des'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.3.2', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.7.so, so=so, useshrplib=true, libperl=libperl.so.5.11.0
    gnulibc_version='2.7'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl/5.11/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'

Locally applied patches:
    PERL_GIT_UNPUSHED_COMMITS    	/* do not remove this line */
    PERL_GIT_UNCOMMITTED_CHANGES	/* do not remove this line */

---
@INC for perl 5.11.0:
    lib
    /usr/local/lib/perl/5.11.0
    /usr/local/share/perl/5.11.0
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.11
    /usr/share/perl/5.11
    /usr/local/share/perl
    /usr/share/perl5
    .

---
Environment for perl 5.11.0:
    HOME=/home/niko
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LC_CTYPE=fi_FI.UTF-8
    LD_LIBRARY_PATH=.
    LOGDIR (unset)
    PATH=/home/niko/bin:/home/niko/bin:/home/niko/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/sbin:/usr/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/zsh


More information about the Perl-maintainers mailing list