Hello, there

I bumped into a problem running src blocks using a remote (tramp) :dir. I've 
looked into it and found that the problem is that a temporary file is passed 
as a remote path to the remote process (temp file should be local to remote 
process).

I'm attaching fixes for python and shell src blocks. I didn't add any tests 
because that would require more than 15 LOC. I'm willing to add them, but 
directly to git repo.

I've signed the necessary papers from (to?) the FSF involving org mode, so I'm 
ready on my side to add tests and maybe add support for other tramp-related 
stuff.

Thanks
Felipe
>From e902f40842a20baa0c4a2ca462b83d9ce949a19f Mon Sep 17 00:00:00 2001
From: Felipe Lema <1232306+felipel...@users.noreply.github.com>
Date: Fri, 21 Feb 2020 14:34:53 -0300
Subject: [PATCH 1/2] Squashed commit of the following:

commit 6ea888f432b5eeb3559706e336a752791f48d7fb
Author: Felipe Lema <1232306+felipel...@users.noreply.github.com>
Date:   Fri Feb 21 11:25:51 2020 -0300

    fix evaluate python code in remote directory

    Evaluating an "AST python code" should be local to the process /
    directory.

    `file-local-name` will do just this (strip the tramp prefix in path)
---
 lisp/ob-python.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index dbcfac08d..85c9644c4 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -345,7 +345,8 @@ last statement in BODY, as elisp."
 					      "python-")))
 			   (with-temp-file tmp-src-file (insert body))
 			   (format org-babel-python--eval-ast
-				   tmp-src-file))))
+				   (file-local-name
+				    tmp-src-file)))))
                (org-babel-comint-with-output
                    (session org-babel-python-eoe-indicator nil body)
                  (let ((comint-process-echoes nil))
-- 
2.16.4

>From d9d1c4180c86f38653ebdb0eb2e0a9d5865df0de Mon Sep 17 00:00:00 2001
From: Felipe Lema <1232306+felipel...@users.noreply.github.com>
Date: Fri, 21 Feb 2020 14:35:35 -0300
Subject: [PATCH 2/2] "use this script file" should be local to interpreter
 we're using

---
 lisp/ob-shell.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-shell.el b/lisp/ob-shell.el
index 6c8ca9652..8dce9c7dd 100644
--- a/lisp/ob-shell.el
+++ b/lisp/ob-shell.el
@@ -240,7 +240,8 @@ return the value of the last statement in BODY."
 	      (with-temp-buffer
 		(call-process-shell-command
 		 (concat (if shebang script-file
-			   (format "%s %s" shell-file-name script-file))
+			   (format "%s %s" shell-file-name
+				   (file-local-name script-file)))
 			 (and cmdline (concat " " cmdline)))
 		 stdin-file
 		 (current-buffer))
-- 
2.16.4

Reply via email to