Kiss Gabor (Bitman)
2011-05-26 10:28:17 UTC
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
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
E-mail = m-mail * c-mail ^ 2