Skip Menu |

This queue is for tickets about the LockFile-Simple CPAN distribution.

Report information
The Basics
Id: 8163
Status: new
Priority: 0/
Queue: LockFile-Simple

People
Owner: Nobody in particular
Requestors: jenselby [...] metcarta.com
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: Stale lockfile without NFS results in uninitialized variable
LockFile::Simple version 0.2.5, Simple.pm revision 0.2.1.5 Perl version v5.6.1 Debian stable (woody) with 2.4.27 kernel The problem is that the $hostname variable in _acs_stale does not get initialized if you are not using NFS. This does not cause any problems in the module's behavior but it does lead to an ugly error message. I wrote a quick little program to illustrate the problem: #! /usr/bin/perl -w use LockFile::Simple qw(lock trylock unlock); my $lockfile = "./lock"; LockFile::Simple::configure(LockFile::Simple->locker(), -hold => 0, -stale => 1); trylock($lockfile); Run this twice and you get the following output: # /tmp/break-code # /tmp/break-code Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/LockFile/Simple.pm line 560. UNLOCKED ./lock (stale lock by PID 5029) at /usr/lib/perl5/LockFile/Simple.pm line 182. With my fix, you get # /tmp/break-code UNLOCKED ./lock (stale lock by PID 5027) at /usr/lib/perl5/LockFile/Simple.pm line 182. My fix: *** Simple.pm.new Thu Oct 28 13:52:28 2004 --- Simple.pm.old Thu Oct 28 13:33:43 2004 *************** *** 537,543 **** chop($stamp = <FILE>); close FILE; ! my ($pid, $hostname) = ("", ""); if ($self->nfs) { ($pid, $hostname) = $stamp =~ /^(\d+):(\S+)/; --- 537,543 ---- chop($stamp = <FILE>); close FILE; ! my ($pid, $hostname); if ($self->nfs) { ($pid, $hostname) = $stamp =~ /^(\d+):(\S+)/;
*** Simple.pm.new Thu Oct 28 13:52:28 2004 --- Simple.pm.old Thu Oct 28 13:33:43 2004 *************** *** 537,543 **** chop($stamp = <FILE>); close FILE; ! my ($pid, $hostname) = ("", ""); if ($self->nfs) { ($pid, $hostname) = $stamp =~ /^(\d+):(\S+)/; --- 537,543 ---- chop($stamp = <FILE>); close FILE; ! my ($pid, $hostname); if ($self->nfs) { ($pid, $hostname) = $stamp =~ /^(\d+):(\S+)/;