emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Achim Gratz <Stromeko@nexgo.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] remote execution in heterogeneous environment
Date: Tue, 08 Jan 2013 09:36:55 +0100	[thread overview]
Message-ID: <87ip78gjfc.fsf@gmx.de> (raw)
In-Reply-To: 87ip79q6x6.fsf_-_@Rainer.invalid

Achim Gratz <Stromeko@nexgo.de> 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=dash,
> 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…

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.

  reply	other threads:[~2013-01-08  8:37 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6D36E0F9-01D1-4F95-9FAA-B2B2CA10E57E@gmail.com>
2012-12-18  7:56 ` remote execution in heterogeneous environment Michael Albinus
2012-12-20 13:16   ` Michael Albinus
2012-12-20 16:39     ` Bastien
2012-12-20 16:59       ` Achim Gratz
2012-12-20 17:09         ` Nick Dokos
2012-12-20 17:15           ` Bastien
2012-12-20 17:12         ` Bastien
2012-12-20 20:25           ` Achim Gratz
2012-12-20 17:23         ` Michael Albinus
2012-12-20 17:30           ` Bastien
2012-12-21  8:24             ` Michael Albinus
2012-12-21  8:51               ` Bastien
2012-12-21 17:32               ` Nick Dokos
2012-12-21  1:21       ` George Jones
2012-12-21  8:27         ` Michael Albinus
2012-12-22 13:32           ` George
2012-12-22 13:36           ` George
2012-12-22 13:48             ` Michael Albinus
     [not found]               ` <CAOhM7yVOvrL0F8v1hAnxb4z0Mw0kTf6L6_uZk5o7T3W08geUeg@mail.gmail.com>
     [not found]                 ` <CAOhM7yXmD3OEhBt66Ts9YG+8s9LKhkw0-BT0grh734fH07p2pw@mail.gmail.com>
2012-12-23 14:10                   ` Michael Albinus
2012-12-23 15:14                     ` Bastien
2012-12-23 16:09                       ` Michael Albinus
2012-12-23 16:47                         ` Bastien
2012-12-23 17:53                           ` George Jones
2012-12-23 19:54                             ` Bastien
2012-12-23 21:37                               ` George Jones
2012-12-24 13:38                                 ` Michael Albinus
2013-01-07 16:44     ` [BUG] " Achim Gratz
2013-01-08  8:36       ` Michael Albinus [this message]
2013-01-08 17:30         ` Achim Gratz
2013-01-08 18:02           ` Eric Schulte
2013-01-08 21:11           ` Michael Albinus
2013-01-09  7:31         ` Achim Gratz
2013-01-09  8:16           ` Michael Albinus
2013-01-09 11:49             ` Bastien
2013-01-09 13:05               ` Michael Albinus
2013-01-09 13:11                 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ip78gjfc.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=Stromeko@nexgo.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).