Collector bug found
"Kiss Gabor (Bitman)" <[email protected]> Thu, 26 May 2011 12:28:17 +0200 (CEST)
| Newsgroups | gmane.network.cricket.user |
|---|---|
| Message-ID | <[email protected]> |
Hi guys!
I've just found a bug in collector.
Sometimes the program aborted with this message:
Undefined subroutine &main:: called at /usr/share/cricket/lib/ConfigTree/Cache.pm line 266.
that is
&{$w}("Found unknown tag '$name' during expansion of '$sstr'.");
Variable $w had no value. It should be $self->{"Warn"}.
Now I tracked down what happens.
collector begins with this:
$Common::global::gCT ||= new ConfigTree::Cache;
$gCT = $Common::global::gCT;
$gCT->Base($Common::global::gConfigRoot);
$gCT->Warn(\&Warn); <-------- normal case
[...]
my($recomp, $why) = $gCT->needsRecompile();
if ($recomp) {
Warn("Config tree needs to be recompiled: $why");
system("/usr/bin/cricket-compile " .
"-base $Common::global::gConfigRoot");
$gCT = new ConfigTree::Cache; <---- Ooops! New $gCT has no Warn
$gCT->Base($Common::global::gConfigRoot);
if (! $gCT->init()) {
Die("Failed to open compiled config tree from " .
"$Common::global::gConfigRoot/config.db: $!");
}
}
When some config files were newer than the compiled database,
collector dropped original $gCT object but the new one got no Warn function.
Solution: move $gCT->Warn(\&Warn) below if ($recomp) { }.
Gabor
--
E-mail = m-mail * c-mail ^ 2
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1