Quoting Johannes 'josch' Schauer (2021-02-24 01:44:00)
> However, with the changes from above commits, the command will succeed.

while it will succeed, it will still not reproduce the desired result. Helmut
and I now have a set of scripts that compare a chroot created with DPKG_ROOT to
one without. With the patch above, the following will be printed when one sets
DEBCONF_DEBUG=developer:

Preparing to unpack .../libc6_2.31-12+dpkgroot1_amd64.deb ...
debconf (developer): frontend started
debconf (developer): Trying to find a templates file..
debconf (developer): Trying 
/tmp/mmdebstrap.Jo8V8wNPO_//var/lib/dpkg/tmp.ci/preinst.templates
debconf (developer): Trying /usr/share/debconf/templates/preinst.templates
debconf (developer): Couldn't find a templates file.
debconf (developer): frontend running, package name is 
debconf (developer): starting 
/tmp/mmdebstrap.Jo8V8wNPO_//var/lib/dpkg/tmp.ci/preinst install

The following patch fixes the situation:

diff -Nru debconf-1.5.75/frontend debconf-1.5.75+nmu1/frontend
--- debconf-1.5.75/frontend     2021-02-28 18:51:28.000000000 +0100
+++ debconf-1.5.75+nmu1/frontend        2021-06-22 13:28:25.000000000 +0200
@@ -44,10 +44,10 @@
        # Avoid spurious title updates with triggered actions:
        $no_title=1 if $action eq 'triggered';
 }
-elsif (-e "/var/lib/dpkg/tmp.ci/control") {
+elsif (-e "$ENV{DPKG_ROOT}/var/lib/dpkg/tmp.ci/control") {
        # The preinst is running, presumably. Now it gets really ugly, because
        # I have to parse the control file.
-       open (CONTROL, "< /var/lib/dpkg/tmp.ci/control")
+       open (CONTROL, "< $ENV{DPKG_ROOT}/var/lib/dpkg/tmp.ci/control")
                || die "Debconf: unable to open control file: $!";
        while (<CONTROL>) {
                if (/^Package: (.*)/) {
EOF

Is it desirable that debconf succeeds even if it cannot find the templates file
and cannot figure out the package name?

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature

Reply via email to