Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File::Temp, EXLOCK and nfs without lockd #12063

Closed
p5pRT opened this issue Apr 18, 2012 · 4 comments
Closed

File::Temp, EXLOCK and nfs without lockd #12063

p5pRT opened this issue Apr 18, 2012 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 18, 2012

Migrated from rt.perl.org#112520 (status was 'rejected')

Searchable as RT112520$

@p5pRT
Copy link
Author

p5pRT commented Apr 18, 2012

From @eserte

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​: dc281e6
  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

@p5pRT
Copy link
Author

p5pRT commented Sep 3, 2017

From @jkeenan

On Wed, 18 Apr 2012 20​:34​:35 GMT, slaven@​rezic.de wrote​:

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

File-Temp is maintained upstream on CPAN. I have copied the content of this ticket to​:
https://rt.cpan.org/Ticket/Display.html?id=122945

Closing this ticket.

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Sep 3, 2017

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Sep 3, 2017

@jkeenan - Status changed from 'open' to 'rejected'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant