[Debconf-devel] Bug#690390: debconf: Use config file defaults instead of cache

Bas Wijnen wijnen at debian.org
Sat Oct 13 16:50:12 UTC 2012


Package: debconf
Version: 1.5.46
Severity: wishlist

Several bugs (for example #684923 and #476946) complain that packages
are using debconf as a registry while it is not. At the Utrecht BSP[1],
we discussed about this and have the following suggestion to improve
debconf, which would fix bugs like these, and improve the user's
experience also for packages which don't have actual bugs.

Debconf has a cache to remember an answer the last time a question was
asked, in order to use that as a default for the next time. Most debconf
answers are also stored in a config file.

This means that the same answer to a question is stored in two places:
the config file, and debconf's cache. Some maintainer scripts seem to
assume that debconf's cache is more important than the configuration
file. This is a bug, summarized as "debconf is not a registry".

In fact, debconf itself suffers from this as well: when a user
reconfigures a package, pressing enter (for the default) on all
questions but the ones that should be changed, the expected outcome
would be that only those configuration options are changed. However, it
uses the values from its cache instead, which means that it will reset
changes which were made manually to the configuration files to their old
values.

The proposed solution is to add functionality to debconf, which can read
and edit config files. Example api:

# Get a value from a config file, using the question's default if the
# value is not in the config file.
db_getconfig [file] [key]
# Edit the config file to hold a new value.
db_setconfig [file] [key] [value]

A problem with this is that debconf will need to know the file format of
the config file. We suggest to solve this pragmatically: Many config
files are either lists of "key = value" pairs (with comments), or ini
files (which are identical, plus titles). Our idea is to implement
support for those in debconf, and allow packages to supply their own
versions of getconfig (which only takes a key from the file and doesn't
do anything with defaults) and setconfig, to support "special" config
files.[2]

The result of this would be that the above problem would be solved;
packages can easily use debconf and the defaults to answers that have
been changed manually in the config file are automatically used.

An example of this (for a very simple config file format) I have
implemented in the maintainer scripts of pioneers-meta-server.

Thanks,
Bas Wijnen

[1] http://wiki.debian.org/BSP/2012/10/nl/Utrecht
[2] The reason for using this functionality even if debconf cannot parse
your config file would be to support future debconf extensions, like
"reset settings to defaults from package".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/debconf-devel/attachments/20121013/b2c09f16/attachment.pgp>


More information about the Debconf-devel mailing list