Bug#1110873: dpkg: DPKG_ROOT documentation unexpectedly mentions instdir

Ferenc Wágner <[email protected]>
Newsgroups gmane.linux.debian.devel.dpkg.bugs
Message-ID <[email protected]>
Guillem Jover <[email protected]> writes:

> On Mon, 2025-08-11 at 22:10:34 +0200, Ferenc Wágner wrote:
>
>> "man dpkg" says:
>> 
>>   DPKG_ROOT
>>       [...] When installing packages into a different instdir, dpkg
>>       normally invokes maintainer scripts using chroot(2) and leaves
>>       this variable empty, but if --force-script-chrootless is specified
>>       then the chroot(2) call is skipped and instdir is non-empty.
>> 
>> The above would make more sense to me if the "instdir" reference in the
>> last line was "DPKG_ROOT", so I suspect a typo here.  Please fix the
>> documentation or my confusion.
>
> This would be the directory that is being set when using --instdir,
> which --root ends up setting as well as --admindir.
>
> Perhaps if that read closer to `--instdir` that would have been more
> clear?

Hi Guillem,

What I miss here is when dpkg sets the DPKG_ROOT variable to something
non-empty.  From the text I understand that dpkg sets DPKG_ROOT to the
empty string when --root and --instdir are not set (so "normally").
Furthermore, dpkg also sets DPKG_ROOT to the empty string when --root or
--instdir is set, *unless* --force-script-chrootless is also specified
(because the maintainer scripts are run in a chroot then).  So it would
seem sensible if dpkg set DPKG_ROOT to the value of --instdir (or
--root) if either of them is specified, *and* --force-script-chrootless
is also specified.  But the text does not say that, instead it contrasts
DPKG_ROOT being empty with instdir being non-empty.  This is unexpected,
and I don't even understand instdir in the "Internal environment"
context where this paragraph resides.

I'm not sure I managed to express my difficulty any better now...
-- 
Thanks,
Feri.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.