Subject: Support `nixos-rebuild --use-remote-sudo` in `comint-password-prompt-regexp`

From: [email-masked]
Date: Mon, 13 Jan 2025 01:44:20 +0100

Tags: patch

Hello!

In NixOS, when running the command `nixos-rebuild` with the argument `--use-remote-sudo`, the password is asked for with the prompt "bash Password:".

This adds support for this in `comint-password-prompt-regexp`.

I added a test also.

Thoughts?

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.43, cairo version 1.18.2)
Repository revision: e41a7d8127423307018f369e8739319f1de9b3fa
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: NixOS 24.11 (Vicuna)

Configured using:
 'configure
 --prefix=/nix/store/wv2ap96hvr0ilf575mwszsva6rvgqdi1-emacs-git-20250107.0
 --disable-build-details --with-modules --with-x-toolkit=gtk3
 --with-cairo --with-xft --with-compress-install
 --with-toolkit-scroll-bars --with-native-compilation
 --without-imagemagick --with-mailutils --without-small-ja-dic
 --with-tree-sitter --with-xinput2 --without-xwidgets --with-dbus
 --with-selinux'

>From 349a3dd11d30ba0109a18e860d89cae8e7401638 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20W=C3=A5linder?= <[email-masked]>
Date: Mon, 13 Jan 2025 01:28:02 +0100
Subject: [PATCH] Added `nixos-rebuild` `--use-remote-sudo` password prompt

---
 lisp/comint.el            | 2 +-
 test/lisp/comint-tests.el | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/comint.el b/lisp/comint.el
index 2c6845f..f1283f2 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -406,7 +406,7 @@ This variable is buffer-local."
       "Current"
       "Enter Auth" "enter auth" "Old" "old" "New" "new" "login"
       "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "PEM" "SUDO"
-      "[sudo]" "doas" "Repeat" "Bad" "Retype" "Verify")
+      "[sudo]" "doas" "Repeat" "Bad" "Retype" "Verify" "bash")
     t)
    ;; Allow for user name to precede password equivalent (Bug#31075).
    " +.*\\)"
diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el
index 20ef01a..7bcea70 100644
--- a/test/lisp/comint-tests.el
+++ b/test/lisp/comint-tests.el
@@ -51,7 +51,8 @@
     "Enter Auth Password:" ; OpenVPN (Bug#35724)
     "Verify password: "    ; zip -e zipfile.zip ... (Bug#47209)
     "Mot de Passe :" ; localized (Bug#29729)
-    "Passwort:") ; localized
+    "Passwort:" ; localized
+    "bash Password:") ; nixos-rebuild --use-remote-sudo 
   "List of strings that should match `comint-password-prompt-regexp'.")
 
 (ert-deftest comint-test-password-regexp ()
-- 
2.47.0