From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Erroneous "No such file or directory" with babel and remote dir Date: Wed, 26 Sep 2012 14:38:44 -0400 Message-ID: <3059.1348684724@alphaville> References: <87y5kiq71h.fsf@slate.zedat.fu-berlin.de> <87vcfapgfy.fsf@bzg.ath.cx> <87a9wd56i6.fsf@slate.zedat.fu-berlin.de> <878vbwhczx.fsf@Rainer.invalid> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGwVU-0003PQ-4f for emacs-orgmode@gnu.org; Wed, 26 Sep 2012 14:38:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGwVS-0007M0-Cd for emacs-orgmode@gnu.org; Wed, 26 Sep 2012 14:38:48 -0400 Received: from g6t0184.atlanta.hp.com ([15.193.32.61]:16622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGwVS-0007Lt-7J for emacs-orgmode@gnu.org; Wed, 26 Sep 2012 14:38:46 -0400 In-Reply-To: Message from Achim Gratz of "Wed, 26 Sep 2012 20:09:54 +0200." <878vbwhczx.fsf@Rainer.invalid> 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.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Achim Gratz Cc: emacs-orgmode@gnu.org Achim Gratz wrote: > Loris Bennett writes: > >> Can you try to bisect and find the bad commit (or a set of > >> suspicious ones)? > > > > 552b0edb254a104e441e28f3a942dc6005e97f87 is the first bad commit > > commit 552b0edb254a104e441e28f3a942dc6005e97f87 > > Author: Bastien Guerry > > Date: Sat Mar 17 15:44:41 2012 +0100 > > This is not the commit you're looking for... > > Please "skip" these commits after starting the bisect by doing > > git bisect skip 7e903acccd..df82832fb7 > > If the offending change is inside that range we can still deal with it > later. > > I sent mail to Eric with some partial findings about this, but I guess I should have sent it to the list as well. Here is what I sent to Eric (slightly edited by adding a few commas): --8<---------------cut here---------------start------------->8--- Eric, I went back to the above problem (see http://thread.gmane.org/gmane.emacs.orgmode/57152/focus=60469 and the associated thread) and I think I have taken it a bit further. 5cb80c7e5b9bca introduced the following bit of code at the end of org-babel-sh-evaluate: ,---- | ('otherwise ; external shell script | - (org-babel-eval org-babel-sh-command (org-babel-trim body)))))) | + (if (cdr (assoc :shebang params)) | + (let ((script-file (org-babel-temp-file "sh-script-")) | + (shebang (cdr (assoc :shebang params))) | + (padline (not (string= "no" (cdr (assoc :padline params)))))) | + (with-temp-file script-file | + (when shebang (insert (concat shebang "\n"))) | + (when padline (insert "\n")) | + (insert body)) | + (set-file-modes script-file #o755) | + (org-babel-eval script-file "")) | + (org-babel-eval org-babel-sh-command (org-babel-trim body))))))) `---- So before, there was no if and we went straight into the org-babel-eval. Now, the ``if'' seems to succeed all the time: the (cdr ..) returns "" with Loris's example and (org-babel-eval script-file "") returns nil. If I modify the condition so that it takes the false path and executes the (org-babel-eval org-babel-sh-command (org-babel-trim body)) form, it works. I have no idea if this is correct - but it does seem to me that in this particular case, it's taking the wrong branch: in particular, if no shebang is specified, it should go the way it used to before this change. Of course, there is also the problem of specifying a shebang *and* a remote dir which is not handled correctly by this modification. For the record, the change I made was: - (if (cdr (assoc :shebang params)) + (if (not (string= (cdr (assoc :shebang params)) "")) It's at the very least incomplete and it may be wrong, but I thought I'd let you know. --8<---------------cut here---------------end--------------->8--- HTH, Nick