From mboxrd@z Thu Jan 1 00:00:00 1970 From: Felipe Lema Subject: correct remote path handling Date: Mon, 24 Feb 2020 22:36:12 -0300 Message-ID: <1873694.uLqJpLN6Zz@linux-q1p8> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart5908218.bLyAiFCvWF" Content-Transfer-Encoding: 7Bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:60610) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6P94-0005fE-Lt for emacs-orgmode@gnu.org; Mon, 24 Feb 2020 20:36:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6P93-0002NH-9N for emacs-orgmode@gnu.org; Mon, 24 Feb 2020 20:36:22 -0500 Received: from devianza.investici.org ([198.167.222.108]:58739) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6P92-0002Lg-Nf for emacs-orgmode@gnu.org; Mon, 24 Feb 2020 20:36:21 -0500 Received: from mx2.investici.org (unknown [127.0.0.1]) by devianza.investici.org (Postfix) with ESMTP id 58307E064D for ; Tue, 25 Feb 2020 01:36:16 +0000 (UTC) Received: from [198.167.222.108] (mx2.investici.org [198.167.222.108]) (Authenticated sender: felipelema@mortemale.org) by localhost (Postfix) with ESMTPSA id CDC99E061F for ; Tue, 25 Feb 2020 01:36:15 +0000 (UTC) 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --nextPart5908218.bLyAiFCvWF Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 --nextPart5908218.bLyAiFCvWF Content-Disposition: attachment; filename="0001-Squashed-commit-of-the-following.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="utf-8"; name="0001-Squashed-commit-of-the-following.patch" >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 --nextPart5908218.bLyAiFCvWF Content-Disposition: attachment; filename="0002-use-this-script-file-should-be-local-to-interpreter-.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="utf-8"; name="0002-use-this-script-file-should-be-local-to-interpreter-.patch" >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 --nextPart5908218.bLyAiFCvWF--