Paul Slootman <[EMAIL PROTECTED]> wrote:

> On Wed 07 Sep 2005, Frank Küster wrote:
>> 
>> /etc/cron.d/wwwoffle contains:
>> 
>> # If you want to disable this, comment out the line
>> # below (don't simply remove this file).
>
> Note also that your subject is incorrect, it is *not* marked a conffile.
> It's not even shipped with the package.

Sorry, you are right, the subject should have "configuration file".  But
that doesn't make the bug any less severe.

> That same paragraph also states:
>
> ,---
> | If the existence of a file is required for the package to be sensibly
> | configured it is the responsibility of the package maintainer to
> | provide maintainer scripts which correctly create, update and maintain
> | the file and remove it on purge.
> `---

And if this conflicts with the "preserve local changes" requirement, the
usual, policy-compliant way to solve this is to let the postinst script
fail with a clear, understandable error message, ideally via debconf, so
that it can be translated easily.

However, this doesn't apply here, since the existence of the cron job is
not required to use wwwoffle.  Which is written in the file itself: It
already assumes that people might want to disable it.

> If you enter a value via the debconf dialog that indicates that wwwoffle
> should regularly fetch its list, then why remove the cron.d entry...

Because debconf is not a registry.  It's a frontend for maintainer
scripts to interact with local admins, but the actuall *settings* are
stored in /etc/.

> If I left that file alone when someone removed it, I'd get critical bug
> reports that the functionality is broken because even after repeated
> dpkg-reconfigure attempts at entering a fetch frequency, it doesn't
> fetch anything.

If that happens, you didn't write the config script as debconf-devel
advices.  The way to go is to parse the configuration (does the file
exist? If yes, which interval does it specify?) and put these values
into the debconf database via db_set, then ask the questions, then in
postinst db_get the answers and make the changes, if needed.  This is
all described in debconf-devel(7), under "Config file handling".

> Please tell me how I should resolve this dilemma. Please don't just say
> "if it's removed, don't recreate it"; give me some pseudo-code on how to
> handle the different situations.  I find it difficult to distinguish the
> following two situations:
>
> - wwwoffle is freshly installed, there is and has never been a
>   /etc/cron.d/wwwoffle file, and the user runs dpkg-reconfigure and
>   enters a fetch frequency.

This case can easily be distinguished because, like a postinst, config
gets a second parameter which is the version number of the
last-configured (i.e. the currently installed) package.  If it's a fresh
install, $2 is empty.

I'd offer to write a patch if you don't want to, or don't have time to
dig into this.

Regards, Frank

-- 
Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX)


Reply via email to