Public bug reported:

Observed behavior:
$ sudo --prompt "XXX" echo
[sudo: XXX] Password: 

Expected behavior:
$ sudo --prompt "XXX" echo
XXX Password: 

Discussion:

My reading of the manual is it should print "XXX" instead of "[sudo:
XXX]".

Environment SUDO_PROMPT has the same bug.

Emacs and some other tools try to hide the password you type, and rely
on the prompt being a recognizable form.  From:

https://emacs.stackexchange.com/questions/76023/at-the-time-of-prompting-for-a-password-from-a-subordinate-shell-sometimes-em
...
;; Ubuntu's sudo prompts like `[sudo] password for user:'
...

Current Emacs (from the 25.10 Ubuntu repo) does not hide the password
because the emacs-rs prompt is different than sudo.  The current
--prompt behavior cannot reproduce the expected prompt.  For example,

$ sudo --prompt '[sudo] password for user:' echo
[sudo: [sudo] password for user:] Password: 

So there may be a second bug, that sudo-rs is using a different prompt
than standard Ubuntu "sudo".  I tripped on the issue with Emacs, but
other tools may also fail due to the default prompt.


$ lsb_release -rd
Description:    Ubuntu 25.10
Release:        25.10
$ which sudo
/usr/bin/sudo
$ sudo --version
sudo-rs 0.2.8
$ apt-cache policy sudo-rs
sudo-rs:
  Installed: 0.2.8-1ubuntu5.2
  Candidate: 0.2.8-1ubuntu5.2
  Version table:
 *** 0.2.8-1ubuntu5.2 500
        500 http://us.archive.ubuntu.com/ubuntu questing-updates/main amd64 
Packages
        500 http://security.ubuntu.com/ubuntu questing-security/main amd64 
Packages
        100 /var/lib/dpkg/status
     0.2.8-1ubuntu5 500
        500 http://us.archive.ubuntu.com/ubuntu questing/main amd64 Packages

I tried submitting this bug as "sudo-rs" but the tool says "sudo-rs"
does not exist in Ubuntu, even though apt uses sudo-rs.

** Affects: rust-sudo-rs (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2138761

Title:
  sudo-rs --prompt  prints the wrong thing

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-sudo-rs/+bug/2138761/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to