Subject: bug#56336: 28.1.90; [28.1] Emacs prompts for password when output from async command contains "password:"

From: Jan Synáček <[email-masked]>
Date: Fri, 01 Jul 2022 14:03:40 +0200

When the output from a command spawned with 'M-&' (async-shell-command)
ends with "password:" Emacs prompts for a password.

Reproducer:
0) $ cat /tmp/test.txt
   enter your password:
1) emacs -Q
2) Press 'M-&', enter 'cat /tmp/test.txt' as input and hit enter.
3) Emacs prompts for a password.

I expect that 3) should not happen as the output is simply to stdout and
no stdin input is expected. Note that the reproducer is minimal and a
bit contrived but the real bug showed itself when I was running a big
test suite that contained several lines ending with "password:" in its
output.

I've also tested this with the latest master (commit
3a4c408a7b6f3df5ca0eb4a406efbdb4899e9742), where it sometimes happens as
well and sometimes you just get an error like this:

Error running timer: (error "Buffer *Async Shell Command* has no process")

In GNU Emacs 28.1.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6)
 of 2022-07-01 built on jsynacek-home
Repository revision: 7e33618bbc07b65c36744db8e7ef219d2d942456
Repository branch: emacs-28
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Arch Linux

Configured using:
 'configure --with-imagemagick --with-json --with-native-compilation
 --prefix=/home/jsynacek/emacs'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  windmove-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  global-so-long-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/jsynacek/.emacs.d/elpa/transient-20220514.945/transient hides /home/jsynacek/emacs/share/emacs/28.1.90/lisp/transient

Features:
(shadow sort mail-extr emacsbug tabify man windmove vc-mtn vc-hg vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs counsel xdg swiper misearch
multi-isearch vc-git magit-extras face-remap dired-aux haskell-lite
github-actions-lite cabal-project-lite cabal-lite dockerfile-lite
the-org-mode-expansions org-element avl-tree org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp
ob-core ob-eval org-table oc-basic bibtex iso8601 ol org-keys oc
org-compat org-macs org-loaddefs find-func cal-menu calendar
cal-loaddefs vc-dir ewoc slime etags fileloop generator xref project
arc-mode archive-mode noutline outline hyperspec rg files-x vc
vc-dispatcher rg-info-hack rg-menu rg-ibuffer rg-result wgrep-rg wgrep
rg-history rg-header ibuf-ext ibuffer ibuffer-loaddefs grep cus-edit pp
cus-load wid-edit pulse magit-submodule magit-obsolete magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log which-func imenu magit-diff smerge-mode diff
diff-mode git-commit log-edit easy-mmode message rmc puny rfc822 mml
mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor magit-mode magit-git magit-base magit-section
crm dash compat-27 compat-26 jsynacek-text jsynacek-term term disp-table
shell pcomplete ehelp jsynacek-project ivy delsel ivy-faces ivy-overlay
colir color expand-region text-mode-expansions er-basic-expansions
thingatpt expand-region-core advice expand-region-custom dired
dired-loaddefs avy transient time-date format-spec compat edmacro kmacro
jsynacek-misc jsynacek-elisp smtpmail sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils so-long open-color server
compile text-property-search comint ansi-color ring slime-autoloads info
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source eieio eieio-core eieio-loaddefs password-cache
json map url-vars comp comp-cstr warnings subr-x rx cl-seq cl-macs
cl-extra help-mode seq byte-opt gv cl-loaddefs cl-lib bytecomp
byte-compile cconv iso-transl tooltip eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 625701 124605)
 (symbols 48 28318 7)
 (strings 32 137451 11163)
 (string-bytes 1 4439546)
 (vectors 16 65984)
 (vector-slots 8 1019313 83933)
 (floats 8 312 708)
 (intervals 56 17397 65)
 (buffers 992 42))