[libfile-nfslock-perl] 20/25: Imported Upstream version 1.24

dom at earth.li dom at earth.li
Sat Oct 4 21:56:34 UTC 2014


This is an automated email from the git hooks/post-receive script.

dom pushed a commit to branch master
in repository libfile-nfslock-perl.

commit e62b6cafe6a453a48e8779ba1c2f1963cdcf8fad
Author: Dominic Hargreaves <dom at earth.li>
Date:   Sat Oct 4 22:39:29 2014 +0100

    Imported Upstream version 1.24
---
 Changes             |  19 ++++++
 File-NFSLock.spec   |   2 +-
 META.yml            |  31 ++++++----
 README              | 165 +++++++++++++++++++++++++---------------------------
 lib/File/NFSLock.pm |  28 +++++----
 t/100_load.t        |   1 +
 t/120_single.t      |   3 +-
 t/200_bl_ex.t       |   3 +-
 t/210_nb_ex.t       |   3 +-
 t/220_ex_scope.t    |   3 +-
 t/230_double.t      |   5 +-
 t/240_fork.t        |   3 +-
 t/300_bl_sh.t       |   5 +-
 t/400_kill.t        |   5 +-
 t/410_die.t         |   7 ++-
 t/420_crash.t       |   7 ++-
 16 files changed, 165 insertions(+), 125 deletions(-)

diff --git a/Changes b/Changes
index 5f0a954..5926726 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,24 @@
 Revision history for Perl extension File::NFSLock.
 
+1.24  Jul 30 14:00 2014
+        - Fixed a race condition in crash recovery.
+        - RT#88520 Thanks David Steinbrunner: Fix typos
+
+1.23  Jul 28 11:00 2014
+        - More gracefully handle arbitrary hostnames.
+        - Patch RT#84658 by Yann Rouillard:
+        - Avoid gleefully double removing valid lockfile
+          when ->unlock is explicitly called.
+        - Patch RT#61258 by cpan at danonline.net:
+        - Fixed $graceful_sig to exit with non-zero to
+          more closely match stock signal handlers.
+
+1.22  Jul 26 09:00 2014
+        - Reported by Kent Fredric and Karen Etheridge:
+        - Patch RT#86125 and RT#91546
+        - Use File::Temp for concurrency compatibility
+          in test suite, such as HARNESS_OPTIONS=j20
+
 1.21  Jul 13 17:00 2011
         - Various patches by Chorny at cpan dot org
           and fREW frioux at gmail dot com:
diff --git a/File-NFSLock.spec b/File-NFSLock.spec
index abcf4c9..179ae1b 100644
--- a/File-NFSLock.spec
+++ b/File-NFSLock.spec
@@ -1,7 +1,7 @@
 # Automatically generated by File-NFSLock.spec.PL
 %define class File
 %define subclass NFSLock
-%define version 1.21
+%define version 1.24
 %define release 1
 %define defperlver 5.6.1
 
diff --git a/META.yml b/META.yml
index 56ad097..a3ade66 100644
--- a/META.yml
+++ b/META.yml
@@ -1,10 +1,21 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         File-NFSLock
-version:      1.21
-version_from: lib/File/NFSLock.pm
-installdirs:  site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+--- #YAML:1.0
+name:               File-NFSLock
+version:            1.24
+abstract:           perl module to do NFS (or not) locking
+author:
+    - Paul Seamons
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:  {}
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.56
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4
diff --git a/README b/README
index 64001a1..001c8cf 100644
--- a/README
+++ b/README
@@ -119,122 +119,117 @@ PARAMETERS
         seconds).
 
 METHODS
-        After the $lock object is instantiated with new, as outlined above,
-        some methods may be used for additional functionality.
+    After the $lock object is instantiated with new, as outlined above, some
+    methods may be used for additional functionality.
 
   unlock
-          $lock->unlock;
+      $lock->unlock;
 
-        This method may be used to explicitly release a lock that is
-        aquired. In most cases, it is not necessary to call unlock directly
-        since it will implicitly be called when the object leaves whatever
-        scope it is in.
+    This method may be used to explicitly release a lock that is acquired.
+    In most cases, it is not necessary to call unlock directly since it will
+    implicitly be called when the object leaves whatever scope it is in.
 
   uncache
-          $lock->uncache;
-          $lock->uncache("otherfile1");
-          uncache("otherfile2");
+      $lock->uncache;
+      $lock->uncache("otherfile1");
+      uncache("otherfile2");
 
-        This method is used to freshen up the contents of a file across NFS,
-        ignoring what is contained in the NFS client cache. It is always
-        called from within the new constructor on the file that the lock is
-        being attempted. uncache may be used as either an object method or
-        as a stand alone subroutine.
+    This method is used to freshen up the contents of a file across NFS,
+    ignoring what is contained in the NFS client cache. It is always called
+    from within the new constructor on the file that the lock is being
+    attempted. uncache may be used as either an object method or as a stand
+    alone subroutine.
 
   newpid
-          my $pid = fork;
-          if (defined $pid) {
-            # Fork Failed
-          } elsif ($pid) {
-            $lock->newpid; # Parent
-          } else {
-            $lock->newpid; # Child
-          }
-
-        If fork() is called after a lock has been aquired, then when the
-        lock object leaves scope in either the parent or child, it will be
-        released. This behavior may be inappropriate for your application.
-        To delegate ownership of the lock from the parent to the child, both
-        the parent and child process must call the newpid() method after a
-        successful fork() call. This will prevent the parent from releasing
-        the lock when unlock is called or when the lock object leaves scope.
-        This is also useful to allow the parent to fail on subsequent lock
-        attempts if the child lock is still aquired.
+      my $pid = fork;
+      if (defined $pid) {
+        # Fork Failed
+      } elsif ($pid) {
+        $lock->newpid; # Parent
+      } else {
+        $lock->newpid; # Child
+      }
+
+    If fork() is called after a lock has been acquired, then when the lock
+    object leaves scope in either the parent or child, it will be released.
+    This behavior may be inappropriate for your application. To delegate
+    ownership of the lock from the parent to the child, both the parent and
+    child process must call the newpid() method after a successful fork()
+    call. This will prevent the parent from releasing the lock when unlock
+    is called or when the lock object leaves scope. This is also useful to
+    allow the parent to fail on subsequent lock attempts if the child lock
+    is still acquired.
 
 FAILURE
-        On failure, a global variable, $File::NFSLock::errstr, should be set
-        and should contain the cause for the failure to get a lock. Useful
-        primarily for debugging.
+    On failure, a global variable, $File::NFSLock::errstr, should be set and
+    should contain the cause for the failure to get a lock. Useful primarily
+    for debugging.
 
 LOCK_EXTENSION
-        By default File::NFSLock will use a lock file extenstion of
-        ".NFSLock". This is in a global variable
-        $File::NFSLock::LOCK_EXTENSION that may be changed to suit other
-        purposes (such as compatibility in mail systems).
+    By default File::NFSLock will use a lock file extension of ".NFSLock".
+    This is in a global variable $File::NFSLock::LOCK_EXTENSION that may be
+    changed to suit other purposes (such as compatibility in mail systems).
 
 BUGS
-        Notify paul at seamons.com or bbb at cpan.org if you spot anything.
+    Notify paul at seamons.com or bbb at cpan.org if you spot anything.
 
   FIFO
-        Locks are not necessarily obtained on a first come first serve
-        basis. Not only does this not seem fair to new processes trying to
-        obtain a lock, but it may cause a process starvation condition on
-        heavily locked files.
+    Locks are not necessarily obtained on a first come first serve basis.
+    Not only does this not seem fair to new processes trying to obtain a
+    lock, but it may cause a process starvation condition on heavily locked
+    files.
 
   DIRECTORIES
-        Locks cannot be obtained on directory nodes, nor can a directory
-        node be uncached with the uncache routine because hard links do not
-        work with directory nodes. Some other algorithm might be used to
-        uncache a directory, but I am unaware of the best way to do it. The
-        biggest use I can see would be to avoid NFS cache of directory
-        modified and last accessed timestamps.
+    Locks cannot be obtained on directory nodes, nor can a directory node be
+    uncached with the uncache routine because hard links do not work with
+    directory nodes. Some other algorithm might be used to uncache a
+    directory, but I am unaware of the best way to do it. The biggest use I
+    can see would be to avoid NFS cache of directory modified and last
+    accessed timestamps.
 
 INSTALL
-        Download and extract tarball before running these commands in its
-        base directory:
+    Download and extract tarball before running these commands in its base
+    directory:
 
-          perl Makefile.PL
-          make
-          make test
-          make install
+      perl Makefile.PL
+      make
+      make test
+      make install
 
-        For RPM installation, download tarball before running these commands
-        in your _topdir:
+    For RPM installation, download tarball before running these commands in
+    your _topdir:
 
-          rpm -ta SOURCES/File-NFSLock-*.tar.gz
-          rpm -ih RPMS/noarch/perl-File-NFSLock-*.rpm
+      rpm -ta SOURCES/File-NFSLock-*.tar.gz
+      rpm -ih RPMS/noarch/perl-File-NFSLock-*.rpm
 
 AUTHORS
-        Paul T Seamons (paul at seamons.com) - Performed majority of the
-        programming with copious amounts of input from Rob Brown.
+    Paul T Seamons (paul at seamons.com) - Performed majority of the
+    programming with copious amounts of input from Rob Brown.
 
-        Rob B Brown (bbb at cpan.org) - In addition to helping in the
-        programming, Rob Brown provided most of the core testing to make
-        sure implementation worked properly. He is now the current
-        maintainer.
+    Rob B Brown (bbb at cpan.org) - In addition to helping in the programming,
+    Rob Brown provided most of the core testing to make sure implementation
+    worked properly. He is now the current maintainer.
 
-        Also Mark Overmeer (mark at overmeer.net) - Author of
-        Mail::Box::Locker, from which some key concepts for File::NFSLock
-        were taken.
+    Also Mark Overmeer (mark at overmeer.net) - Author of Mail::Box::Locker,
+    from which some key concepts for File::NFSLock were taken.
 
-        Also Kevin Johnson (kjj at pobox.com) - Author of
-        Mail::Folder::Maildir, from which Mark Overmeer based
-        Mail::Box::Locker.
+    Also Kevin Johnson (kjj at pobox.com) - Author of Mail::Folder::Maildir,
+    from which Mark Overmeer based Mail::Box::Locker.
 
 COPYRIGHT
-          Copyright (C) 2001
-          Paul T Seamons
-          paul at seamons.com
-          http://seamons.com/
+      Copyright (C) 2001
+      Paul T Seamons
+      paul at seamons.com
+      http://seamons.com/
 
-          Copyright (C) 2002-2003,
-          Rob B Brown
-          bbb at cpan.org
+      Copyright (C) 2002-2003,
+      Rob B Brown
+      bbb at cpan.org
 
-          This package may be distributed under the terms of either the
-          GNU General Public License
-            or the
-          Perl Artistic License
+      This package may be distributed under the terms of either the
+      GNU General Public License
+        or the
+      Perl Artistic License
 
-          All rights reserved.
+      All rights reserved.
 
diff --git a/lib/File/NFSLock.pm b/lib/File/NFSLock.pm
index 9dea38a..3527ac4 100644
--- a/lib/File/NFSLock.pm
+++ b/lib/File/NFSLock.pm
@@ -32,7 +32,7 @@ our $errstr;
 use base 'Exporter';
 our @EXPORT_OK = qw(uncache);
 
-our $VERSION = '1.21';
+our $VERSION = '1.24';
 
 #Get constants, but without the bloat of
 #use Fcntl qw(LOCK_SH LOCK_EX LOCK_NB);
@@ -63,7 +63,7 @@ my $graceful_sig = sub {
   print STDERR "Received SIG$_[0]\n" if @_;
   # Perl's exit should safely DESTROY any objects
   # still "alive" before calling the real _exit().
-  exit;
+  exit 1;
 };
 
 our @CATCH_SIGS = qw(TERM INT);
@@ -172,7 +172,7 @@ sub new {
       my $try_lock_exclusive = !($self->{lock_type} & LOCK_SH);
 
       while(defined(my $line=<$fh>)){
-        if ($line =~ /^$HOSTNAME (-?\d+) /) {
+        if ($line =~ /^\Q$HOSTNAME\E (-?\d+) /) {
           my $pid = $1;
           if ($pid == $$) {       # This is me.
             push @mine, $line;
@@ -202,7 +202,7 @@ sub new {
         seek ($fh, 0, 0);
         my $content = '';
         while(defined(my $line=<$fh>)){
-          if ($line =~ /^$HOSTNAME (-?\d+) /) {
+          if ($line =~ /^\Q$HOSTNAME\E (-?\d+) /) {
             my $pid = $1;
             next if (!kill 0, $pid);  # Skip dead locks from this host
           }
@@ -216,8 +216,8 @@ sub new {
           truncate $fh, length($content);
           close    $fh;
         }else{
-          close $fh;
           unlink $self->{lock_file};
+          close $fh;
         }
 
       ### No "dead" or stale locks found.
@@ -258,7 +258,7 @@ sub new {
   ### clear up the NFS cache
   $self->uncache;
 
-  ### Yes, the lock has been aquired.
+  ### Yes, the lock has been acquired.
   delete $self->{unlocked};
 
   return $self;
@@ -273,9 +273,9 @@ sub unlock ($) {
   if (!$self->{unlocked}) {
     unlink( $self->{rand_file} ) if -e $self->{rand_file};
     if( $self->{lock_type} & LOCK_SH ){
-      return $self->do_unlock_shared;
+      $self->do_unlock_shared;
     }else{
-      return $self->do_unlock;
+      $self->do_unlock;
     }
     $self->{unlocked} = 1;
     foreach my $signal (@CATCH_SIGS) {
@@ -486,6 +486,8 @@ sub newpid {
 1;
 
 
+=pod
+
 =head1 NAME
 
 File::NFSLock - perl module to do NFS (or not) locking
@@ -621,6 +623,8 @@ recursion load could exist so do_lock will only recurse 10 times (this is only
 a problem if the stale_lock_timeout is set too low -- on the order of one or two
 seconds).
 
+=back
+
 =head1 METHODS
 
 After the $lock object is instantiated with new,
@@ -632,7 +636,7 @@ additional functionality.
   $lock->unlock;
 
 This method may be used to explicitly release a lock
-that is aquired.  In most cases, it is not necessary
+that is acquired.  In most cases, it is not necessary
 to call unlock directly since it will implicitly be
 called when the object leaves whatever scope it is in.
 
@@ -660,7 +664,7 @@ object method or as a stand alone subroutine.
     $lock->newpid; # Child
   }
 
-If fork() is called after a lock has been aquired,
+If fork() is called after a lock has been acquired,
 then when the lock object leaves scope in either
 the parent or child, it will be released.  This
 behavior may be inappropriate for your application.
@@ -671,7 +675,7 @@ fork() call.  This will prevent the parent from
 releasing the lock when unlock is called or when
 the lock object leaves scope.  This is also
 useful to allow the parent to fail on subsequent
-lock attempts if the child lock is still aquired.
+lock attempts if the child lock is still acquired.
 
 =head1 FAILURE
 
@@ -680,7 +684,7 @@ contain the cause for the failure to get a lock.  Useful primarily for debugging
 
 =head1 LOCK_EXTENSION
 
-By default File::NFSLock will use a lock file extenstion of ".NFSLock".  This is
+By default File::NFSLock will use a lock file extension of ".NFSLock".  This is
 in a global variable $File::NFSLock::LOCK_EXTENSION that may be changed to
 suit other purposes (such as compatibility in mail systems).
 
diff --git a/t/100_load.t b/t/100_load.t
index 8c0ed61..7b2461a 100644
--- a/t/100_load.t
+++ b/t/100_load.t
@@ -6,5 +6,6 @@ use strict;
 use warnings;
 
 use Test::More tests => 1;
+use File::Temp qw(tempfile);
 
 use_ok 'File::NFSLock';
diff --git a/t/120_single.t b/t/120_single.t
index b3fb2b2..3f29a70 100644
--- a/t/120_single.t
+++ b/t/120_single.t
@@ -3,8 +3,9 @@
 use Test::More tests => 2;
 use File::NFSLock;
 use Fcntl qw(O_CREAT O_RDWR O_RDONLY O_TRUNC LOCK_EX);
+use File::Temp qw(tempfile);
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Create a blank file
 sysopen ( my $fh, $datafile, O_CREAT | O_RDWR | O_TRUNC );
diff --git a/t/200_bl_ex.t b/t/200_bl_ex.t
index 1160cd6..3b812c1 100644
--- a/t/200_bl_ex.t
+++ b/t/200_bl_ex.t
@@ -2,6 +2,7 @@
 
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 
 use Test::More;
 if( $^O eq 'MSWin32' ) {
@@ -19,7 +20,7 @@ my $n = 50;
 
 $| = 1; # Buffer must be autoflushed because of fork() below.
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Create a blank file
 sysopen ( my $fh, $datafile, O_CREAT | O_RDWR | O_TRUNC );
diff --git a/t/210_nb_ex.t b/t/210_nb_ex.t
index 55e9fac..31ae71d 100644
--- a/t/210_nb_ex.t
+++ b/t/210_nb_ex.t
@@ -1,5 +1,6 @@
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 
 # Non-Blocking Exclusive Lock Test
 
@@ -9,7 +10,7 @@ use Fcntl qw(O_CREAT O_RDWR O_RDONLY O_TRUNC LOCK_EX LOCK_NB);
 
 $| = 1; # Buffer must be autoflushed because of fork() below.
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Create a blank file
 sysopen ( my $fh, $datafile, O_CREAT | O_RDWR | O_TRUNC );
diff --git a/t/220_ex_scope.t b/t/220_ex_scope.t
index 43be1c4..07cfc55 100644
--- a/t/220_ex_scope.t
+++ b/t/220_ex_scope.t
@@ -11,6 +11,7 @@
 
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 
 use Test::More;
 if( $^O eq 'MSWin32' ) {
@@ -24,7 +25,7 @@ use Fcntl qw(O_CREAT O_RDWR O_RDONLY O_TRUNC LOCK_EX LOCK_NB);
 
 $| = 1; # Buffer must be autoflushed because of fork() below.
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Create a blank file
 sysopen ( my $fh, $datafile, O_CREAT | O_RDWR | O_TRUNC );
diff --git a/t/230_double.t b/t/230_double.t
index 42016e1..38bb6c2 100644
--- a/t/230_double.t
+++ b/t/230_double.t
@@ -1,10 +1,11 @@
 # Exclusive Double Lock Test
 #
-# This tests to make sure the same process can aquire
+# This tests to make sure the same process can acquire
 # an exclusive lock multiple times for the same file.
 
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 
 use Test::More tests => 5;
 use File::NFSLock;
@@ -12,7 +13,7 @@ use Fcntl qw(O_CREAT O_RDWR O_RDONLY O_TRUNC O_APPEND LOCK_EX LOCK_SH LOCK_NB);
 
 $| = 1;
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Wipe lock file in case it exists
 unlink ("$datafile$File::NFSLock::LOCK_EXTENSION");
diff --git a/t/240_fork.t b/t/240_fork.t
index b0f01ff..d1748c8 100644
--- a/t/240_fork.t
+++ b/t/240_fork.t
@@ -5,6 +5,7 @@
 
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 
 use Test::More tests => 5;
 use File::NFSLock;
@@ -12,7 +13,7 @@ use Fcntl qw(O_CREAT O_RDWR O_RDONLY O_TRUNC O_APPEND LOCK_EX LOCK_SH LOCK_NB);
 
 $| = 1; # Buffer must be autoflushed because of fork() below.
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Wipe lock file in case it exists
 unlink ("$datafile$File::NFSLock::LOCK_EXTENSION");
diff --git a/t/300_bl_sh.t b/t/300_bl_sh.t
index 1609cdd..5b6b7ab 100644
--- a/t/300_bl_sh.t
+++ b/t/300_bl_sh.t
@@ -1,6 +1,7 @@
 # Blocking Shared Lock Test
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 
 use Test::More;
 if( $^O eq 'MSWin32' ) {
@@ -18,7 +19,7 @@ my $shared_delay = 5;
 
 $| = 1; # Buffer must be autoflushed because of fork() below.
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Create a blank file
 sysopen ( my $fh, $datafile, O_CREAT | O_RDWR | O_TRUNC );
@@ -121,7 +122,7 @@ my ($rd3, $wr3);
 ok (pipe($rd3, $wr3));
 
 # Wait a few seconds less than if all locks were
-# aquired asyncronously to ensure that they overlap.
+# acquired asyncronously to ensure that they overlap.
 alarm($m*$shared_delay-2);
 
 for (my $i = 0; $i < $m ; $i++) {
diff --git a/t/400_kill.t b/t/400_kill.t
index 66d1502..03d8bd9 100644
--- a/t/400_kill.t
+++ b/t/400_kill.t
@@ -2,6 +2,7 @@
 
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 
 use Test::More tests => 10;
 use File::NFSLock;
@@ -9,7 +10,7 @@ use Fcntl qw(O_CREAT O_RDWR O_RDONLY O_TRUNC LOCK_EX);
 
 $| = 1; # Buffer must be autoflushed because of fork() below.
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Wipe lock file in case it exists
 unlink ("$datafile$File::NFSLock::LOCK_EXTENSION");
@@ -70,7 +71,7 @@ ok (wait);
 my ($rd2, $wr2);
 ok (pipe($rd2, $wr2)); # Connected pipe for child2
 if (!fork) {
-  # The last lock died, so this should aquire fine.
+  # The last lock died, so this should acquire fine.
   my $lock = new File::NFSLock {
     file => $datafile,
     lock_type => LOCK_EX,
diff --git a/t/410_die.t b/t/410_die.t
index abb4e3f..89ead20 100644
--- a/t/410_die.t
+++ b/t/410_die.t
@@ -2,6 +2,7 @@
 
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 
 use Test::More tests => 9;
 use File::NFSLock;
@@ -9,7 +10,7 @@ use Fcntl qw(O_CREAT O_RDWR O_RDONLY O_TRUNC LOCK_EX);
 
 $| = 1; # Buffer must be autoflushed because of fork() below.
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Wipe lock file in case it exists
 unlink ("$datafile$File::NFSLock::LOCK_EXTENSION");
@@ -42,7 +43,7 @@ if (!$pid) {
     print $fh "exclusive\n";
     close $fh;
     open(STDERR,">/dev/null");
-    die "I will die while lock is still aquired";
+    die "I will die while lock is still acquired";
   }
   die "Lock failed!";
 }
@@ -66,7 +67,7 @@ ok (wait);
 my ($rd2, $wr2);
 ok (pipe($rd2, $wr2)); # Connected pipe for child2
 if (!fork) {
-  # The last lock died, so this should aquire fine.
+  # The last lock died, so this should acquire fine.
   my $lock = new File::NFSLock {
     file => $datafile,
     lock_type => LOCK_EX,
diff --git a/t/420_crash.t b/t/420_crash.t
index 9559fb3..ccc88a5 100644
--- a/t/420_crash.t
+++ b/t/420_crash.t
@@ -2,6 +2,7 @@
 
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 
 use Test::More tests => 10;
 use File::NFSLock;
@@ -9,7 +10,7 @@ use Fcntl qw(O_CREAT O_RDWR O_RDONLY O_TRUNC LOCK_EX);
 
 $| = 1; # Buffer must be autoflushed because of fork() below.
 
-my $datafile = "testfile.dat";
+my $datafile = tempfile();
 
 # Wipe lock file in case it exists
 unlink ("$datafile$File::NFSLock::LOCK_EXTENSION");
@@ -58,7 +59,7 @@ close ($rd1);
 # test 4
 ok ($child1_lock);
 
-# Pretend like the box crashed rudely while the lock is aquired
+# Pretend like the box crashed rudely while the lock is acquired
 # test 5
 ok (kill "KILL", $pid);
 
@@ -70,7 +71,7 @@ ok (wait);
 my ($rd2, $wr2);
 ok (pipe($rd2, $wr2)); # Connected pipe for child2
 if (!fork) {
-  # The last lock died, so this should aquire fine.
+  # The last lock died, so this should acquire fine.
   my $lock = new File::NFSLock {
     file => $datafile,
     lock_type => LOCK_EX,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libfile-nfslock-perl.git



More information about the Pkg-perl-cvs-commits mailing list