all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to use org mode shell with ssh?
@ 2016-09-22  1:02 Xi Shen
  2016-09-22  1:15 ` William Denton
  0 siblings, 1 reply; 13+ messages in thread
From: Xi Shen @ 2016-09-22  1:02 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]

Hi,

I tried this block

#+BEGIN_SRC sh :dir /sshx:openwrt:/mnt/sda1
ls -al
#+END_SRC

But I got

byte-code: Method `sshx' should specify both encoding and decoding command
or an scp program

But I could not find a way to define the encoding/decoding command...
-- 


Thanks,
David S.

[-- Attachment #2: Type: text/html, Size: 582 bytes --]

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

* Re: How to use org mode shell with ssh?
  2016-09-22  1:02 How to use org mode shell with ssh? Xi Shen
@ 2016-09-22  1:15 ` William Denton
  2016-09-22  8:52   ` Colin Baxter
  0 siblings, 1 reply; 13+ messages in thread
From: William Denton @ 2016-09-22  1:15 UTC (permalink / raw)
  To: Xi Shen; +Cc: emacs-orgmode@gnu.org

On 22 September 2016, Xi Shen wrote:

> #+BEGIN_SRC sh :dir /sshx:openwrt:/mnt/sda1
> ls -al
> #+END_SRC

Just use ssh, not sshx, and it should work.

Bill
-- 
William Denton :: Toronto, Canada :: https://www.miskatonic.org/
Caveat lector.

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

* Re: How to use org mode shell with ssh?
  2016-09-22  1:15 ` William Denton
@ 2016-09-22  8:52   ` Colin Baxter
  2016-09-22 12:15     ` Xi Shen
  0 siblings, 1 reply; 13+ messages in thread
From: Colin Baxter @ 2016-09-22  8:52 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode@gnu.org, Xi Shen

On Wed, Sep 21 2016, William Denton wrote:

> On 22 September 2016, Xi Shen wrote:
>
>> #+BEGIN_SRC sh :dir /sshx:openwrt:/mnt/sda1
>> ls -al
>> #+END_SRC
>
> Just use ssh, not sshx, and it should work.
>
> Bill

In babel it is now (shell . t). The form (sh . t) is depreciated as from
org-mode version 8.2.10 at least.

Best wishes.

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

* Re: How to use org mode shell with ssh?
  2016-09-22  8:52   ` Colin Baxter
@ 2016-09-22 12:15     ` Xi Shen
  2016-09-22 12:37       ` Xi Shen
  0 siblings, 1 reply; 13+ messages in thread
From: Xi Shen @ 2016-09-22 12:15 UTC (permalink / raw)
  To: Colin Baxter, William Denton; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]

Hi,

I just tried with:

#+BEGIN_SRC shell :dir /ssh:openwrt:/mnt/sda1
ls -al
#+END_SRC

But still got the same error. I wonder on which end threw me this error.
Maybe it is because I am using Emacs on Windows, and some thing is missing?
Or maybe it is because the remote system is OpenWRT which has limited
function?


On Thu, Sep 22, 2016 at 4:57 PM Colin Baxter <m43cap@yandex.com> wrote:

> On Wed, Sep 21 2016, William Denton wrote:
>
> > On 22 September 2016, Xi Shen wrote:
> >
> >> #+BEGIN_SRC sh :dir /sshx:openwrt:/mnt/sda1
> >> ls -al
> >> #+END_SRC
> >
> > Just use ssh, not sshx, and it should work.
> >
> > Bill
>
> In babel it is now (shell . t). The form (sh . t) is depreciated as from
> org-mode version 8.2.10 at least.
>
> Best wishes.
>
-- 


Thanks,
David S.

[-- Attachment #2: Type: text/html, Size: 1338 bytes --]

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

* Re: How to use org mode shell with ssh?
  2016-09-22 12:15     ` Xi Shen
@ 2016-09-22 12:37       ` Xi Shen
  2016-09-22 14:00         ` Colin Baxter
  2016-09-22 14:38         ` Nick Dokos
  0 siblings, 2 replies; 13+ messages in thread
From: Xi Shen @ 2016-09-22 12:37 UTC (permalink / raw)
  To: Colin Baxter, William Denton; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

Instead of using ssh, I tried with scp. This time I got a different error.

#+BEGIN_SRC shell :dir /scp:openwrt:/mnt/sda1
ls -al
#+END_SRC

The error, I think, is from the remote end.

/bin/sh: /bin/zsh: not found

Clearly, I am using zsh on my Windows, but my remote OpenWRT system only
has ash installed. Is there's way to specify the shell to use on the remote
end?


On Thu, Sep 22, 2016 at 8:15 PM Xi Shen <davidshen84@gmail.com> wrote:

> Hi,
>
> I just tried with:
>
> #+BEGIN_SRC shell :dir /ssh:openwrt:/mnt/sda1
> ls -al
> #+END_SRC
>
> But still got the same error. I wonder on which end threw me this error.
> Maybe it is because I am using Emacs on Windows, and some thing is missing?
> Or maybe it is because the remote system is OpenWRT which has limited
> function?
>
>
> On Thu, Sep 22, 2016 at 4:57 PM Colin Baxter <m43cap@yandex.com> wrote:
>
>> On Wed, Sep 21 2016, William Denton wrote:
>>
>> > On 22 September 2016, Xi Shen wrote:
>> >
>> >> #+BEGIN_SRC sh :dir /sshx:openwrt:/mnt/sda1
>> >> ls -al
>> >> #+END_SRC
>> >
>> > Just use ssh, not sshx, and it should work.
>> >
>> > Bill
>>
>> In babel it is now (shell . t). The form (sh . t) is depreciated as from
>> org-mode version 8.2.10 at least.
>>
>> Best wishes.
>>
> --
>
>
> Thanks,
> David S.
>
-- 


Thanks,
David S.

[-- Attachment #2: Type: text/html, Size: 2326 bytes --]

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

* Re: How to use org mode shell with ssh?
  2016-09-22 12:37       ` Xi Shen
@ 2016-09-22 14:00         ` Colin Baxter
  2016-09-22 14:45           ` David A. Gershman
  2016-09-22 14:52           ` Nick Dokos
  2016-09-22 14:38         ` Nick Dokos
  1 sibling, 2 replies; 13+ messages in thread
From: Colin Baxter @ 2016-09-22 14:00 UTC (permalink / raw)
  To: Xi Shen; +Cc: William Denton, emacs-orgmode@gnu.org

On Thu, Sep 22 2016, Xi Shen wrote:

> Instead of using ssh, I tried with scp. This time I got a different error.
>
> #+BEGIN_SRC shell :dir /scp:openwrt:/mnt/sda1
> ls -al
> #+END_SRC
>
> The error, I think, is from the remote end.
>
> /bin/sh: /bin/zsh: not found
>
> Clearly, I am using zsh on my Windows, but my remote OpenWRT system only has ash installed. Is
> there's way to specify the shell to use on the remote end?
>

I can't help you here. I've never used openwrt. All I can suggest is to
search openwrt documentation or try with cgywin.

Good luck.

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

* Re: How to use org mode shell with ssh?
  2016-09-22 12:37       ` Xi Shen
  2016-09-22 14:00         ` Colin Baxter
@ 2016-09-22 14:38         ` Nick Dokos
  1 sibling, 0 replies; 13+ messages in thread
From: Nick Dokos @ 2016-09-22 14:38 UTC (permalink / raw)
  To: emacs-orgmode

Xi Shen <davidshen84@gmail.com> writes:

> Instead of using ssh, I tried with scp. This time I got a different error.
>
> #+BEGIN_SRC shell :dir /scp:openwrt:/mnt/sda1
> ls -al
> #+END_SRC
>
Try opening the file in tramp directly - that should tell you where the error
lies: tramp or org?

> The error, I think, is from the remote end.
>
> /bin/sh: /bin/zsh: not found
>
> Clearly, I am using zsh on my Windows, but my remote OpenWRT system only has ash installed. Is there's way to specify the shell to use on the remote end?
>

Even more: try ssh to your box from the command line. Once you figure out
how that works, then you can teach tramp to use that method.

> On Thu, Sep 22, 2016 at 8:15 PM Xi Shen <davidshen84@gmail.com> wrote:
>
>     Hi,
>    
>     I just tried with:
>    
>     #+BEGIN_SRC shell :dir /ssh:openwrt:/mnt/sda1
>     ls -al
>     #+END_SRC
>    
>     But still got the same error. I wonder on which end threw me this error. Maybe it is because I am using Emacs on Windows, and some thing is missing? Or maybe it is because the remote
>     system is OpenWRT which has limited function?
>
>     On Thu, Sep 22, 2016 at 4:57 PM Colin Baxter <m43cap@yandex.com> wrote:
>    
>         On Wed, Sep 21 2016, William Denton wrote:
>        
>         > On 22 September 2016, Xi Shen wrote:
>         >
>         >> #+BEGIN_SRC sh :dir /sshx:openwrt:/mnt/sda1
>         >> ls -al
>         >> #+END_SRC
>         >
>         > Just use ssh, not sshx, and it should work.
>         >
>         > Bill
>        
>         In babel it is now (shell . t). The form (sh . t) is depreciated as from
>         org-mode version 8.2.10 at least.
>        
>         Best wishes.
>    
>     --
>
>     Thanks,
>     David S.
>    
> --
>
> Thanks,
> David S.
>

-- 
Nick

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

* Re: How to use org mode shell with ssh?
  2016-09-22 14:00         ` Colin Baxter
@ 2016-09-22 14:45           ` David A. Gershman
  2016-09-22 14:52           ` Nick Dokos
  1 sibling, 0 replies; 13+ messages in thread
From: David A. Gershman @ 2016-09-22 14:45 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

I'm not familiar with remote execution like this, but are you specifying
/zsh/ on the Windows side or is it somehow inherently being assumed for
the remote?  A quick little hack to try may be to copy the /zsh/
executable on Windows to /ash/ and see if it fools the remote side.

On 09/22/2016 07:00 AM, Colin Baxter wrote:
> On Thu, Sep 22 2016, Xi Shen wrote:
>
>> Instead of using ssh, I tried with scp. This time I got a different error.
>>
>> #+BEGIN_SRC shell :dir /scp:openwrt:/mnt/sda1
>> ls -al
>> #+END_SRC
>>
>> The error, I think, is from the remote end.
>>
>> /bin/sh: /bin/zsh: not found
>>
>> Clearly, I am using zsh on my Windows, but my remote OpenWRT system only has ash installed. Is
>> there's way to specify the shell to use on the remote end?
>>
> I can't help you here. I've never used openwrt. All I can suggest is to
> search openwrt documentation or try with cgywin.
>
> Good luck.


[-- Attachment #2: Type: text/html, Size: 1405 bytes --]

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

* Re: How to use org mode shell with ssh?
  2016-09-22 14:00         ` Colin Baxter
  2016-09-22 14:45           ` David A. Gershman
@ 2016-09-22 14:52           ` Nick Dokos
  2016-09-22 20:30             ` Fabrice Popineau
  1 sibling, 1 reply; 13+ messages in thread
From: Nick Dokos @ 2016-09-22 14:52 UTC (permalink / raw)
  To: emacs-orgmode

Colin Baxter <m43cap@yandex.com> writes:


>> #+BEGIN_SRC shell :dir /scp:openwrt:/mnt/sda1
>> ls -al
>> #+END_SRC
>>
>> The error, I think, is from the remote end.
>>
>> /bin/sh: /bin/zsh: not found
>>
>> Clearly, I am using zsh on my Windows, but my remote OpenWRT system only has ash installed. Is
>> there's way to specify the shell to use on the remote end?
>>
>
> I can't help you here. I've never used openwrt. All I can suggest is to
> search openwrt documentation or try with cgywin.
>

IIUC, openwrt is the name of the remote node - nothing to do with OpenWrt (except of course, that
the remote node may be a router which has been flashed with OpenWrt, but that should make no
difference to ssh/tramp).

-- 
Nick

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

* Re: How to use org mode shell with ssh?
  2016-09-22 14:52           ` Nick Dokos
@ 2016-09-22 20:30             ` Fabrice Popineau
  2016-09-23  8:32               ` Xi Shen
  0 siblings, 1 reply; 13+ messages in thread
From: Fabrice Popineau @ 2016-09-22 20:30 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2509 bytes --]

My $0.02

As I'm using Emacs on Windows, with MSYS2+MingW64, I tried this.
There is a problem with using bash from a _native_ MingW64 Emacs:
bash is a MSYS2 app and Emacs is a MingW64 app.

From emacs, I would have used the plink protocol, so that's what I did.
And I got this message in the *Org-Babel Error Output* buffer

/bin/sh: 1: C:/Local/Emacs/bin/cmdproxy.exe: not found

So I looked at ob-eval.el and the org-babel-eval function.
And there are at least 2 big problems.
1- when entering this function, the `command' parameter is
"C:/Local/Emacs/bin/cmdproxy.exe"
2 - the `shell-file-name' variable has the same value
So the following won't work for Windows :
        ;; Unfortunately, `executable-find' does not support file name
;; handlers.  Therefore, we could use it in the local case
;; only.
(shell-file-name
(cond ((and (not (file-remote-p default-directory))
    (executable-find shell-file-name))
shell-file-name)
      ((file-executable-p
(concat (file-remote-p default-directory) shell-file-name))
shell-file-name)
      ("/bin/sh")))

BTW I don't see the point concatenating shell-file-name with
default-directory when the later is remote.
Do we expect to find the shell in the remote directory ?

Anyway, there is little chance this stuff will work under Windows with a
native Emacs.
If I find time, I may try to propose some fix.

Fabrice


2016-09-22 16:52 GMT+02:00 Nick Dokos <ndokos@gmail.com>:

> Colin Baxter <m43cap@yandex.com> writes:
>
>
> >> #+BEGIN_SRC shell :dir /scp:openwrt:/mnt/sda1
> >> ls -al
> >> #+END_SRC
> >>
> >> The error, I think, is from the remote end.
> >>
> >> /bin/sh: /bin/zsh: not found
> >>
> >> Clearly, I am using zsh on my Windows, but my remote OpenWRT system
> only has ash installed. Is
> >> there's way to specify the shell to use on the remote end?
> >>
> >
> > I can't help you here. I've never used openwrt. All I can suggest is to
> > search openwrt documentation or try with cgywin.
> >
>
> IIUC, openwrt is the name of the remote node - nothing to do with OpenWrt
> (except of course, that
> the remote node may be a router which has been flashed with OpenWrt, but
> that should make no
> difference to ssh/tramp).
>
> --
> Nick
>
>
>


-- 
Fabrice Popineau
-----------------------------
SUPELEC
Département Informatique
3, rue Joliot Curie
91192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
Standard : +33 (0) 169851212
------------------------------

[-- Attachment #2: Type: text/html, Size: 4343 bytes --]

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

* Re: How to use org mode shell with ssh?
  2016-09-22 20:30             ` Fabrice Popineau
@ 2016-09-23  8:32               ` Xi Shen
  2016-09-23 10:49                 ` Fabrice Popineau
  0 siblings, 1 reply; 13+ messages in thread
From: Xi Shen @ 2016-09-23  8:32 UTC (permalink / raw)
  To: fabrice.popineau, Nick Dokos; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 3220 bytes --]

Hi,

On my Windows system, I have Cygwin setup, with Emacs as part of the Cygwin
installation. I also setup my Cygwin environment to use zsh. I started my
Emacs from this zsh environment. I think that's where org inherited this
setting.

I think when org execute my block, it some how assumed that it should use
the same shell at the remote end.

P.S. OpenWRT is the router OS. It is just a tiny Linux. Most people would
not install zsh on it :P


On Fri, Sep 23, 2016 at 4:35 AM Fabrice Popineau <
fabrice.popineau@supelec.fr> wrote:

> My $0.02
>
> As I'm using Emacs on Windows, with MSYS2+MingW64, I tried this.
> There is a problem with using bash from a _native_ MingW64 Emacs:
> bash is a MSYS2 app and Emacs is a MingW64 app.
>
> From emacs, I would have used the plink protocol, so that's what I did.
> And I got this message in the *Org-Babel Error Output* buffer
>
> /bin/sh: 1: C:/Local/Emacs/bin/cmdproxy.exe: not found
>
> So I looked at ob-eval.el and the org-babel-eval function.
> And there are at least 2 big problems.
> 1- when entering this function, the `command' parameter is
> "C:/Local/Emacs/bin/cmdproxy.exe"
> 2 - the `shell-file-name' variable has the same value
> So the following won't work for Windows :
>         ;; Unfortunately, `executable-find' does not support file name
> ;; handlers.  Therefore, we could use it in the local case
> ;; only.
> (shell-file-name
> (cond ((and (not (file-remote-p default-directory))
>     (executable-find shell-file-name))
> shell-file-name)
>       ((file-executable-p
> (concat (file-remote-p default-directory) shell-file-name))
> shell-file-name)
>       ("/bin/sh")))
>
> BTW I don't see the point concatenating shell-file-name with
> default-directory when the later is remote.
> Do we expect to find the shell in the remote directory ?
>
> Anyway, there is little chance this stuff will work under Windows with a
> native Emacs.
> If I find time, I may try to propose some fix.
>
> Fabrice
>
>
> 2016-09-22 16:52 GMT+02:00 Nick Dokos <ndokos@gmail.com>:
>
>> Colin Baxter <m43cap@yandex.com> writes:
>>
>>
>> >> #+BEGIN_SRC shell :dir /scp:openwrt:/mnt/sda1
>> >> ls -al
>> >> #+END_SRC
>> >>
>> >> The error, I think, is from the remote end.
>> >>
>> >> /bin/sh: /bin/zsh: not found
>> >>
>> >> Clearly, I am using zsh on my Windows, but my remote OpenWRT system
>> only has ash installed. Is
>> >> there's way to specify the shell to use on the remote end?
>> >>
>> >
>> > I can't help you here. I've never used openwrt. All I can suggest is to
>> > search openwrt documentation or try with cgywin.
>> >
>>
>> IIUC, openwrt is the name of the remote node - nothing to do with OpenWrt
>> (except of course, that
>> the remote node may be a router which has been flashed with OpenWrt, but
>> that should make no
>> difference to ssh/tramp).
>>
>> --
>> Nick
>>
>>
>>
>
>
> --
> Fabrice Popineau
> -----------------------------
> SUPELEC
> Département Informatique
> 3, rue Joliot Curie
> 91192 Gif/Yvette Cedex
> Tel direct : +33 (0) 169851950
> Standard : +33 (0) 169851212
> ------------------------------
>
> --


Thanks,
David S.

[-- Attachment #2: Type: text/html, Size: 5144 bytes --]

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

* Re: How to use org mode shell with ssh?
  2016-09-23  8:32               ` Xi Shen
@ 2016-09-23 10:49                 ` Fabrice Popineau
  2016-09-24  0:40                   ` Xi Shen
  0 siblings, 1 reply; 13+ messages in thread
From: Fabrice Popineau @ 2016-09-23 10:49 UTC (permalink / raw)
  To: Xi Shen; +Cc: Nick Dokos, emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

2016-09-23 10:32 GMT+02:00 Xi Shen <davidshen84@gmail.com>:

> Hi,
>
> On my Windows system, I have Cygwin setup, with Emacs as part of the
> Cygwin installation.
>

Cygwin Emacs is not a native Emacs (AFAIK). The difference is in the way it
groks pathnames
and other stuff like the default shell.

I also setup my Cygwin environment to use zsh. I started my Emacs from this
> zsh environment. I think that's where org inherited this setting.
>
> I think when org execute my block, it some how assumed that it should use
> the same shell at the remote end.
>

The portion of code I pointed out does not make sense to me and it may be
responsible for your problem.

Fabrice

[-- Attachment #2: Type: text/html, Size: 1272 bytes --]

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

* Re: How to use org mode shell with ssh?
  2016-09-23 10:49                 ` Fabrice Popineau
@ 2016-09-24  0:40                   ` Xi Shen
  0 siblings, 0 replies; 13+ messages in thread
From: Xi Shen @ 2016-09-24  0:40 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: Nick Dokos, emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 980 bytes --]

I got it :)

After reading
http://orgmode.org/cgit.cgi/org-mode.git/tree/lisp/ob-shell.el#n57, I found
I can simply specify the shell name in the block.


On Fri, Sep 23, 2016 at 6:50 PM Fabrice Popineau <
fabrice.popineau@centralesupelec.fr> wrote:

> 2016-09-23 10:32 GMT+02:00 Xi Shen <davidshen84@gmail.com>:
>
>> Hi,
>>
>> On my Windows system, I have Cygwin setup, with Emacs as part of the
>> Cygwin installation.
>>
>
> Cygwin Emacs is not a native Emacs (AFAIK). The difference is in the way
> it groks pathnames
> and other stuff like the default shell.
>
> I also setup my Cygwin environment to use zsh. I started my Emacs from
>> this zsh environment. I think that's where org inherited this setting.
>>
>> I think when org execute my block, it some how assumed that it should use
>> the same shell at the remote end.
>>
>
> The portion of code I pointed out does not make sense to me and it may be
> responsible for your problem.
>
> Fabrice
>
-- 


Thanks,
David S.

[-- Attachment #2: Type: text/html, Size: 2358 bytes --]

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

end of thread, other threads:[~2016-09-24  0:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-22  1:02 How to use org mode shell with ssh? Xi Shen
2016-09-22  1:15 ` William Denton
2016-09-22  8:52   ` Colin Baxter
2016-09-22 12:15     ` Xi Shen
2016-09-22 12:37       ` Xi Shen
2016-09-22 14:00         ` Colin Baxter
2016-09-22 14:45           ` David A. Gershman
2016-09-22 14:52           ` Nick Dokos
2016-09-22 20:30             ` Fabrice Popineau
2016-09-23  8:32               ` Xi Shen
2016-09-23 10:49                 ` Fabrice Popineau
2016-09-24  0:40                   ` Xi Shen
2016-09-22 14:38         ` Nick Dokos

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.