On Wed, 22 May 2019 23:36:43 -0400 (EDT) Anders Kaseorg <ande...@mit.edu> wrote: > When building a Debian- or Ubuntu-based Docker container, installing > perl (so that Term::Readline is available) and a package that asks a > Debconf question causes the build to freeze with an interactive readline > prompt that cannot be answered: > ... > Docker builds are noninteractive, of course, and stdin is connected to > /dev/null. What seems to have happened here is that apt created a pty and > connected stdout and stderr to it, but left stdin connected to /dev/null. > The Readline frontend checked that there’s a controlling tty (there is), > but failed to check that stdin is a tty (it’s not). So it proceeded to > wait for input from a tty that will never provide it. > > (Obviously one can set DEBIAN_FRONTEND=noninteractive as a workaround, but > that shouldn’t be necessary, and is in fact discouraged: > https://docs.docker.com/engine/faq/#why-is-debian_frontendnoninteractive-discouraged-in-dockerfiles > > because it’s often set in ways that persist for longer than intended.)
Friendly ping? :) Would it be helpful if someone were to make the attached patch into a Merge Request on Salsa for easier review? As a bit of added versioning information, this affects Debian Stretch (1.5.61) and newer, but Debian Jessie (1.5.56+deb8u1) is unaffected (and over in Ubuntu land, Xenial is unaffected at 1.5.58ubuntu2, but Bionic at 1.5.66ubuntu1 and newer *is* affected). I'm not sure what changed this behavior between Jessie and Stretch (possibly something outside the debconf package?), but the relevant debdiff for debconf is relatively small (~400 lines if one excludes translation updates), so I've attached that here in case it's helpful. ♥, - Tianon 4096R / B42F 6819 007F 00F8 8E36 4FD4 036A 9C25 BF35 7DD4
diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/bash_completion debconf-1.5.61/bash_completion --- debconf-1.5.56+deb8u1/bash_completion 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/bash_completion 2015-11-07 19:17:02.000000000 -0800 @@ -1,4 +1,4 @@ -have debconf-show && +_have debconf-show && _debconf_show() { local cur diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/Debconf/Config.pm debconf-1.5.61/Debconf/Config.pm --- debconf-1.5.56+deb8u1/Debconf/Config.pm 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/Debconf/Config.pm 2015-07-12 10:35:31.000000000 -0700 @@ -59,7 +59,7 @@ my $text=shift; my $hash=shift; - $text =~ s/\${([^}]+)}/$ENV{$1}/eg; + $text =~ s/\$\{([^}]+)\}/$ENV{$1}/eg; my %ret; my $i; diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/Debconf/Element/Editor/Multiselect.pm debconf-1.5.61/Debconf/Element/Editor/Multiselect.pm --- debconf-1.5.56+deb8u1/Debconf/Element/Editor/Multiselect.pm 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/Debconf/Element/Editor/Multiselect.pm 2015-11-07 18:11:17.000000000 -0800 @@ -13,7 +13,7 @@ =head1 DESCRIPTION -Presents a list of choices to be selected amoung. Multiple selection is +Presents a list of choices to be selected among. Multiple selection is allowed. =head1 METHODS diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/Debconf/Element/Editor/Select.pm debconf-1.5.61/Debconf/Element/Editor/Select.pm --- debconf-1.5.56+deb8u1/Debconf/Element/Editor/Select.pm 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/Debconf/Element/Editor/Select.pm 2015-11-07 18:11:19.000000000 -0800 @@ -13,7 +13,7 @@ =head1 DESCRIPTION -Presents a list of choices to be selected amoung. +Presents a list of choices to be selected among. =head2 METHODS diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/Debconf/Element/Teletype/Boolean.pm debconf-1.5.61/Debconf/Element/Teletype/Boolean.pm --- debconf-1.5.56+deb8u1/Debconf/Element/Teletype/Boolean.pm 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/Debconf/Element/Teletype/Boolean.pm 2015-11-07 18:36:34.000000000 -0800 @@ -40,6 +40,13 @@ $default=$n; } + # If this is not terse mode, we want to print out choices. Since we + # only have two choices, though, we use a compact display format. + my $description=$this->question->description; + if (Debconf::Config->terse eq 'false') { + $description.=" [$y/$n]"; + } + my $value=''; while (1) { @@ -47,7 +54,7 @@ $_=$this->frontend->prompt( default => $default, completions => [$y, $n], - prompt => $this->question->description, + prompt => $description, question => $this->question, ); return unless defined $_; diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/Debconf/FrontEnd/Readline.pm debconf-1.5.61/Debconf/FrontEnd/Readline.pm --- debconf-1.5.56+deb8u1/Debconf/FrontEnd/Readline.pm 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/Debconf/FrontEnd/Readline.pm 2015-11-07 18:17:49.000000000 -0800 @@ -27,7 +27,7 @@ =item promptdefault -Set if the varient of readline being used is so lame that it cannot display +Set if the variant of readline being used is so lame that it cannot display defaults, so the default must be part of the prompt instead. =back @@ -172,7 +172,7 @@ The function uses named parameters. -Completion amoung available choices is supported. For this to work, if +Completion among available choices is supported. For this to work, if a reference to an array of all possible completions is passed in. =cut diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/Debconf/Question.pm debconf-1.5.61/Debconf/Question.pm --- debconf-1.5.56+deb8u1/Debconf/Question.pm 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/Debconf/Question.pm 2015-07-12 10:35:14.000000000 -0700 @@ -132,7 +132,7 @@ my $variable; my $varval; my $escape; - while ($rest =~ m/^(.*?)(\\)?\${([^{}]+)}(.*)$/sg) { + while ($rest =~ m/^(.*?)(\\)?\$\{([^{}]+)\}(.*)$/sg) { $result.=$1; # copy anything before the variable $escape=$2; $variable=$3; diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/Debconf/Template.pm debconf-1.5.61/Debconf/Template.pm --- debconf-1.5.56+deb8u1/Debconf/Template.pm 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/Debconf/Template.pm 2015-07-12 17:13:40.000000000 -0700 @@ -76,10 +76,15 @@ if ($Debconf::Db::templates->exists($template) and $Debconf::Db::templates->owners($template)) { # If a question matching this template already exists in - # the db, add the owner to it. This handles shared owner - # questions. - my $q=Debconf::Question->get($template); - $q->addowner($owner, $type) if $q; + # the db, add the owner to it; otherwise, create one. This + # handles shared owner questions. + if ($Debconf::Db::config->exists($template)) { + my $q=Debconf::Question->get($template); + $q->addowner($owner, $type) if $q; + } else { + my $q=Debconf::Question->new($template, $owner, $type); + $q->template($template); + } # See if the template claims to own any questions that # cannot be found. If so, the db is corrupted; attempt to diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/debian/changelog debconf-1.5.61/debian/changelog --- debconf-1.5.56+deb8u1/debian/changelog 2017-06-17 04:27:16.000000000 -0700 +++ debconf-1.5.61/debian/changelog 2017-05-21 10:08:30.000000000 -0700 @@ -1,10 +1,57 @@ -debconf (1.5.56+deb8u1) jessie; urgency=medium +debconf (1.5.61) unstable; urgency=medium [ Niko Tyni ] * Use File::Temp instead of the deprecated POSIX::tmpnam() in Debconf::TmpFile (closes: #863071). - -- Colin Watson <cjwat...@debian.org> Sat, 17 Jun 2017 12:27:07 +0100 + -- Colin Watson <cjwat...@debian.org> Sun, 21 May 2017 18:08:30 +0100 + +debconf (1.5.60) unstable; urgency=medium + + [ Christian Perrier ] + * French manpages translation. Thanks to Baptiste Jammet. + Closes: #849394 + + -- Colin Watson <cjwat...@debian.org> Fri, 20 Jan 2017 12:58:59 +0000 + +debconf (1.5.59) unstable; urgency=medium + + * Use HTTPS for Vcs-* URLs, and link to cgit rather than gitweb. + * Set source format to 3.0 (native). + * frontend: Load templates when we're being run from any maintainer + script, not just preinst/postinst (closes: #817083). + + -- Colin Watson <cjwat...@debian.org> Fri, 11 Mar 2016 10:59:28 +0000 + +debconf (1.5.58) unstable; urgency=medium + + * Don't update po/debconf.pot unless doing so changes something other than + the POT-Creation-Date header. The basic approach here is from gettext, + though implemented a bit more simply since we can assume perl. + * Show choices for teletype/readline boolean questions (closes: #802840). + * Move bash completion file to /usr/share/bash-completion/completions/. + + -- Colin Watson <cjwat...@debian.org> Sun, 08 Nov 2015 03:27:10 +0000 + +debconf (1.5.57) unstable; urgency=medium + + [ Colin Watson ] + * Drop alternative Suggests on gnome-utils (closes: #792219). It hasn't + existed since squeeze, it dropped gdialog in 2003, and debconf only + supported gdialog for about three weeks in 1999 anyway. + * Escape braces in regexes to avoid deprecation warning with Perl 5.22 + (closes: #786705). + * When creating a new template and finding that it already exists in the + database, ensure that a question of the same name exists too (closes: + #518322, #779920). + + [ Jérémy Bobbio ] + * Use UTC when running xgettext for build reproducibility. Closes: #783255 + + [ Debconf translations ] + * Brazilian Portuguese (Adriano Rafael Gomes). Closes: #785464 + + -- Colin Watson <cjwat...@debian.org> Thu, 16 Jul 2015 12:33:36 +0100 debconf (1.5.56) unstable; urgency=medium @@ -2036,7 +2083,7 @@ debconf (1.4.30) unstable; urgency=low * Fix and update German translation. Thanks, Michael Piefel. Closes: #260572 - * Update Basque templates translation. Thanks, Piarres Beobide Egaña. + * Update Basque templates translation. Thanks, Piarres Beobide Egaña. Closes: #260678 -- Joey Hess <jo...@debian.org> Sat, 24 Jul 2004 02:41:35 -0400 @@ -2069,7 +2116,7 @@ debconf (1.4.26) unstable; urgency=low - * Add Basqe translation by Piarres Beobide Egaña. Closes: #247321 + * Add Basqe translation by Piarres Beobide Egaña. Closes: #247321 * German translation update. Closes: #251731 * Catalan translation update. Closes: #251786 * Remove soi-unsightly trailing blanks in debconf-show output. @@ -2567,7 +2614,7 @@ debconf (1.2.40) unstable; urgency=low - * Spanish translation update from Carlos Valdivia Yagüe. Closes: #196672 + * Spanish translation update from Carlos Valdivia Yagüe. Closes: #196672 -- Joey Hess <jo...@debian.org> Mon, 9 Jun 2003 12:44:13 -0400 @@ -2937,7 +2984,7 @@ debconf (1.1.29) unstable; urgency=low * Allow stacked dbdrivers with readonly databases on top. - * Patch from Michel Dänzer to put the hostname in the gnome window title. + * Patch from Michel Dänzer to put the hostname in the gnome window title. Closes: #141235 -- Joey Hess <jo...@debian.org> Tue, 3 Sep 2002 12:24:55 -0400 @@ -3029,7 +3076,7 @@ * Directory DbDriver is pure virtual now; I had to move exists and iterator out of it, and it is fairly useless by itself. * Seems that LDAP has no end of quoting problems, and Dagfinn Ilmari - MannsÃ¥ker sent in a patch to update more of them (changes the schema again + Mannsåker sent in a patch to update more of them (changes the schema again amoung other things). Closes: #152477 * Stop leaking priority fields into the config database. @@ -3057,7 +3104,7 @@ of this type into it, use debconf-copydb to copy your existing databases into the new ones, and then make the new ones be used by default. - * Applied a patch from ilm...@ping.uio.no (Dagfinn Ilmari MannsÃ¥ker) to the + * Applied a patch from ilm...@ping.uio.no (Dagfinn Ilmari Mannsåker) to the LDAP dbdriver to change fields to IA5 text, skipping empty fields. Closes: #139779 * Made more vocal about use of capitalized frontend names, which are @@ -3436,7 +3483,7 @@ * Another French update. * Danish translation by Morten Brix Pedersen <mor...@wtf.dk> * frontend: don't glob unnecessarily, Closes: #117077 - * Michel Dänzer <daen...@debian.org> figured out how to turn off the gnome + * Michel Dänzer <daen...@debian.org> figured out how to turn off the gnome session manager warnings. Closes: #116087 * Turns out that the gnome frontend ARGV stomping was not being backed out if gtk failed to init due to a bad DISPLAY. Fixed that, which probably @@ -3942,7 +3989,7 @@ * A typo in debconf-getlang was making it incorrectly mark some things as fuzzy. Fumitoshi UKAI pointed out the fix, Closes: #97475 - * Some Spanish updates by Carlos Valdivia Yagüe. + * Some Spanish updates by Carlos Valdivia Yagüe. -- Joey Hess <jo...@debian.org> Mon, 14 May 2001 15:17:31 -0400 diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/debian/control debconf-1.5.61/debian/control --- debconf-1.5.56+deb8u1/debian/control 2017-06-16 15:22:14.000000000 -0700 +++ debconf-1.5.61/debian/control 2017-05-21 10:07:55.000000000 -0700 @@ -5,9 +5,9 @@ Uploaders: Colin Watson <cjwat...@debian.org> Standards-Version: 3.9.5 Build-Depends-Indep: perl (>= 5.10.0-16), python (>= 2.6.6-3~), python3 (>= 3.1.2-8), gettext (>= 0.13), libintl-perl, libqtgui4-perl -Build-Depends: debhelper (>= 7.2.11~), po-debconf, po4a (>= 0.23) -Vcs-Git: git://anonscm.debian.org/debconf/debconf.git -Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debconf/debconf.git;a=summary +Build-Depends: debhelper (>= 8.1.0~), po-debconf, po4a (>= 0.23) +Vcs-Git: https://anonscm.debian.org/git/debconf/debconf.git +Vcs-Browser: https://anonscm.debian.org/cgit/debconf/debconf.git X-Python-Version: >= 2.6 Package: debconf @@ -18,7 +18,7 @@ Replaces: debconf-tiny Depends: ${misc:Depends} Recommends: apt-utils (>= 0.5.1), debconf-i18n -Suggests: debconf-doc, debconf-utils, whiptail | dialog | gnome-utils, libterm-readline-gnu-perl, libgtk2-perl (>= 1:1.130), libnet-ldap-perl, perl, libqtgui4-perl, libqtcore4-perl +Suggests: debconf-doc, debconf-utils, whiptail | dialog, libterm-readline-gnu-perl, libgtk2-perl (>= 1:1.130), libnet-ldap-perl, perl, libqtgui4-perl, libqtcore4-perl Architecture: all Multi-Arch: foreign Description: Debian configuration management system diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/debian/debconf.dirs debconf-1.5.61/debian/debconf.dirs --- debconf-1.5.56+deb8u1/debian/debconf.dirs 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/debian/debconf.dirs 2015-11-07 19:02:00.000000000 -0800 @@ -1,2 +1,2 @@ etc/apt/apt.conf.d -etc/bash_completion.d +usr/share/bash-completion/completions diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/debian/maintscript debconf-1.5.61/debian/maintscript --- debconf-1.5.56+deb8u1/debian/maintscript 1969-12-31 16:00:00.000000000 -0800 +++ debconf-1.5.61/debian/maintscript 2015-11-07 19:00:35.000000000 -0800 @@ -0,0 +1 @@ +rm_conffile /etc/bash_completion.d/debconf 1.5.58~ diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/debian/rules debconf-1.5.61/debian/rules --- debconf-1.5.56+deb8u1/debian/rules 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/debian/rules 2015-11-07 19:23:43.000000000 -0800 @@ -26,7 +26,10 @@ override_dh_install: dh_install cp debian/apt.conf debian/debconf/etc/apt/apt.conf.d/70debconf - cp bash_completion debian/debconf/etc/bash_completion.d/debconf + cp bash_completion \ + debian/debconf/usr/share/bash-completion/completions/debconf + ln -s debconf \ + debian/debconf/usr/share/bash-completion/completions/debconf-show override_dh_installchangelogs: # Changelog reduction hack for debconf. Only include top 100 entries. diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/debian/source/format debconf-1.5.61/debian/source/format --- debconf-1.5.56+deb8u1/debian/source/format 1969-12-31 16:00:00.000000000 -0800 +++ debconf-1.5.61/debian/source/format 2016-01-27 03:00:13.000000000 -0800 @@ -0,0 +1 @@ +3.0 (native) diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/frontend debconf-1.5.61/frontend --- debconf-1.5.56+deb8u1/frontend 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/frontend 2016-03-08 02:16:29.000000000 -0800 @@ -96,6 +96,15 @@ $frontend->default_title($package) if length $package and !$no_title; $frontend->info(undef); +# Load any associated templates if we're being run from a package maintainer +# script. +if ($ARGV[0] =~/^(.*[.\/])(?:preinst|postinst|prerm|postrm)$/) { + my $base=$1; + my $templates=$base."templates"; + Debconf::Template->load($templates, $package) + if -e $templates; +} + # See if the preinst or postinst of the package is being run, and if there # is a config script associated with this package. If so, run it first as a # confmodule (also loading the templates). This is a bit of a nasty hack, that @@ -106,11 +115,6 @@ if ($ARGV[0] =~/^(.*[.\/])(?:postinst|preinst)$/) { my $base=$1; - # Load templates, if any. - my $templates=$base."templates"; - Debconf::Template->load($templates, $package) - if -e $templates; - # Run config script, if any. my $config=$base."config"; if (-e $config) { diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/po/Makefile debconf-1.5.61/po/Makefile --- debconf-1.5.56+deb8u1/po/Makefile 2017-06-16 15:22:02.000000000 -0700 +++ debconf-1.5.61/po/Makefile 2015-11-07 18:00:08.000000000 -0800 @@ -16,10 +16,22 @@ debconf.pot: $(POTFILES) @echo "Rebuilding the pot file" - xgettext $(POTFILES) -o debconf.pot -Lperl + TZ=UTC xgettext $(POTFILES) -o debconf.pot.new -Lperl + if [ -f debconf.pot ]; then \ + ./remove-potcdate.pl < debconf.pot > debconf.1po && \ + ./remove-potcdate.pl < debconf.pot.new > debconf.2po && \ + if cmp debconf.1po debconf.2po >/dev/null 2>&1; then \ + rm -f debconf.1po debconf.2po debconf.pot.new; \ + else \ + rm -f debconf.1po debconf.2po && \ + mv debconf.pot.new debconf.pot; \ + fi; \ + else \ + mv debconf.pot.new debconf.pot; \ + fi clean: - rm -f $(MOFILES) messages messages.mo + rm -f $(MOFILES) debconf.pot.new messages messages.mo %.mo: %.po msgfmt -o $@ $< diff -Nru --exclude '*.po' --exclude '*.pot' debconf-1.5.56+deb8u1/po/remove-potcdate.pl debconf-1.5.61/po/remove-potcdate.pl --- debconf-1.5.56+deb8u1/po/remove-potcdate.pl 1969-12-31 16:00:00.000000000 -0800 +++ debconf-1.5.61/po/remove-potcdate.pl 2015-11-07 17:56:58.000000000 -0800 @@ -0,0 +1,11 @@ +#! /usr/bin/perl -n + +BEGIN { + $seen_potcdate = 0; +} + +if (not $seen_potcdate and /^"POT-Creation-Date: .*"/) { + $seen_potcdate = 1; + next; +} +print;