Akim Demaille | 1 Oct 2003 09:17
Picon
Picon
Favicon

Re: autoconf 2.57b: locking fails over NFS


 > OK, I installed this patch.  I can't test it easily, though.
 > (For one thing, CVS autoconf doesn't build itself on my host,
 > since it depends on an alpha version of autoconf....)

Does it?  Where?

 > 2003-09-30  Paul Eggert  <eggert <at> twinsun.com>

 > 	* lib/Autom4te/XFile.pm: Use Errno.
 > 	(lock): Ignore ENOLCK errors.  Problem reported Andreas Schwab in
 > 	<http://mail.gnu.org/archive/html/bug-autoconf/2003-09/msg00141.html>.

 > Index: XFile.pm
 > ===================================================================
 > RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/XFile.pm,v
 > retrieving revision 1.8
 > retrieving revision 1.10
 > diff -p -u -r1.8 -r1.10
 > --- XFile.pm	13 Sep 2003 22:00:36 -0000	1.8
 > +++ XFile.pm	30 Sep 2003 19:34:28 -0000	1.10
 >  <at>  <at>  -87,6 +87,7  <at>  <at>  require 5.000;
 >  use strict;
 >  use vars qw($VERSION  <at> EXPORT  <at> EXPORT_OK $AUTOLOAD  <at> ISA);
 >  use Carp;
 > +use Errno;
 >  use IO::File;
 >  use File::Basename;
 >  use Autom4te::ChannelDefs;
 >  <at>  <at>  -216,7 +217,15  <at>  <at>  sub lock
 >  {
 >    my ($fh, $mode) =  <at> _;
 >    # Cannot use  <at> _ here.
 > -  if (!flock ($fh, $mode))
 > +
 > +  # On some systems (e.g. GNU/Linux with NFSv2), flock(2) does not work over
 > +  # NFS, but Perl prefers that over fcntl(2) if it exists and if
 > +  # perl was not built with -Ud_flock.  Normally, this problem is harmless,
 > +  # so ignore the ENOLCK errors that are reported in that situation,
 > +  # However, if the invoker is using "make -j", the problem is not harmless,
 > +  # so report it in that case.  Admittedly this is a bit of a hack.
 > +  if (!flock ($fh, $mode)
 > +      && (!$!{ENOLCK} || " $ENV{'MAKEFLAGS'}" =~ / (-j|--jobs)/))
 >      {
 >        my $file = $fh->name;
 >        fatal "cannot lock $file with mode $mode: $!";

I installed this in Automake, where it belongs.


Gmane