[Debconf-devel] Bug#560317: dpkg-reconfigure does not set DPKG_MAINTSCRIPT_PACKAGE (et al)
Colin Watson
cjwatson at debian.org
Fri Mar 9 14:41:30 UTC 2012
On Fri, Aug 05, 2011 at 09:57:33PM +0200, Raphael Hertzog wrote:
> On Fri, 05 Aug 2011, Joey Hess wrote:
> > * Nobody has ever addressed my concern that, if dpkg-reconfigure runs
> > dpkg --configure --pending, this will result in it confusingly doing
> > other things than configuring the specified package.
>
> I believe this should simply be documented. I rarely run dpkg-reconfigure
> on a system that's not "clean" from an installation point of view.
>
> But if you really want to try to limit the side effects then you can compare
> the status of all packages before and after having run the scripts and decide
> whether or not you have to run it. You could also try to configure only the
> affected packages but since triggers processing can activate other triggers,
> you might have to fallback to --configure --pending anyway if it turns out
> it was not enough.
I would add a couple of things:
* There's nothing stopping a package using 'dpkg-trigger
--by-package=PACKAGE' in its postinst right now (it's redundant but
permissible), so we might well have this problem already even without
setting these environment variables. Fundamentally since we're
running the postinst by hand it seems as though we're responsible for
cleaning up after it too.
* There already exist packages which test for DEBCONF_RECONFIGURE or
DPKG_RUNNING_VERSION or some such before running dpkg-trigger, and if
set they just perform the action immediately rather than triggering.
That won't be broken by this change, and at least in the case of
self-triggers it's a perfectly reasonable package-level approach.
(Many non-self-triggers are guarded by version checks anyway which
won't fire on reconfigure, such as the perl-major-upgrade one.)
* The dpkg-maintscript-helper issue seems more pressing to me right now
than the dpkg-trigger one, since .maintscript files (for which I
added support to dh_installdeb a while back without thinking about
this bug) are becoming more popular and will cause this kind of
problem. But I agree that we at least need not to make matters worse
regarding dpkg-trigger.
* I do tend to agree with Joey that 'dpkg --configure --pending' seems
a little bit over the top.
I applied Raphaël's first two patches to a local branch, fixed up a
couple of typos in the second, and added a patch of my own which
calculates the set of packages with newly pending triggers after running
maintainer scripts and configures them until there are no newly pending
triggers. This seems to behave well for me and doesn't seem too
unreasonable a solution, particularly since you get "Processing triggers
for PACKAGE ..." at the top of the output from dpkg so it's clear what's
happening. The result of this work is attached, minus changelog which I
can write up if this is acceptable.
Joey, would you be OK with this approach?
Thanks,
--
Colin Watson [cjwatson at debian.org]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Set-environment-variables-expected-by-maintainer-scr.patch
Type: text/x-diff
Size: 1250 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debconf-devel/attachments/20120309/ef0c4d3d/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Do-not-hardcode-the-path-of-maintainer-scripts.patch
Type: text/x-diff
Size: 2627 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debconf-devel/attachments/20120309/ef0c4d3d/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Process-any-newly-pending-triggers-after-running-mai.patch
Type: text/x-diff
Size: 1694 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debconf-devel/attachments/20120309/ef0c4d3d/attachment-0002.patch>
More information about the Debconf-devel
mailing list