Skip Menu |

This queue is for tickets about the Proc-PID-File CPAN distribution.

Report information
The Basics
Id: 58480
Status: new
Priority: 0/
Queue: Proc-PID-File

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.27
Fixed in: (no value)



Subject: When verifying, check for zombie processes
Currently, verify will returns success even if it finds a matching zombie process. It would be useful to check whether the matched process is <defunct>, by passing in an additional configuration parameter (e.g. check_zombies => 1). The attached patch was tested on CentOS.
Subject: File.patch
--- File-orig.pm 2010-06-17 05:53:24.000000000 -0500 +++ File.pm 2010-06-17 05:53:55.000000000 -0500 @@ -239,13 +239,13 @@ sub verify { my ($self, $pid) = @_; - return 1 unless $self->{verify}; + return 1 unless $self->{verify} || $self->{check_zombies}; my $ret = 0; $self->debug("verify(): OS = $^O"); if ($^O =~ /linux|freebsd|cygwin/i) { my $me = $self->{verify}; - if (!$me || $me eq "1") { + if (($me||'') eq "1") { $me = $ME; if ($^O eq "cygwin") { $^X =~ m|([^/]+)$|; @@ -261,12 +261,14 @@ no warnings; # hate that deprecated @_ thing my $n = split(/\s+/, $ps[0]); @ps = split /\s+/, $ps[1], $n; - $ret = $ps[$n - 1] =~ /\Q$me\E/;; - } + $self->debug(" - COMMAND = $ps[$n - 1]"); + $ret = $me ? $ps[$n - 1] =~ /\Q$me\E/ : 1; + $ret = undef, $self->debug(" - ZOMBIE!") if $self->{check_zombies} && $ret && $ps[$n - 1] =~ /<defunct>$/; + } $self->debug(" - ret: [$ret]"); $ret; - } +} # Returns the process id currently stored in the file set. If the method # is passed a file handle, it will return the value, leaving the file handle