Package: debconf
Version: 1.5.84
Severity: normal
X-Debbugs-Cc: j...@joshtriplett.org

I'm building a system for remotely running noninteractive commands. That
system lets people run commands like `apt-get install xyz` to install
packages, but it by design has no specific knowledge of any software
like apt or dpkg (and thus *cannot* set things like
DEBIAN_FRONTEND=noninteractive for the user).

I run commands with stdout/stderr connected to a socket, and stdin
connected to /dev/null, since all commands are non-interactive and can
receive no input. Generally, this results in software noticing that it
cannot get input, and handling that.

In a recent attempt to install a package, tzdata got pulled in as a
dependency, resulting in this:

```
Setting up tzdata (2021a-1+deb11u11) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring tzdata
------------------

Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.

  1. Africa   3. Antarctica  5. Arctic  7. Atlantic  9. Indian    11. US
  2. America  4. Australia   6. Asia    8. Europe    10. Pacific  12. Etc
```

And then the command hung, fruitlessly attempting to wait for input that
will never arrive.

debconf should detect if reading from stdin produces EOF (a zero-byte
read, e.g. because it's /dev/null), and automatically switch to a
noninteractive mode, rather than hanging.

(In an ideal world, I'd also say that debconf should do this anytime its
stdin is not a tty and it doesn't explicitly have a non-tty-requiring
frontend set, rather than falling back to "readline" on a non-terminal,
but I understand if this is historical behavior that'd be difficult to
change for compatibility reasons. Dealing with EOF on stdin better would
be the next best thing.)


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: arm64

Kernel: Linux 6.6.11-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

debconf depends on no packages.

Versions of packages debconf recommends:
ii  apt-utils     2.7.10
pn  debconf-i18n  <none>

Versions of packages debconf suggests:
pn  debconf-doc                <none>
pn  debconf-kde-helper         <none>
pn  debconf-utils              <none>
ii  libgtk3-perl               0.038-3
pn  libnet-ldap-perl           <none>
pn  libterm-readline-gnu-perl  <none>
ii  perl                       5.38.2-3
ii  whiptail                   0.52.24-2

-- debconf information excluded

Reply via email to