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

Report information
The Basics
Id:
108434
Status:
open
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
az [...] snafu.priv.at
Cc:
AdminCc:



Subject: noise about uninitialized values if run under -w
Date: Wed, 04 Nov 2015 20:01:58 +1000
To: bug-Proc-PID-File@rt.cpan.org
From: Alexander Zangerl <az@snafu.priv.at>
this is a forward of debian bug #803442, which lives over there: http://bugs.debian.org/803442 the issue is that if you use proc::pid::file with use warnings, then you get lots of "uninitialized values" warnings. e.g.: # perl -MProc::PID::File -wE'die if Proc::PID::File->running({dir => "."})' Use of uninitialized value $fh in pattern match (m//) at /usr/share/perl5/Proc/PID/File.pm line 288. this is because the read from <$fh> is not checked for content but run through the regex immediately. on newly created pid files it is thus undef. the fix is trivial: --- a/File.pm +++ b/File.pm @@ -285,7 +285,8 @@ sub read { || die qq/Cannot open pid file "$self->{path}": $!\n/; flock($fh, LOCK_EX | LOCK_NB) || die qq/pid "$self->{path}" already locked: $!\n/; - my ($pid) = <$fh> =~ /^(\d+)/; + my $maybe = <$fh>; + my ($pid) = $maybe =~ /^(\d+)/ if (defined $maybe); close $fh if @_ == 1; $self->debug("read(\"$self->{path}\") = " . ($pid || "")); regards az -- Alexander Zangerl + GPG Key 0xB963BD5F + http://snafu.priv.at/ Es ist nichts so absurd, daß Gläubige es nicht glaubten. Oder Beamte täten. -- Arno Schmidt

Message body not shown because it is not plain text.

On Wed Nov 04 05:02:48 2015, az@snafu.priv.at wrote:
Show quoted text
> this is a forward of debian bug #803442, which lives over there: > http://bugs.debian.org/803442 > > the issue is that if you use proc::pid::file with use warnings, > then you get lots of "uninitialized values" warnings. > > e.g.: > # perl -MProc::PID::File -wE'die if Proc::PID::File->running({dir => "."})' > Use of uninitialized value $fh in pattern match (m//) at > /usr/share/perl5/Proc/PID/File.pm line 288.
Upon the first look, this seems like one of those "doctor it hurts when I do this" bugs. The module does not 'use warnings;'. Of course, if you force the warnings on via -w flag, you'll get warnings. In the Debian bug you're referring to, there is no explanation as to why -w flag is required; in what context does this behavior appear?
Subject: Re: [rt.cpan.org #108434] noise about uninitialized values if run under -w
Date: Sat, 30 Jul 2016 10:01:51 +1000
To: bug-Proc-PID-File@rt.cpan.org
From: Alexander Zangerl <az@snafu.priv.at>
On Thu, 28 Jul 2016 23:17:37 -0400, "Dmitri Tikhonov via RT" writes:
Show quoted text
>Upon the first look, this seems like one of those "doctor it hurts when I >do this" bugs.
yes, mostly but not entirely.
Show quoted text
>In the Debian bug you're referring to, there is no explanation as to >why -w flag is required; in what context does this behavior appear?
the original reporter didn't mention their environment, but i've personally run into a few bigger packages that automatically enable warnings (e.g. mojolicious, dancer). anyway, there's a trivial fix (already in the debian version), patch attached. regards az

Message body is not shown because sender requested not to inline it.

-- Alexander Zangerl + GPG Key 0xB963BD5F + http://snafu.priv.at/ RFC1925: "With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead."

Message body not shown because it is not plain text.



This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.