From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Albinus Subject: Re: [BUG] remote execution in heterogeneous environment Date: Tue, 08 Jan 2013 09:36:55 +0100 Message-ID: <87ip78gjfc.fsf@gmx.de> References: <6D36E0F9-01D1-4F95-9FAA-B2B2CA10E57E@gmail.com> <87623zaj4j.fsf@gmx.de> <87hang279z.fsf@gmx.de> <87ip79q6x6.fsf_-_@Rainer.invalid> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:52844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsUgE-00057C-Lv for emacs-orgmode@gnu.org; Tue, 08 Jan 2013 03:37:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsUgD-0005ad-EI for emacs-orgmode@gnu.org; Tue, 08 Jan 2013 03:37:06 -0500 Received: from mout.gmx.net ([212.227.17.20]:64856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsUgD-0005aV-4l for emacs-orgmode@gnu.org; Tue, 08 Jan 2013 03:37:05 -0500 Received: from mailout-de.gmx.net ([10.1.76.29]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0MaXUl-1TYLOr02wr-00KBvq for ; Tue, 08 Jan 2013 09:37:04 +0100 References: <6D36E0F9-01D1-4F95-9FAA-B2B2CA10E57E@gmail.com> <87623zaj4j.fsf@gmx.de> <87hang279z.fsf@gmx.de> <87ip79q6x6.fsf_-_@Rainer.invalid> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Achim Gratz Cc: emacs-orgmode@gnu.org Achim Gratz writes: >> + (let ((input-file (org-babel-temp-file "input-")) >> + (error-file (if error-buffer (org-babel-temp-file "scor-") nil)) >> + (shell-file-name >> + (if (file-executable-p >> + (concat (file-remote-p default-directory) shell-file-name)) >> + shell-file-name >> + "/bin/sh")) > > The hard-coded /bin/sh breaks testing with NT-Emacs and using Cygwin as > the backend because of the different path conventions in both > environments. This is a hack, but it works when setting SHELL=3Ddash, > note that there are no path components in there and even if your test > would fail: NTEmacs knows nothing about Cygwin's path. Can you please > arrange that shell-file-name is used without alteration when the > execution is local? Even for remote execution hardcoding /bin/sh seems > a bit heavy-handed to me=E2=80=A6 What about this: --8<---------------cut here---------------start------------->8--- --- a/lisp/ob-eval.el +++ b/lisp/ob-eval.el @@ -137,11 +137,17 @@ specifies the value of ERROR-BUFFER." t))) (let ((input-file (org-babel-temp-file "input-")) (error-file (if error-buffer (org-babel-temp-file "scor-") nil)) + ;; Unfortunately, `executable-find' does not support file name + ;; handlers. Therefore, we could use it in the local case + ;; only. (shell-file-name - (if (file-executable-p - (concat (file-remote-p default-directory) shell-file-name)) - shell-file-name - "/bin/sh")) + (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"))) exit-status) ;; There is an error in `process-file' when `error-file' exists. ;; This is fixed in Emacs trunk as of 2012-12-21; let's use this --8<---------------cut here---------------end--------------->8--- The use of "/bin/sh" as fallback should be OK. In the local case, the first cond clause shall be selected (otherwise there is something really wrong). And for remote execution, "/bin/sh" should exist execept in case of remote MS Windows or Android devices. Once you want run shells from org there, we could even tweak this :-) > Regards, > Achim. Best regards, Michael.