From: Felipe Lema <felipelema@mortemale.org>
To: emacs-orgmode@gnu.org
Subject: correct remote path handling
Date: Mon, 24 Feb 2020 22:36:12 -0300 [thread overview]
Message-ID: <1873694.uLqJpLN6Zz@linux-q1p8> (raw)
[-- 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
next reply other threads:[~2020-02-25 1:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 1:36 Felipe Lema [this message]
2020-02-25 15:54 ` correct remote path handling Jack Kamm
2020-02-25 19:14 ` Bastien
2020-02-27 1:58 ` Felipe Lema
2020-02-29 16:22 ` Jack Kamm
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=1873694.uLqJpLN6Zz@linux-q1p8 \
--to=felipelema@mortemale.org \
--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).