emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* correct remote path handling
@ 2020-02-25  1:36 Felipe Lema
  2020-02-25 15:54 ` Jack Kamm
  0 siblings, 1 reply; 5+ messages in thread
From: Felipe Lema @ 2020-02-25  1:36 UTC (permalink / raw)
  To: emacs-orgmode

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

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

[-- Attachment #2: 0001-Squashed-commit-of-the-following.patch --]
[-- Type: text/x-patch, Size: 1235 bytes --]

From e902f40842a20baa0c4a2ca462b83d9ce949a19f Mon Sep 17 00:00:00 2001
From: Felipe Lema <1232306+FelipeLema@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+FelipeLema@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


[-- Attachment #3: 0002-use-this-script-file-should-be-local-to-interpreter-.patch --]
[-- Type: text/x-patch, Size: 854 bytes --]

From d9d1c4180c86f38653ebdb0eb2e0a9d5865df0de Mon Sep 17 00:00:00 2001
From: Felipe Lema <1232306+FelipeLema@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


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

end of thread, other threads:[~2020-02-29 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25  1:36 correct remote path handling Felipe Lema
2020-02-25 15:54 ` Jack Kamm
2020-02-25 19:14   ` Bastien
2020-02-27  1:58     ` Felipe Lema
2020-02-29 16:22       ` Jack Kamm

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).