[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autoconf 2.57b: locking fails over NFS

From: Paul Eggert
Subject: Re: autoconf 2.57b: locking fails over NFS
Date: 25 Sep 2003 11:11:17 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Akim Demaille <address@hidden> writes:

> Would there be a nice solution?

Perhaps the simplest solution would be to ignore that particular
failure.  Something like the following, perhaps?  (I haven't tested
this, partly because I'm lazy, partly because I don't offhand know the
portability constraints.)

2003-09-25  Paul Eggert  <address@hidden>

        * lib/Autom4te/XFile.pm: Use Errno.
        (lock): Ignore ENOLCK errors.  Problem reported Andreas Schwab in

--- XFile.pm.~1.8.~     Tue Sep 23 15:44:15 2003
+++ XFile.pm    Thu Sep 25 11:10:55 2003
@@ -87,6 +87,7 @@ require 5.000;
 use strict;
 use Carp;
+use Errno;
 use IO::File;
 use File::Basename;
 use Autom4te::ChannelDefs;
@@ -216,7 +217,11 @@ sub lock
   my ($fh, $mode) = @_;
   # Cannot use @_ 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.  Work around the problem
+  # by ignoring the ENOLCK errors that are reported in that situation.
+  if (!flock ($fh, $mode) && !$!{ENOLCK})
       my $file = $fh->name;
       fatal "cannot lock $file with mode $mode: $!";

reply via email to

[Prev in Thread] Current Thread [Next in Thread]