Package: apt-listchanges Version: 3.24 Severity: normal Tags: patch Dear Maintainer,
when using the "--confirm" option, apt-listchanges writes a prompt to stderr, flushes stderr and waits for the user to confirm before continuing. This assumes that the frontend already informed the user about all relevant changes. When using the "text" frontend, those changelogs will have been written to stdout. But unless stdout is a tty, they will have not yet been flushed. That means everything works fine if stdout is a tty: $ apt-listchanges --confirm --frontend=text --latest=1 /var/cache/apt/archives/apt_1.8.2.3_amd64.deb apt-listchanges: Reading changelogs... apt-listchanges: News --------------------- [...] apt-listchanges: Changelogs --------------------------- [...] apt-listchanges: Do you want to continue? [Y/n] But if stdout is something else, stdout is not flushed before waiting for user input. The user is asked to confirm changes, they have not yet seen: $ apt-listchanges --confirm --frontend=text --latest=1 /var/cache/apt/archives/apt_1.8.2.3_amd64.deb | cat apt-listchanges: Do you want to continue? [Y/n] Only after the user gives an answer, the actual changelogs appear: $ apt-listchanges --confirm --frontend=text --latest=1 /var/cache/apt/archives/apt_1.8.2.3_amd64.deb | cat apt-listchanges: Do you want to continue? [Y/n] y apt-listchanges: Reading changelogs... apt-listchanges: News --------------------- [...] apt-listchanges: Changelogs --------------------------- [...] To be able to make an informed decision on whether to continue, the user should be able to see the changelog before having to answer the prompt. To facilitate this, apt-listchanges should flush stdout before propting the user: --- /usr/share/apt-listchanges/apt_listchanges.py.orig +++ /usr/share/apt-listchanges/apt_listchanges.py @@ -295,6 +295,7 @@ return enc.from_bytes(tty.readline()).rstrip() def confirm(self): + sys.stdout.flush() response = self.ttyask('apt-listchanges: ' + _('Do you want to continue? [Y/n] ')) return response == '' or re.search(locale.nl_langinfo(locale.YESEXPR), response) -- -- Package-specific info: ==> /etc/apt/listchanges.conf <== [apt] frontend=pager which=news email_address=root email_format=text confirm=false headers=false reverse=false save_seen=/var/lib/apt/listchanges.db -- System Information: Debian Release: 11.6 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 4.19.0 (SMP w/4 CPU threads) Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages apt-listchanges depends on: ii apt 2.2.4 ii debconf [debconf-2.0] 1.5.77 ii python3 3.9.2-3 ii python3-apt 2.2.1 ii python3-debconf 1.5.77 ii sensible-utils 0.0.14 ii ucf 3.0043 apt-listchanges recommends no packages. Versions of packages apt-listchanges suggests: ii lynx [www-browser] 2.9.0dev.6-3~deb11u1 ii postfix [mail-transport-agent] 3.5.17-0+deb11u1 pn python3-gi <none> pn x-terminal-emulator <none> -- debconf information excluded