retitle 502744 mxallowd: broken debconf handling
thanks

On Sun, Oct 19, 2008 at 06:16:40PM +0200, Lucas Nussbaum wrote:
> On 19/10/08 at 17:45 +0200, Michael Stapelberg wrote:

> > I think the problem is that you don't have an interactive terminal so that 
> > you
> > can't answer the debconf questions.

> > I'm not sure how to fix this, if this needs to be fixed. Maybe you have a
> > solution.
> 
> I'm setting the noninteractive debconf frontend. So I'm not presented by
> a question anyway.

Right, this is fully reproducible for me with something like

# env DEBIAN_FRONTEND=noninteractive apt-get install mxallowd

The problem is (from debian/mxallowd.config):

db_get mxallowd/real_mailservers
[ ! -z "$RET" ] && add_entry "real-mailserver" "${RET}"
db_input high mxallowd/fake_mailservers || true

which fails with 'set -e' if RET is empty. 

The simplest fix is to do something like

[ -z "$RET" ] || add_entry "real-mailserver" "${RET}"

instead, which should result in the default config file
on noninteractive installations.

However, there are other problems with the debconf handling too.  First,
it is violating the 'debconf is not a registry' rule: while the maintainer
scripts will write the debconf settings into /etc/mxallowd.conf, the
settings are never read back. If mxallowd.conf is changed manually,
the old debconf settings will override the manual ones. For example,
reinstalling the package will result in the debconf settings overwriting
those in mxallowd.conf.

Please see the section about 'Config file handling' in debconf-devel(7).
This definitely needs to be fixed.

Another problem is that you shouldn't be editing /etc/mxallowd.conf in
the config script.  Quoting debconf-devel(7):

 The config script should not need to modify the filesystem at all. It
 just examines the state of the  system,  and  asks  questions,
 and  debconf stores the answers to be acted on later by the postinst
 script. Conversely, the postinst script should almost never use debconf
 to ask questions, but should instead act on the answers to questions
 asked by the config script.

The config script actually fails when preconfiguring, because it
unconditionally tries to copy /etc/mxallowd.conf when it doesn't exist
yet. However, it succeeds when re-invoked from the postinst, so this
is not really fatal. 
-- 
Niko Tyni   [EMAIL PROTECTED]



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to