SA Bugzilla – Bug 3456
Error in unixlocker awl stat[3] variable not defined.
Last modified: 2006-12-06 08:43:21 UTC
Result: Outputs error message about unable to lock awl file, and then error message about how it is unable to unlock the file. Repro: Debian 2.63-1 local.cf: bayes_learn_to_journal 1 bayes_journal_max_size 5120000 bayes_auto_learn_threshold_nonspam 0.4 bayes_auto_learn_threshold_spam 12 Fix: It appears in the file UnixLocker.pm that the stat[3] array is not defined correctly in some situations, and does not handle situations in which it is not defined. Attached is my attempt at a unified diff to troubleshoot the problem. If stat[3] is not defined, then assume that lockfile was not created. As you well realize, I'm must checking to make sure stat[3] is defined before comparing against it. This patch solves the problem as perl spews out an error message that stat[3] is not defined which can then generates a temporary delivery error, depending on what mta+sa combo you are using. versus 2.63 --- UnixLocker.pm.original Wed Jun 2 11:43:51 2004 +++ UnixLocker.pm Wed Jun 2 11:44:49 2004 @@ -66,6 +66,11 @@ } # link _may_ return false even if the link _is_ created @stat = stat($lock_tmp); + if (!defined ($stat[3])){ + dbg ("lock: $$ link to lock not defined"); + $is_locked=0; + last; + } if ($stat[3] > 1) { dbg("lock: $$ link to $lock_file: stat ok"); $is_locked = 1;
Subject: Re: New: Error in unixlocker awl stat[3] variable not defined. > Outputs error message about unable to lock awl file, and then error message > about how it is unable to unlock the file. What's the exact error message? Also, which version of Perl are you using? Maybe we should review the Locker/UnixNFSSafe.pm code ... again. As far as a patch goes, can you submit a patch against our SVN tree? The license has changed, so we need you to submit a patch against the 3.0 tree.
*** Bug 3458 has been marked as a duplicate of this bug. ***
Created attachment 2019 [details] patch for undefined lock comparison for stat[3]
Created attachment 2020 [details] patch for undefined lock comparison for stat[3]
Trivial fix. If variable stat[3] is not defined assume the lock was not created. Currently it just pukes. Patch attached for 2.63 and 3.0.
That patch is too trivial :) Though the idea behind it is correct. Will attach a cleaner one in a few minutes...
This code was redone a bit for 3.0, the patch as attached won't even apply. Is this still an issue w/ 3.0? I don't see how the stat would fail as coded now.
wow. that code is such a mess...
I actually need a bit more time. Tomorrow is another day...
move bug to Future milestone (previously set to Future -- I hope)
applied an alternative fix in r483140; it is more appropriate to retry again in that situation.