[Debconf-devel] Bug#457271: Debconf::DbDriver incorrectly looks up the template for a question

Steven McDonald steven at steven-mcdonald.id.au
Tue Apr 29 06:09:42 UTC 2014


Hi there,

This problem seems to happen when using the 'stack' driver because
Debconf::DbDriver uses $this->getfield to look up the template for a
given question. Consider the following scenario:

 - /etc/debconf.conf sets up the config database as a stack consisting
   of 'foo' and 'bar'.

 - 'bar' contains an answer to question 'mypackage/tweakable', but does
   not contain the 'seen' flag.

 - A package maintainer script prompts the user for an answer to
   'mypackage/tweakable', and the user chooses a different answer to
   what is in 'bar'.

 - 'foo' has 'Reject-Type: password' set, so on line 207 of
   Debconf/DbDriver.pm, we enter the conditional block and try to find
   the type of 'mypackage/tweakable'.

 - Because 'foo' (referred to by '$this') has no answer to
   'mypackage/tweakable', there is no record of a template for it, and
   so 'Debconf::Template->get' is called with an empty argument (the
   result of '$this->getfield'). This produces the warnings shown in the
   original bug report.

The problem here is that $this refers to 'foo', not the stacked
database on top of 'foo', and thus the record in 'bar' is never
consulted.

I am attaching a patch which fixes this problem by calling 'getfield'
on $Debconf::Db::config rather than $this. This will do a full search
through the config database for a template for the question, which
makes things work correctly with stacked databases.

Please let me know if you need any further information, or if you think
this can be done in a better way.

Thanks,
Steven.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: search_config_for_template.patch
Type: text/x-patch
Size: 1354 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debconf-devel/attachments/20140429/3aff76e0/attachment.bin>


More information about the Debconf-devel mailing list