On 9/29/24 08:58, David Kalnischkies wrote:
Control: severity -1 normal(I hope at the end its understandable why I downgrade the severity) Hi, Am Sat, Sep 28, 2024 at 10:11:24PM GMT, schrieb Andres Salomon:Here's the log from my terminal:[…]dilinger@debian:~$ sudo apt autoremove --purge libgtk-3-common Building dependency tree... 0%This line is suspicious as it should have disappeared – like the rest of the progress reporting. That it hasn't indicates that your terminal acted on more input than expected – as in you pressed ENTER for a bit too long firing of the apt command generating a new line.
This makes sense. I was running this inside of a (K)VM, so everything is a bit slower than bare metal. I could see how multiple ENTER keypresses could get registered (either due to slowness, or as a hardware issue).
Harmless, right … ?Summary: Upgrading: 0, Installing: 1, Removing: 448, Not Upgrading: 0 Download size: 79.7 kB Freed space: 1,714 MB Get:1 http://deb.debian.org/debian trixie/main amd64 pinentry-curses amd64 1.2.1-4+b1 [79.7 kB]In fact, I can easily reproduce this behaviour with any apt command usually asking a question if I keep holding ENTER for a bit longer… which is not too unsurprising as pressing ENTER on the confirmation prompt is considered a valid confirmation. I wonder a bit how the line ends up disappearing through. A command which defaults to 'No' on enter like the very wrong: apt upgrade -o Dir::Usr=/sys/firmware/efi/efivars (to force a more space needed warning at least on my system) has the output appearing… A wait, I get why: "Continue?" (and the other prompts) are not terminated by a newline, so if you press enter at the intended time the newline is added and the download happens on a fresh line (or in the case of the default No we generate additional output producing a new line).
I tried it just now on both bookworm and trixie; hitting ENTER twice while running 'sudo apt remove <pkg>' results in the prompt not showing up at all.
If you pressed enter too early the newline will have been entered somewhere in the previous output already (remember the 0% ?), so the download progress line happens to override the silently confirmed prompt. That is a fun one! And a bit surprising nobody else stumbled over this as this can be reproduced with any and all versions of apt (and massive amounts of other terminal software). In our case it seems reasonable to
I think it's unlikely that one would accidentally hit ENTER twice _unless_ dealing with a buggy keyboard or slow hardware, and with slow hardware I could imagine people hitting CTRL-C before it gets very far, so I could see why it hadn't been reported earlier.
Agreed that the tradeoff of making a user with slow hardware wait for the prompt (or add additional args) is better than having someone accidentally remove important packages."just" ignore any input given before we show the prompt. Except that someone might be doing e.g. "echo yeah | apt …" and that would break, so better only if input is a tty. Now, that "breaks" a user on slow machines that take a while to generate the listings that just hits confirm after the REMOVE section is done (in old order – now we know why it was given first 😉), so they have to wait now for the prompt, but… oh well, --no-remove --assume-yes could work for this straw man user instead I guess (https://xkcd.com/1172/).
MR on salsa: https://salsa.debian.org/apt-team/apt/-/merge_requests/375
Thank you!
Best regards David Kalnischkies
--I'm available for contract & employment work, please contact me if interested.
OpenPGP_signature.asc
Description: OpenPGP digital signature