FS#67392 - Make cancelled confirmation prompts more obvious

Attached to Project: Pacman
Opened by David Macek (Elieux) - Saturday, 25 July 2020, 15:05 GMT
Task Type Feature Request
Category General
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 5.2.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Summary and Info:

Recently I've seen multiple people bump into an issue using Pacman in automation. Seems like there's no indication of a confirmation prompt causing Pacman to bail out when stdin is closed. The solution in most cases is to add `--noconfirm`, but it's not obvious anything is wrong when reading the logs. I'm thinking of two options:

1. a specialized message like "No answer, defaulting to No." for just this case of feof(stdin)
2. a general "Installation/upgrade/whatever was cancelled." (one would have to be written for each prompt) that would also be seen by interactive users

Either one should make the quits more obvious in the logs.

Steps to Reproduce:

```
$ cat /dev/null | sudo pacman -Sc
Packages to keep:
All locally installed packages

Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove all other packages from cache? [Y/n]
Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n]
```
This task depends upon

Comment by David Macek (Elieux) - Saturday, 25 July 2020, 15:07 GMT
I can make a patch if we agree on which message is preferred.
Comment by Allan McRae (Allan) - Saturday, 25 July 2020, 22:28 GMT
Pacmsn has never had automation as a design consideration.
Comment by David Macek (Elieux) - Sunday, 26 July 2020, 10:36 GMT
Additional consideration would be to exit with non-zero status code when a confirmation prompt fails to get an answer, instead of continuing.
Comment by Allan McRae (Allan) - Sunday, 26 July 2020, 11:17 GMT
As discussed on IRC:

nonzero exit, even a message - "Failed to retrieve input from stdin" or something

Loading...