autoconf-patches
[Top][All Lists]
Advanced

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

Locking autom4te.cache take 2


From: Alexandre Duret-Lutz
Subject: Locking autom4te.cache take 2
Date: Wed, 07 May 2003 00:14:14 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3 (gnu/linux)

>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:

>>> "Akim" == Akim Demaille <address@hidden> writes:
 Akim> I fail to see how to exercise this, but at least running
 Akim> simultaneously autoheader, autoconf and automake on Bison resulted in
 Akim> the correct result.

 adl> I'll add a `make -j' test in the Automake test suite.

I'll do this momently, but while working on it I've found
that the current locking code didn't work.

The address@hidden' below was interpreted in scalar context (I think).
I.e., it was taken as its length, 1 (the value of LOCK_SH)
instead of 2 (LOCK_EX) as specified by Autom4te.  That's really
silly.

I've updated truncate too to be on the safe side.  I suspect it
was always truncating at position 1.

2003-05-07  Alexandre Duret-Lutz  <address@hidden>

        * lib/Autom4te/XFile.pm (lock, truncate): Do not pass @_ to flock
        and truncate.

Index: lib/Autom4te/XFile.pm
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/XFile.pm,v
retrieving revision 1.6
diff -u -r1.6 XFile.pm
--- lib/Autom4te/XFile.pm       6 May 2003 08:51:22 -0000       1.6
+++ lib/Autom4te/XFile.pm       6 May 2003 22:10:37 -0000
@@ -210,12 +210,12 @@
 
 sub lock
 {
-  use Fcntl qw(:DEFAULT :flock);
-  my ($fh) = shift;
-  if (!flock ($fh, @_))
+  my ($fh, $mode) = @_;
+  # Cannot use @_ here.
+  if (!flock ($fh, $mode))
     {
       my $file = $fh->name;
-      croak "$me: cannot lock $file with @_: $!\n";
+      croak "$me: cannot lock $file with mode $mode: $!\n";
     }
 }
 
@@ -240,11 +240,11 @@
 
 sub truncate
 {
-  my ($fh) = shift;
-  if (!truncate ($fh, @_))
+  my ($fh, $len) = @_;
+  if (!truncate ($fh, $len))
     {
       my $file = $fh->name;
-      croak "$me: cannot truncate $file with @_: $!\n";
+      croak "$me: cannot truncate $file at $len: $!\n";
     }
 }
 
 
-- 
Alexandre Duret-Lutz





reply via email to

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