From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xi Shen Subject: Re: How to use org mode shell with ssh? Date: Fri, 23 Sep 2016 08:32:33 +0000 Message-ID: References: <87eg4c8gfs.fsf@yandex.com> <87lgykrq3x.fsf@yandex.com> <874m58yokc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113c37ba494040053d289f37 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnLuY-0005ws-DV for emacs-orgmode@gnu.org; Fri, 23 Sep 2016 04:32:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnLuW-0006yf-Qd for emacs-orgmode@gnu.org; Fri, 23 Sep 2016 04:32:46 -0400 Received: from mail-oi0-x233.google.com ([2607:f8b0:4003:c06::233]:34611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnLuW-0006xu-Jk for emacs-orgmode@gnu.org; Fri, 23 Sep 2016 04:32:44 -0400 Received: by mail-oi0-x233.google.com with SMTP id a62so126954242oib.1 for ; Fri, 23 Sep 2016 01:32:44 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: fabrice.popineau@centralesupelec.fr, Nick Dokos Cc: "emacs-orgmode@gnu.org" --001a113c37ba494040053d289f37 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 : > >> Colin Baxter 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 t= o >> > search openwrt documentation or try with cgywin. >> > >> >> IIUC, openwrt is the name of the remote node - nothing to do with OpenWr= t >> (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=C3=A9partement Informatique > 3, rue Joliot Curie > 91192 Gif/Yvette Cedex > Tel direct : +33 (0) 169851950 > Standard : +33 (0) 169851212 > ------------------------------ > > -- Thanks, David S. --001a113c37ba494040053d289f37 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

On my Windows system, I have Cygwin= setup, with Emacs as part of the Cygwin installation. I also setup my Cygw= in 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 o= n 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= 9;s what I did.
And I got this message in the *Org-Babel Error Ou= tput* buffer

/bin/sh: 1: C:/Local/Emacs/bin/cmdpro= xy.exe: not found

So I looked at ob-eval.el an= d the org-babel-eval function.=C2=A0
And there are at least 2 big= problems.
1- when entering this function, the `command' para= meter is "C:/Local/Emacs/bin/cmdproxy.exe"
2 - the `she= ll-file-name' variable has the same value
So the following wo= n't work for Windows :
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Un= fortunately, `executable-find' does not support file name
;; handlers.=C2=A0 Therefore, we = could use it in the local case
;; only.
= (shell-file-name
(c= ond ((and (not (file-remote-p default-directory))
=C2=A0 =C2=A0 (executable-find shell-file-n= ame))
shell-file-na= me)
=C2=A0 =C2=A0 = =C2=A0 ((file-executable-p
= (concat (file-remote-p default-directory) shell-file-name))
<= div> shell-file-name)
=C2=A0 =C2=A0 =C2=A0 ("= ;/bin/sh")))

BTW I don't see the po= int concatenating shell-file-name with default-directory when the later is = remote.
Do we expect to find the shell in the remote directory ?<= /div>

Anyway, there is little chance this stuff will wor= k 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<= /a>>:
Colin Baxter <m43cap@yandex.com&= gt; 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 syste= m 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 sugg= est is to
> search openwrt documentation or try with cgywin.
>

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

--
Nick





--
= Fabrice Popineau
-----------------------------
SUPELEC
<= div>D=C3=A9partement Informatique
3, rue Joliot Curie
9= 1192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
St= andard : +33 (0) 169851212
------------------------------

--


Thanks,
David S.

--001a113c37ba494040053d289f37--