No error message if reading password fails
"R. Diez via sudo-users" <[email protected]>
| Newsgroups | gmane.comp.tools.sudo.user |
|---|---|
| Message-ID | <[email protected]> |
Hi there: I am using sudo version 1.8.21p2 (whatever comes with Ubuntu 18.04). I normally run scripts within Emacs, in a compilation buffer. Such buffers expect no interaction, and reading from stdin tends to hang. So I have set this option to make it fail (instead of hanging): (setq compilation-disable-input t) If I try to run sudo inside such a compilation buffer, sudo fails to read the password, and it exits with status code 1. The trouble is, it does not display any error message at all. It took me a while to figure out which command was failing inside my script. I investigated further, and something similar happens without Emacs too: rdiez@UbuntuMate:~$ sudo -S -- ls </dev/null [sudo] password for rdiez: Instead of waiting for the password after printing the password prompt, sudo quits, as it cannot really read the password. The exit status code is 1, but no error message is printed. It would be nice if sudo printed some error indication to stderr. I thought that maybe sudo was interpreting this scenario as "empty password", which is not the right password. But then I was expecting the "Sorry, try again." message. Closing the stdin file descriptor beforehand as follows seems to have the same effect: sudo -S -- ls <&- Best regards, rdiez ____________________________________________________________ sudo-users mailing list <[email protected]> For list information, options, or to unsubscribe, visit: https://www.sudo.ws/mailman/listinfo/sudo-users