emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash source code block: problem after ssh commands


From: Ihor Radchenko
Subject: Re: bash source code block: problem after ssh commands
Date: Fri, 17 Nov 2023 09:22:02 +0000

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 via email to

[Prev in Thread] Current Thread [Next in Thread]