Re: autoconf 2.57b: locking fails over NFS

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

 



Akim Demaille <akim@xxxxxxxx> 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  <eggert@xxxxxxxxxxx>

	* 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>.

--- 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 vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA);
 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: $!";



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux