Subject: | bug in LockDir.pm? |
Date: | Wed, 5 Feb 2014 15:07:21 +0000 |
To: | "bug-file-lockdir [...] rt.cpan.org" <bug-file-lockdir [...] rt.cpan.org> |
From: | "Kerich, John T. (GSFC-444.0)[COLUMBUS TECHNOLOGIES AND SERVICES INC]" <john.t.kerich [...] nasa.gov> |
Own I&T people were testing the file lock logic path and created a "fake" mms_EftaDailyLog.log.LOCKDIR directory. In the directory they then touch owner so it's an empty file. When the script tried to create the lock directory the following happened:
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
returns (my debug stuff)
end if (my debug stuff)
I expected that the eval would have capture any the error message, it was not set. In the perl -d mode I see the error stack being dumped out.
eval {...} called at eftaCron.pl line 717
main::dailyStatus('/mms/am1/dev2/config/eftaCronAM1OPS.cnfg') called at eftaCron.pl line 273
main::executeType('DAILY_STATUS', '/mms/am1/dev2/config/eftaCronAM1OPS.cnfg') called at eftaCron.pl line 3308
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98
File::LockDir::_readlock('File::LockDir=HASH(0xf31d760)', '/mms/am1/dev2/efta/mms_EftaDailyLog.log.LOCKDIR') called at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 138
File::LockDir::nflock('File::LockDir=HASH(0xf31d760)', '/mms/am1/dev2/efta/mms_EftaDailyLog.log', 45, 'mms_dev', 'lomvsrv01') called at eftaCron.pl line 717
eval {...} called at eftaCron.pl line 717
main::dailyStatus('/mms/am1/dev2/config/eftaCronAM1OPS.cnfg') called at eftaCron.pl line 273
main::executeType('DAILY_STATUS', '/mms/am1/dev2/config/eftaCronAM1OPS.cnfg') called at eftaCron.pl line 3308
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98.
at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 98
File::LockDir::_readlock('File::LockDir=HASH(0xf31d760)', '/mms/am1/dev2/efta/mms_EftaDailyLog.log.LOCKDIR') called at /usr/lib/perl5/site_perl/5.8.8/File/LockDir.pm line 138
File::LockDir::nflock('File::LockDir=HASH(0xf31d760)', '/mms/am1/dev2/efta/mms_EftaDailyLog.log', 45, 'mms_dev', 'lomvsrv01') called at eftaCron.pl line 717
The $lock_status also not set to anything (defined ($lock_status) prints blank so it not set to undef either) and the $lock_status is set to blank too. The "if (! $lock_status)" check fails the call ok so I know it didn't work but the documentation indicates it should have been set to false, not blank.
===============
code is:
===============
my ($lock_status, $lockee);
eval { ($lock_status, $lockee) = $G_LockDir{locker}->nflock( $G_LockDir{lockFile}, $G_LockDir{stdLockTimeout}, $G_LockDir{stdLockUser}, hostname); };
prints "returns $@ \n";
if ( $@ ) {
print "error path";
note ("eftaCron::sendEmail", __LINE__, SEVERITY_CRITICAL, "Call to nflock died: " . $@ );
$Status = 1;
next SUBSYS;
}
print "end if\n";
if (! $lock_status) {
note ("eftaCron::dailyStatus", __LINE__, SEVERITY_CRITICAL, "Couldn't lock file $dailyLog\nSkipping email of $dailyLog");
$Status = 1;
next SUBSYS;
}
if (! -e $dailyLog) {
#Well the daily log file doesn't exist someone else emailed it or there has been no action
$G_LockDir{locker}->nunflock($G_LockDir{lockFile});
$G_LockDir{lockFile} = undef;
next SUBSYS;
}
So,
1) Why is $lock_status not set to 0 on failure?
2) Why is $@ not set to an error message, your module knows it failing after all.
3) Are these bugs or what you wanted to do? If so, why does the documentation not say how your function really is handling errors? You should add some example code for errors.
John T. Kerich
Columbus Technologies and Services, Inc
Nasa GSFC
Building 13 Room 141 Cube 4
8800 Greenbelt Road
Greenbelt, MD 20771
Tel. #: (301) 286-5138
Fax #: (301) 286-7475
Email: john.t.kerich@nasa.gov<mailto:john.t.kerich@nasa.gov>
Message body is not shown because it is too large.