Skip Menu |

This queue is for tickets about the File-Temp CPAN distribution.

Report information
The Basics
Id: 122945
Status: open
Priority: 0/
Queue: File-Temp

People
Owner: Nobody in particular
Requestors: slaven [...] rezic.de
Cc: jkeenan [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: jkeenan [...] cpan.org
Subject: File::Temp, EXLOCK and nfs without lockd
This issue was originally reported in the Perl 5 bug tracker as https://rt.perl.org/Ticket/Display.html?id=112520. Since File-Temp is "cpan upstream", I am moving the ticket here. -- jkeenan ################################################## This is a bug report for perl from slaven@rezic.de, generated with the help of perlbug 1.39 running under perl 5.14.2. ----------------------------------------------------------------- File::Temp::tempfile sets EXLOCK => 1 by default if it is supported, at least on all *BSD systems. Unfortunately the existence of the O_EXLOCK flag does not mean that it is always working. Especially it might not work if the directory containing the temporary file is on an nfs mount, and there's no lockd daemon running. The problem can be reproduced on a FreeBSD system (/mnt/test is an nfs mount, perl either 5.8.9 or 5.14.2): $ sudo /etc/rc.d/nfslocking stop $ cd /mnt/test $ env LC_ALL=C perl -MFile::Temp=tempfile -e 'my($tmpfh,$tmpfile) = tempfile("XXXXXXXX", EXLOCK=>1) or die $!' Error in tempfile() using XXXXXXXX: Could not create temp file q_mcWOt9: Operation not supported at -e line 1 $ env LC_ALL=C perl -MFile::Temp=tempfile -e 'my($tmpfh,$tmpfile) = tempfile("XXXXXXXX", EXLOCK=>0) or die $!' (no error) As EXLOCK => 1 is not really mandatory (for example, it's not available on Linux systems) I would suggest that in such cases tempfile should not fail. Maybe the operation can be automatically retried without using locking. Maybe the meaning of EXLOCK could be changed like this: 1 means: use EXLOCK always, 0 means: use EXLOCK never, undef or unspecified means: use EXLOCK if it exists and if it works. See also https://rt.cpan.org/Ticket/Display.html?id=72291 where the current behavior is causing problems. Regards, Slaven ----------------------------------------------------------------- --- Flags: category=library severity=low module=File::Temp --- Site configuration information for perl 5.14.2: Configured by cpansand at Sun Apr 15 16:22:07 CEST 2012. Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Commit id: dc281e6088d189558b79a5121119b7196c8b3db0 Platform: osname=freebsd, osvers=8.0-release-p4, archname=i386-freebsd uname='freebsd biokovo.herceg.de 8.0-release-p4 freebsd 8.0-release-p4 #0: mon jul 12 20:22:27 utc 2010 root@i386-builder.daemonology.net:usrobjusrsrcsysgeneric i386 ' config_args='-ds -e -Uversiononly -Dinstallusrbinperl=n -Dusedevel -Dprefix=/home/cpansand/var/ctps/5159_2/install/perl-v5.14.2' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include', optimize='-O', cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags ='-Wl,-E -fstack-protector -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lgdbm -lm -lcrypt -lutil -lc perllibs=-lm -lcrypt -lutil -lc libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib -fstack-protector' Locally applied patches: --- @INC for perl 5.14.2: /home/cpansand/var/ctps/5159_2/install/perl-v5.14.2/lib/site_perl/5.14.2/i386-freebsd /home/cpansand/var/ctps/5159_2/install/perl-v5.14.2/lib/site_perl/5.14.2 /home/cpansand/var/ctps/5159_2/install/perl-v5.14.2/lib/5.14.2/i386-freebsd /home/cpansand/var/ctps/5159_2/install/perl-v5.14.2/lib/5.14.2 . --- Environment for perl 5.14.2: HOME=/home/e/eserte LANG (unset) LANGUAGE (unset) LC_ALL=de_DE.ISO8859-1 LC_CTYPE=de_DE.ISO8859-1 LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/local/bin:/usr/X11R6/bin:/usr/X11/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/e/eserte/bin/freebsd8.0:/home/e/eserte/bin/sh:/home/e/eserte/bin:/usr/games:/home/e/eserte/devel PERLDOC=-MPod::Perldoc::ToTextOverstrike PERL_BADLANG (unset) PERL_HTML_DISPLAY_CLASS=HTML::Display::Mozilla SHELL=/bin/tcsh
On 2017-09-02 20:26:14, JKEENAN wrote: Show quoted text
> This issue was originally reported in the Perl 5 bug tracker as > https://rt.perl.org/Ticket/Display.html?id=112520. Since File-Temp is > "cpan upstream", I am moving the ticket here. -- jkeenan > > ################################################## > > > This is a bug report for perl from slaven@rezic.de, > generated with the help of perlbug 1.39 running under perl 5.14.2. > > > ----------------------------------------------------------------- > File::Temp::tempfile sets EXLOCK => 1 by default if it is > supported, at least on all *BSD systems. Unfortunately the > existence of the O_EXLOCK flag does not mean that it is always > working. Especially it might not work if the directory > containing the temporary file is on an nfs mount, and there's > no lockd daemon running. The problem can be reproduced on a > FreeBSD system (/mnt/test is an nfs mount, perl either 5.8.9 > or 5.14.2): > > $ sudo /etc/rc.d/nfslocking stop > > $ cd /mnt/test > $ env LC_ALL=C perl -MFile::Temp=tempfile -e 'my($tmpfh,$tmpfile) = > tempfile("XXXXXXXX", EXLOCK=>1) or die $!' > Error in tempfile() using XXXXXXXX: Could not create temp file > q_mcWOt9: Operation not supported at -e line 1 > $ env LC_ALL=C perl -MFile::Temp=tempfile -e 'my($tmpfh,$tmpfile) = > tempfile("XXXXXXXX", EXLOCK=>0) or die $!' > (no error) > > As EXLOCK => 1 is not really mandatory (for example, it's > not available on Linux systems) I would suggest that in such > cases tempfile should not fail. Maybe the operation can be > automatically > retried without using locking. Maybe the meaning of EXLOCK > could be changed like this: > 1 means: use EXLOCK always, > 0 means: use EXLOCK never, > undef or unspecified means: use EXLOCK if it exists and if it works. > > See also https://rt.cpan.org/Ticket/Display.html?id=72291 > where the current behavior is causing problems. > > Regards, > Slaven > > > ----------------------------------------------------------------- > --- > Flags: > category=library > severity=low > module=File::Temp > --- > Site configuration information for perl 5.14.2: > > Configured by cpansand at Sun Apr 15 16:22:07 CEST 2012. > > Summary of my perl5 (revision 5 version 14 subversion 2) > configuration: > Commit id: dc281e6088d189558b79a5121119b7196c8b3db0 > Platform: > osname=freebsd, osvers=8.0-release-p4, archname=i386-freebsd > uname='freebsd biokovo.herceg.de 8.0-release-p4 freebsd 8.0- > release-p4 #0: mon jul 12 20:22:27 utc 2010 root@i386- > builder.daemonology.net:usrobjusrsrcsysgeneric i386 ' > config_args='-ds -e -Uversiononly -Dinstallusrbinperl=n -Dusedevel > -Dprefix=/home/cpansand/var/ctps/5159_2/install/perl-v5.14.2' > hint=recommended, useposix=true, d_sigaction=define > useithreads=undef, usemultiplicity=undef > useperlio=define, d_sfio=undef, uselargefiles=define, > usesocks=undef > use64bitint=undef, use64bitall=undef, uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno- > strict-aliasing -pipe -fstack-protector -I/usr/local/include', > optimize='-O', > cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict- > aliasing -pipe -fstack-protector -I/usr/local/include' > ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', > gccosandvers='' > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 > d_longlong=define, longlongsize=8, d_longdbl=define, > longdblsize=12 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', > lseeksize=8 > alignbytes=4, prototype=define > Linker and Libraries: > ld='cc', ldflags ='-Wl,-E -fstack-protector -L/usr/local/lib' > libpth=/usr/lib /usr/local/lib > libs=-lgdbm -lm -lcrypt -lutil -lc > perllibs=-lm -lcrypt -lutil -lc > libc=, so=so, useshrplib=false, libperl=libperl.a > gnulibc_version='' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' > cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib > -fstack-protector' > > Locally applied patches: > > > --- > @INC for perl 5.14.2: > /home/cpansand/var/ctps/5159_2/install/perl- > v5.14.2/lib/site_perl/5.14.2/i386-freebsd > /home/cpansand/var/ctps/5159_2/install/perl- > v5.14.2/lib/site_perl/5.14.2 > /home/cpansand/var/ctps/5159_2/install/perl- > v5.14.2/lib/5.14.2/i386-freebsd > /home/cpansand/var/ctps/5159_2/install/perl-v5.14.2/lib/5.14.2 > . > > --- > Environment for perl 5.14.2: > HOME=/home/e/eserte > LANG (unset) > LANGUAGE (unset) > LC_ALL=de_DE.ISO8859-1 > LC_CTYPE=de_DE.ISO8859-1 > LD_LIBRARY_PATH (unset) > LOGDIR (unset) > PATH=/usr/local/bin:/usr/X11R6/bin:/usr/X11/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/e/eserte/bin/freebsd8.0:/home/e/eserte/bin/sh:/home/e/eserte/bin:/usr/games:/home/e/eserte/devel > PERLDOC=-MPod::Perldoc::ToTextOverstrike > PERL_BADLANG (unset) > PERL_HTML_DISPLAY_CLASS=HTML::Display::Mozilla > SHELL=/bin/tcsh
I think the better solution is to not set EXLOCK=>1 by default, as proposed in https://rt.cpan.org/Ticket/Display.html?id=123959 If that ticket is accepted and implemented, then this ticket may be closed without changing anything.