Subject: Re: bug#18782: 24.3; Eshell constructs bad path when executing script in current directory on remote host

From: Michael Albinus <[email-masked]>
Date: Fri, 19 Dec 2014 17:36:49 +0100

rekado <[email-masked]> writes:

> In Eshell this does not work:
>
>     ~ $ cd /remote:~
>     /ssh:remote:/home/rekado $ ./my-script.sh
>     env: /ssh:remote:/home/rekado/my-script.sh: No such file or directory
>     /ssh:remote:/home/rekado $ 

I've debugged this problem. Looks like the following patch in eshell
solves it:

--8<---------------cut here---------------start------------->8---
*** /usr/local/src/emacs/lisp/eshell/esh-ext.el.~master~	2014-12-19 17:33:32.333535651 +0100
--- /usr/local/src/emacs/lisp/eshell/esh-ext.el	2014-12-19 16:21:34.443196286 +0100
***************
*** 296,301 ****
--- 296,306 ----
        (let ((fullname (if (file-name-directory file) file
  			(eshell-search-path file)))
  	    (suffixes eshell-binary-suffixes))
+ 	(if (and fullname
+ 		 (not (file-remote-p fullname))
+ 		 (file-remote-p default-directory))
+ 	    (setq fullname (expand-file-name
+ 			    (concat "./" fullname) default-directory)))
  	(if (and fullname (not (or eshell-force-execution
  				   (file-executable-p fullname))))
  	    (while suffixes
--8<---------------cut here---------------end--------------->8---

Could you, please, check?

Best regards, Michael.