all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "Jan Synáček" <jan.synacek@gmail.com>
Cc: 56336@debbugs.gnu.org
Subject: bug#56336: 28.1.90; [28.1] Emacs prompts for password when output from async command contains "password:"
Date: Sat, 02 Jul 2022 14:28:34 +0200	[thread overview]
Message-ID: <87tu7z1yx9.fsf@gnus.org> (raw)
In-Reply-To: <87r13511lv.fsf@gmail.com> ("Jan Synáček"'s message of "Fri, 01 Jul 2022 14:03:40 +0200")

Jan Synáček <jan.synacek@gmail.com> writes:

> 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")

I've now fixed the latter in Emacs 29.

The former problem is rather intractable.  That is, if you say

ssh foo@host

you'll get a password prompt as the final line in the buffer, and Emacs
will ask you to enter a password.

If you say

echo -n "password: "; sleep 10; echo foo

then there's no way for Emacs to distinguish that from the ssh
situation: It sees a prompt as the last thing in the buffer, and Emacs
can't possibly know that that's not a process asking for a password.

Note that

echo "password: "; echo foo; sleep 10

won't ask for a password.

So I don't know that there's any way to fix this -- Emacs uses a
heuristic, and it will be wrong in some cases.

Or does anybody have any ideas here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2022-07-02 12:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 12:03 bug#56336: 28.1.90; [28.1] Emacs prompts for password when output from async command contains "password:" Jan Synáček
2022-07-02 12:28 ` Lars Ingebrigtsen [this message]
2022-07-03  7:53   ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-03 12:19     ` Lars Ingebrigtsen
2022-08-02 11:02       ` Lars Ingebrigtsen
2022-07-03 16:54   ` Jan Synáček
2022-07-04 10:53     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tu7z1yx9.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=56336@debbugs.gnu.org \
    --cc=jan.synacek@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.