[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash source code block: problem after ssh commands
From: |
Bruno Barbier |
Subject: |
Re: bash source code block: problem after ssh commands |
Date: |
Fri, 17 Nov 2023 16:47:51 +0100 |
Hi Matt, Ihor, Alain,
Ihor Radchenko <yantar92@posteo.net> writes:
> Alain.Cochard@unistra.fr writes:
>
>> At the most basic user level (i.e., non lisp aware), why is it not
>> necessarily a bug if "something" does the expected in an X terminal
>> but not in an emacs terminal? I think Matt and I (and others) are on
>> the same page here, and he already essentially drafted the bug report
>> I would have sent (only better).
>
> WRT M-x shell, feel free to submit a bug report. I mostly pointed that
> the problem with M-x shell is not the problem you originally ran to. It
> is a different problem (also, we ran into it in the past).
FWIW, M-x shell differs from what a plain terminal is doing (xterm, in
my case), but, I do prefer 'M-x shell' behavior: it allows me to copy
multiple lines, getting the same results as when I type them manually,
or copy them line by line. My xterm doesn't seem to allow me to do that.
>> What also confuses me is that it seems to me that, in the minimum
>> working example, you consider the ssh command and the read command as
>> equivalent. But I don't even enter the password when using ssh...
I've introduced the 'read' example, as a simpler way to modify the
standard input and get the same kind of "unexpected" results, without
relying on SSH. It seems that I have only caused confusion, sorry about
that.
IIUC, the OP example is not working because SSH is modifying the
standard input (with or without passwords).
> I was only able to reproduce your problem with ssh asking a password.
> We are discussing the reproduced case.
>
> If you see problems with
> #+begin_src bash :results output
> ssh cochard@fruc.u-strasbg.fr "echo foo>foo_file"
> echo "bar"
> #+end_src
>
> even when ssh does not ask for a password, please provide more detailed
> reproducer that we can replicate locally without guessing your ssh config.
>
I'm not the OP, but, my SSH is configured to work without passwords and
SSH is still consuming lines from standard input:
#+begin_src bash :results output
ssh phone echo "remote"
echo "local"
#+end_src
#+RESULTS:
: remote
It looks like it is a known SSH "feature" (see
https://unix.stackexchange.com/a/688024):
#+begin_src bash :results output
seq 1000000 | (ssh phone sleep 1; wc -l)
#+end_src
#+RESULTS:
: 675173
Same block, but asking SSH to not use stdin (using '-n' as mentionned in
this thread):
#+begin_src bash :results output
seq 1000000 | (ssh -n phone sleep 1; wc -l)
#+end_src
#+RESULTS:
: 1000000
IMHO, what ob-shell is doing today seems a valid way of evaluating
source blocks (and it seems to have been like that for a long time). It
should probably be documented somewhere, so that users know how to write
their source blocks, or switch to another way, like adding a :cmdline
parameter as mentionned in this thread.
Hoping I didn't increase the confusion again,
:-)
Bruno
> --
> 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>
- Re: bash source code block: problem after ssh commands, (continued)
- Re: bash source code block: problem after ssh commands, Matt, 2023/11/15
- Re: bash source code block: problem after ssh commands, Matt, 2023/11/15
- Re: bash source code block: problem after ssh commands, Ihor Radchenko, 2023/11/16
- Re: bash source code block: problem after ssh commands, Matt, 2023/11/16
- Re: bash source code block: problem after ssh commands, Alain . Cochard, 2023/11/16
- Re: bash source code block: problem after ssh commands, Matt, 2023/11/16
- Re: bash source code block: problem after ssh commands, Ihor Radchenko, 2023/11/17
- Re: bash source code block: problem after ssh commands, Alain . Cochard, 2023/11/17
- Re: bash source code block: problem after ssh commands, Ihor Radchenko, 2023/11/17
- Re: bash source code block: problem after ssh commands, Leo Butler, 2023/11/17
- Re: bash source code block: problem after ssh commands,
Bruno Barbier <=
- Re: bash source code block: problem after ssh commands, Ihor Radchenko, 2023/11/18
- Re: bash source code block: problem after ssh commands, Bruno Barbier, 2023/11/21
- Re: bash source code block: problem after ssh commands, Max Nikulin, 2023/11/22
- Non-emacs shell (Re: bash source code block: problem after ssh commands), Max Nikulin, 2023/11/18
- Re: Non-emacs shell (Re: bash source code block: problem after ssh commands), Bruno Barbier, 2023/11/21
- Re: bash source code block: problem after ssh commands, Max Nikulin, 2023/11/18
- Re: bash source code block: problem after ssh commands, Ihor Radchenko, 2023/11/18
- Re: bash source code block: problem after ssh commands, Max Nikulin, 2023/11/18
- Re: bash source code block: problem after ssh commands, Matt, 2023/11/17
- Forget about "bash -c bash file.sh" (Re: bash source code block: problem after ssh commands), Max Nikulin, 2023/11/17