Re: dpkg-trigger complains at dpkg-reconfigure time
On Fri, 2009-12-11 at 08:31:26 +0100, Raphael Hertzog wrote:
> On Thu, 10 Dec 2009, Joey Hess wrote:
> > Raphael Hertzog wrote:
> > > Because the postinst is called by dpkg-reconfigure (of debconf) and it
> > > doesn't set the same environment variables that dpkg does set when
> > > it calls the postinst by itself. In particular DPKG_MAINTSCRIPT_PACKAGE
> > > is missing.
> > >
> > > (dpkg does also set DPKG_MAINTSCRIPT_ARCH and DPKG_RUNNING_VERSION)
> > >
> > > It's a bug in dpkg-reconfigure, please file it or reassign.
> > Does it actually make sense for dpkg-trigger to see those environment
> > variables when the postinst is not being run by dpkg?
Well I guess ideally no one but dpkg should be running the maintainer
scripts. Meanwhile, I'd say yes, although it does not seem appropriate
for anyone except dpkg itself to set DPKG_RUNNING_VERSION, the others
seem perfectly fine to me. OTOH dpkg-reconfigure is doing stuff that
dpkg itself should be doing somehow, but until it does we might want
to consider it part of dpkg.
This gives me even more reasons to think that at some point in the
future we should really move dpkg-reconfigure into dpkg.
> > Seems possible that any deferred trigger processing it then sets up
> > will not take effect until the next dpkg run, which could be well
> > after dpkg-reconfigure finishes.
> > Perhaps dpkg-reconfigure needs to call dpkg --configure --pending ?
> Indeed, it's probably a good idea. Or maybe: "dpkg --triggers-only
> --pending" (but reading the doc I'm not sure if --configure is not
> Guillem, does --triggers-only bring the package back to configured
> if they were in that state before the trigger registration ?
“--triggers-only --pending” might leave packages in triggers states,
so yes just “--configure --pending” should do it. BTW, this is
documented in dpkg(1).