Skip Menu |

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

Report information
The Basics
Id: 53716
Status: resolved
Priority: 0/
Queue: Proc-PID-File

People
Owner: Nobody in particular
Requestors: CYGA [...] cpan.org
Cc:
AdminCc:

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



Subject: wrong sysopen result checking
Proc::PID::File $VERSION = "1.27"; You have following code in sub read: --cut sysopen $fh, $self->{path}, O_RDWR|O_CREAT || die qq/Cannot open pid file "$self->{path}": $!\n/; --copy which must be changed to smth like: --cut sysopen( $fh, $self->{path}, O_RDWR|O_CREAT ) || die qq/Cannot open pid file "$self->{path}": $!\n/; --copy You can see following output from debugger which shows it's working incorrectly: --cut DB<3> c 27 main::(s3-upload-cleaner.pl:27): if(Proc::PID::File->running()) { DB<4> s Proc::PID::File::running(/data_miner/lib/common/Proc/PID/File.pm:86): 86: $self = shift->new(@_); DB<4> n Proc::PID::File::running(/data_miner/lib/common/Proc/PID/File.pm:88): 88: local *FH; DB<4> n Proc::PID::File::running(/data_miner/lib/common/Proc/PID/File.pm:89): 89: my $pid = $self->read(*FH); DB<4> s Proc::PID::File::read(/data_miner/lib/common/Proc/PID/File.pm:280): 280: my ($self, $fh) = @_; DB<4> n Proc::PID::File::read(/data_miner/lib/common/Proc/PID/File.pm:282): 282: sysopen $fh, $self->{path}, O_RDWR|O_CREAT 283: || die qq/Cannot open pid file "$self->{path}": $!\n/; DB<4> n Proc::PID::File::read(/data_miner/lib/common/Proc/PID/File.pm:284): 284: flock($fh, LOCK_EX | LOCK_NB) 285: || die qq/pid "$self->{path}" already locked: $!\n/; DB<4> x $! 0 'Permission denied' --copy Now fixed version: --cut main::(s3-upload-cleaner.pl:27): if(Proc::PID::File->running()) { DB<7> s Proc::PID::File::running(/data_miner/lib/common/Proc/PID/File.pm:86): 86: $self = shift->new(@_); DB<7> n Proc::PID::File::running(/data_miner/lib/common/Proc/PID/File.pm:88): 88: local *FH; DB<7> n Proc::PID::File::running(/data_miner/lib/common/Proc/PID/File.pm:89): 89: my $pid = $self->read(*FH); DB<7> s Proc::PID::File::read(/data_miner/lib/common/Proc/PID/File.pm:280): 280: my ($self, $fh) = @_; DB<7> n Proc::PID::File::read(/data_miner/lib/common/Proc/PID/File.pm:282): 282: sysopen( $fh, $self->{path}, O_RDWR|O_CREAT ) 283: || die qq/Cannot open pid file "$self->{path}": $!\n/; DB<7> n Cannot open pid file "/var/run/s3-upload-cleaner.pl.pid": Permission denied at /data_miner/lib/common/Proc/PID/File.pm line 282 Proc::PID::File::read('Proc::PID::File=HASH(0x22769a8)', '*Proc::PID::File::FH') called at /data_miner/lib/common/Proc/PID/File.pm line 89 Proc::PID::File::running('Proc::PID::File') called at s3-upload- cleaner.pl line 27 Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<7> --copy
well, that's a rather embarrassing bug. thanks for pointing it out and fixing it. the patch will be included in the next release.