all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Specifying shells for remote ob-shell sessions?
@ 2021-06-24 23:15 David Dynerman
  2021-06-25  5:45 ` Tim Cross
  2021-06-25  7:18 ` Robert Pluim
  0 siblings, 2 replies; 3+ messages in thread
From: David Dynerman @ 2021-06-24 23:15 UTC (permalink / raw)
  To: emacs-orgmode

Dear Org Mode Friends,

I’m having some trouble getting the shell I want to run on remote hosts in session ob-shell blocks - it seems that no matter what shell I specify, session blocks will always run /bin/sh. I’m not sure if this is an org or tramp configuration issue on my end, or a bug in org.

I’m pasting a snippet that reproduces the behavior in emacs -Q below. Does anyone have an inkling if this is a bug, or, alternatively, suggestions for how I can run remote ob-shell sessions with the shell of my choice?

Thank you,
David

#+BEGIN_SRC emacs-lisp                                                                                          
  (require 'ob-shell)                                                                                           
  (emacs-version)                                                                                               
#+END_SRC                                                                                                       

#+RESULTS:
: GNU Emacs 27.2 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 158 AppKit 1561.6)                         
:  of 2021-05-20                                                                                                

#+BEGIN_SRC emacs-lisp                                                                                          
  (org-version)                                                                                                 
#+END_SRC                                                                                                       

#+RESULTS:
: 9.4.4                                                                                                         

#+BEGIN_SRC zsh :dir /ssh:remote-host:/home/ubuntu                                                       
    echo $0
#+END_SRC                                                                                                       

#+RESULTS:
: zsh                                                                                                           

#+BEGIN_SRC zsh :dir /ssh:remote-host:/home/ubuntu :session foobar                                       
echo $0
#+END_SRC                                                                                                       

#+RESULTS:
|           |
| $ /bin/sh |

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Specifying shells for remote ob-shell sessions?
  2021-06-24 23:15 Specifying shells for remote ob-shell sessions? David Dynerman
@ 2021-06-25  5:45 ` Tim Cross
  2021-06-25  7:18 ` Robert Pluim
  1 sibling, 0 replies; 3+ messages in thread
From: Tim Cross @ 2021-06-25  5:45 UTC (permalink / raw)
  To: emacs-orgmode


David Dynerman <emperordali@block-party.net> writes:

> Dear Org Mode Friends,
>
> I’m having some trouble getting the shell I want to run on remote hosts in
> session ob-shell blocks - it seems that no matter what shell I specify, session
> blocks will always run /bin/sh. I’m not sure if this is an org or tramp
> configuration issue on my end, or a bug in org.
>
> I’m pasting a snippet that reproduces the behavior in emacs -Q below. Does
> anyone have an inkling if this is a bug, or, alternatively, suggestions for how
> I can run remote ob-shell sessions with the shell of my choice?
>
> Thank you,
> David
>
> #+BEGIN_SRC emacs-lisp                                                                                          
>   (require 'ob-shell)                                                                                           
>   (emacs-version)                                                                                               
> #+END_SRC                                                                                                       
>
>
> #+RESULTS:
> : GNU Emacs 27.2 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 158 AppKit 1561.6)                         
> :  of 2021-05-20                                                                                                
>
> #+BEGIN_SRC emacs-lisp                                                                                          
>   (org-version)                                                                                                 
> #+END_SRC                                                                                                       
>
>
> #+RESULTS:
> : 9.4.4                                                                                                         
>
> #+BEGIN_SRC zsh :dir /ssh:remote-host:/home/ubuntu                                                       
>     echo $0
> #+END_SRC                                                                                                       
>
>
> #+RESULTS:
> : zsh                                                                                                           
>
> #+BEGIN_SRC zsh :dir /ssh:remote-host:/home/ubuntu :session foobar                                       
> echo $0
> #+END_SRC                                                                                                       
>
> #+RESULTS:
> |           |
> | $ /bin/sh |


This is just some wild guess work, so may be completely wrong ....

I don't think it is a bug. The ob-shell library doesn't really know
anything about remote - the fact you can execute things remotely is just
part of the underlying Emacs tramp support.

As far as I know, the shell you get in the remote login is determined by
the remote host i.e. in the /etc/passwd file of the remote user account
(for login shells) and /bin/sh if ssh is just being called to execute a
command. In your case, because your calling echo $0 it is executed with
/bin/sh

 I would start with tramp and try to configure it to execute commands
 using zsh. The ob-shell library isn't really aware of 'remote' - it is
 just calling tramp based on the path you provide, which is why I think
 tramp is a good place to start. If this cannot be easily done, look at the ssh manual and
 see if you can do this via a ~/.ssh/rc file on the remote host.

If you cannot find a way to configure tramp, perhaps try working out how
to just execute commands over ssh in a specific shell, like zsh. I
suspect once you work out how to do this with plain ssh, you may see a
way to configure tramp to do the same.

A final solution would be to just add a call to zsh in your source block
before the rest of what you want to run. 


-- 
Tim Cross


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Specifying shells for remote ob-shell sessions?
  2021-06-24 23:15 Specifying shells for remote ob-shell sessions? David Dynerman
  2021-06-25  5:45 ` Tim Cross
@ 2021-06-25  7:18 ` Robert Pluim
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Pluim @ 2021-06-25  7:18 UTC (permalink / raw)
  To: David Dynerman; +Cc: emacs-orgmode

>>>>> On Thu, 24 Jun 2021 16:15:44 -0700, David Dynerman <emperordali@block-party.net> said:

    David> Dear Org Mode Friends,
    David> I’m having some trouble getting the shell I want to run on remote
    David> hosts in session ob-shell blocks - it seems that no matter what shell
    David> I specify, session blocks will always run /bin/sh. I’m not sure if
    David> this is an org or tramp configuration issue on my end, or a bug in
    David> org.

Tramp will always use /bin/sh on the remote host, unless you tell it
not to.

See (info "(tramp) Remote shell setup") for how to override that (I
donʼt remember offhand if /ssh: supports overriding, otherwise you can
switch to /sshx: which definitely does)

Robert
-- 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-25  7:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-24 23:15 Specifying shells for remote ob-shell sessions? David Dynerman
2021-06-25  5:45 ` Tim Cross
2021-06-25  7:18 ` Robert Pluim

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.