FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian dpkg

 
 
LinkBack Thread Tools
 
Old 08-05-2011, 04:50 PM
Joey Hess
 
Default dpkg-reconfigure does not set DPKG_MAINTSCRIPT_PACKAGE (et al)

I keep seeing people complain that this bug is not fixed, but every
time I look at it, I find myself unable to fix it, and with issues like
these:

* Where are these variables documented?
(Appears that they're basically not, which makes it sorta hard to
know that they are being set, or used, as intended.)

* How is debconf supposed to set DPKG_MAINTSCRIPT_ARCH? If it has to call
dpkg --print-architecture every time, that just makes every run slower,
which would seem to be the opposite of the point of having such a
variable in the first place. But it cannot be that simple anyway, with
multiarch. What uses DPKG_MAINTSCRIPT_ARCH anyway?

* What should DPKG_MAINTSCRIPT_NAME be set to when the config script
is being run?

* How is it appropriate for dpkg-maintscript-helper etc to be already using
these variables when debconf is not yet setting them? Would it make
more sense for dpkg-reconfigure to not set them, and
dpkg-maintscript-helper etc to be a no-op when a package is being
reconfigured?

* 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.

--
see shy jo
 
Old 08-05-2011, 06:46 PM
Guillem Jover
 
Default dpkg-reconfigure does not set DPKG_MAINTSCRIPT_PACKAGE (et al)

Hi!

On Fri, 2011-08-05 at 12:50:22 -0400, Joey Hess wrote:
> I keep seeing people complain that this bug is not fixed, but every
> time I look at it, I find myself unable to fix it, and with issues like
> these:
>
> * Where are these variables documented?
> (Appears that they're basically not, which makes it sorta hard to
> know that they are being set, or used, as intended.)

man dpkg (ENVIRONMENT section).

> * How is debconf supposed to set DPKG_MAINTSCRIPT_ARCH? If it has to call
> dpkg --print-architecture every time, that just makes every run slower,
> which would seem to be the opposite of the point of having such a
> variable in the first place. But it cannot be that simple anyway, with
> multiarch. What uses DPKG_MAINTSCRIPT_ARCH anyway?

That variable should match the architecture of the owning package not
the one of dpkg itself. The dpkg database should have knowledge about
this, as the script is already using dpkg --status getting the
Architecture should be trivial. The variable makes it easier to share
the same unmodified maintainer script for multiple architectures, of
course another solution would be to substitute it at build time from
a template or similar.

> * What should DPKG_MAINTSCRIPT_NAME be set to when the config script
> is being run?

config or postinst, depending on what's being called.

> * How is it appropriate for dpkg-maintscript-helper etc to be already using
> these variables when debconf is not yet setting them? Would it make
> more sense for dpkg-reconfigure to not set them, and
> dpkg-maintscript-helper etc to be a no-op when a package is being
> reconfigured?

Well I guess it can be argued that's the problem with external programs
using the dpkg namespace and using internal interfaces. Regardless, we
should take another look at trying to merge dpkg-reconfigure back somehow.

I think the scripts should behave the same whenever they are being
called.

> * 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 don't remember what this is about, will check the bug report later.

regards,
guillem


--
To UNSUBSCRIBE, email to debian-dpkg-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110805184633.GA18587@gaara.hadrons.org">http://lists.debian.org/20110805184633.GA18587@gaara.hadrons.org
 
Old 08-05-2011, 07:57 PM
Raphael Hertzog
 
Default dpkg-reconfigure does not set DPKG_MAINTSCRIPT_PACKAGE (et al)

Hi Joey,

On Fri, 05 Aug 2011, Joey Hess wrote:
> I keep seeing people complain that this bug is not fixed, but every
> time I look at it, I find myself unable to fix it, and with issues like
> these:

Thanks for looking into it!

> * Where are these variables documented?
> (Appears that they're basically not, which makes it sorta hard to
> know that they are being set, or used, as intended.)

man dpkg

ENVIRONMENT
[...]
DPKG_MAINTSCRIPT_PACKAGE
Defined by dpkg on the maintainer script environment to the package
name being handled.

DPKG_MAINTSCRIPT_ARCH
Defined by dpkg on the maintainer script environment to the architec-
ture the package got built for.

DPKG_MAINTSCRIPT_NAME
Defined by dpkg on the maintainer script environment to the name of
the script running (preinst, postinst, prerm, postrm).

> * How is debconf supposed to set DPKG_MAINTSCRIPT_ARCH? If it has to call
> dpkg --print-architecture every time, that just makes every run slower,
> which would seem to be the opposite of the point of having such a
> variable in the first place. But it cannot be that simple anyway, with
> multiarch. What uses DPKG_MAINTSCRIPT_ARCH anyway?

Nothing uses DPKG_MAINTSCRIPT_ARCH yet, to the best of my knowledge. It has been
introduced for completeness in the multiarch world because DPKG_MAINTSCRIPT_PACKAGE
might not be enough to precisely identify the package in the case of Multi-Arch:
same packages.

The goal of this variable was definitely not to be a cache for "dpkg
--print-architecture". It should be set to the architecture of the package
(i.e. it can be "all" too).

So really the value you want is:
"dpkg -s <package-typed-by-user> | awk '/^Architecture: / { print $2 }'"
(you're already querying dpkg -s so it's fine to extract it too)

BTW, for multiarch compliance you should use "dpkg-query --control-path
<package-typed-by-user> postinst" to find out the path of the postinst script
(and similar for the config script).

I have attached 3 patches, you should consider at least the first two.
(Not tested though)

> * What should DPKG_MAINTSCRIPT_NAME be set to when the config script
> is being run?

"config" should be fine.

> * How is it appropriate for dpkg-maintscript-helper etc to be already using
> these variables when debconf is not yet setting them? Would it make
> more sense for dpkg-reconfigure to not set them, and
> dpkg-maintscript-helper etc to be a no-op when a package is being
> reconfigured?

I'm not sure we can answer this in the same way for all dpkg-maintscript-helper
sub-commands (existing and to come). Thus I prefer the statu quo over
arbitrarily deciding that being a no-op is ok when its action might be required
by something that happened earlier in the postinst.

> * 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.

Cheers,
--
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
▶ http://RaphaelHertzog.fr (Français)
 

Thread Tools




All times are GMT. The time now is 07:07 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org