emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Matt <matt@excalamus.com>
Cc: alaincochard <alain.cochard@unistra.fr>,
	"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: bash source code block: problem after ssh commands
Date: Fri, 17 Nov 2023 09:22:02 +0000	[thread overview]
Message-ID: <871qcod9ad.fsf@localhost> (raw)
In-Reply-To: <18bd9ea2f7b.b77346232985684.5614027527324280790@excalamus.com>

Matt <matt@excalamus.com> writes:

> Thank you for clarifying.
>
>  > Anyway, this gives me the opportunity to come back to the question of
>  > whether or not there is a problem with emacs itself (like some people
>  > here thought), and if some message should be sent to some emacs list.
>  > Again my argument was that the 2 commands copy/yank'ed in an emacs
>  > terminal don't work as expected, while they do if the same is done in
>  > an X terminal.
>
> Okay, I follow you now.
>
> Yes, I agree with what others have said, it's related to Emacs (probably comint-mode).  It happens with M-x shell and *not* with M-x eshell.   It's hard to reproduce with M-x term because term-char-mode doesn't allow copy-paste.  M-x with term-line-mode doesn' t print "bar".

I think that I need to clarify here.
We are talking about two different things:
1. Bash src block without session
2. Bash src block with session

The original report used bash src blocks _without_ session.
In such scenario, comint (and M-x shell) is not relevant.
Org simply uses `process-file' with INFILE argument.
This is equivalent of someone opening __X shell__, and literally typing

  ssh cochard@fruc.u-strasbg.fr "echo foo>foo_file"
  echo "bar"

In the scenario described in the report, when ssh asks for password, it
is equivalent to

$ ssh cochard@fruc.u-strasbg.fr "echo foo>foo_file"
Password: <typing 'echo "bar"' here>

This has nothing to do with Emacs comint and this is also not a bug in
Emacs - we use INFILE argument, that is equivalent to the above as _per
docstring_. So, Org mode is simply not using `process-file' function as
users expect - instead of executing a bash script, we emulate
interactive user input to bash.

(Side note: for someone aware about these details, it is possible to do
something like

#+begin_src bash
ssh remote-server;
<<super-secret-password-derived-from-library-of-babel-block-stored-in-safe-private-place>>
#+end_src

or, as a demo

#+begin_src bash
read x;
value2
echo "We just read \"$x\"";
#+end_src

#+RESULTS:
: We just read "value2"

<end of side note>)

Another case is (2), when we do use comint is session is what we
discussed in
https://list.orgmode.org/orgmode/CAL1eYuJntGbXY6A794qM7PTbXH3DiU1aF6OayS7CLf3kOBsbig@mail.gmail.com/
I guess we can try to report this as a bug, especially since it also
manifests itself when comint is used interactively.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  reply	other threads:[~2023-11-17  9:20 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 11:17 bash source code block: problem after ssh commands Alain.Cochard
2023-10-25 15:12 ` Leo Butler
2023-10-25 16:14   ` Alain.Cochard
2023-10-25 16:47     ` Leo Butler
2023-10-25 16:59     ` yaxp
2023-10-26  8:44   ` Ihor Radchenko
2023-10-26 13:23     ` Alain.Cochard
2023-10-26 13:44       ` Ihor Radchenko
2023-10-27 18:26         ` Alain.Cochard
2023-10-28  5:22           ` Max Nikulin
2023-10-30 10:50           ` Bruno Barbier
2023-11-06 13:32             ` Ihor Radchenko
2023-11-06 18:25               ` Matt
2023-11-07  8:55                 ` Ihor Radchenko
2023-11-08 19:41                   ` Matt
2023-11-09 12:14                     ` Ihor Radchenko
2023-11-09 17:48                       ` Matt
2023-11-15 16:32                         ` Matt
2023-11-15 18:04                           ` Matt
2023-11-16  9:32                           ` Ihor Radchenko
2023-11-16 19:03                             ` Matt
2023-11-16 19:46                               ` Alain.Cochard
2023-11-16 20:54                                 ` Matt
2023-11-17  9:22                                   ` Ihor Radchenko [this message]
2023-11-17  9:55                                     ` Alain.Cochard
2023-11-17 10:17                                       ` Ihor Radchenko
2023-11-17 15:32                                         ` Leo Butler
2023-11-17 15:47                                         ` Bruno Barbier
2023-11-18 10:37                                           ` Ihor Radchenko
2023-11-21 19:01                                             ` Bruno Barbier
2023-11-22 17:06                                               ` Max Nikulin
2023-11-19  4:17                                           ` Non-emacs shell (Re: bash source code block: problem after ssh commands) Max Nikulin
2023-11-21 15:33                                             ` Bruno Barbier
2023-11-18  8:04                                         ` bash source code block: problem after ssh commands Max Nikulin
2023-11-18 10:43                                           ` Ihor Radchenko
2023-11-18 16:18                                             ` Max Nikulin
2024-06-29 15:40                                           ` Max Nikulin
2023-11-17 22:07                                     ` Matt
2023-11-18  3:11                                       ` Forget about "bash -c bash file.sh" (Re: bash source code block: problem after ssh commands) Max Nikulin
2023-11-18  8:11                                         ` Matt
2023-11-18  8:29                                           ` Bruno Barbier
2023-11-18  8:43                                             ` Matt
2023-11-18  8:54                                               ` Bruno Barbier
2023-11-18  9:09                                                 ` Matt
2023-11-18  9:11                                                   ` Bruno Barbier
2023-11-18 10:47                                                   ` Ihor Radchenko
2023-11-18  8:19                                       ` bash source code block: problem after ssh commands Bruno Barbier
2023-11-18  9:02                                         ` Matt
2023-11-18 15:51                                       ` Matt
2024-06-30  8:57                                         ` Max Nikulin
2024-06-30 11:06                                           ` Ihor Radchenko
2024-06-30 15:19                                             ` Max Nikulin
2024-06-30 15:28                                               ` Ihor Radchenko
2024-06-30 15:48                                                 ` Max Nikulin
2024-06-30 16:42                                                   ` Ihor Radchenko
2024-07-01  9:41                                                     ` Max Nikulin
2024-07-01  9:51                                                       ` Ihor Radchenko
2024-07-01 10:54                                                         ` Max Nikulin
2024-07-01 16:01                                                           ` Ihor Radchenko
2024-07-03 11:06                                                             ` Max Nikulin
2024-07-03 12:33                                                               ` Ihor Radchenko
2023-10-26 14:44 ` Russell Adams
2023-10-27 11:47   ` Alain.Cochard
2023-11-06 18:01     ` Matt
2023-11-07  0:51       ` Alain.Cochard
2023-11-18  8:09 ` Max Nikulin
2023-11-18  8:36   ` Bruno Barbier

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=871qcod9ad.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=alain.cochard@unistra.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=matt@excalamus.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).