GNU bug report logs - #18782
24.3; Eshell constructs bad path when executing script in current directory on remote host

Previous Next

Package: emacs;

Reported by: rekado <rekado <at> elephly.net>

Date: Tue, 21 Oct 2014 09:48:01 UTC

Severity: normal

Found in version 24.3

Fixed in version 25.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18782 in the body.
You can then email your comments to 18782 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18782; Package emacs. (Tue, 21 Oct 2014 09:48:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to rekado <rekado <at> elephly.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 21 Oct 2014 09:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: rekado <rekado <at> elephly.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3;
 Eshell constructs bad path when executing script in current directory
 on remote host
Date: Tue, 21 Oct 2014 10:40:48 +0200
I often use Eshell to connect to remote systems.  On those remote
systems I sometimes want to run scripts in the current directory.  In a
regular terminal I'd do this:

    localhost:~ $ ssh remote
    remote:~ $ ./my-script.sh
    Hello World
    remote:~ $ 

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 $ 

It only works if I provide the complete TRAMP path to the script:

    /ssh:remote:/home/rekado $ /ssh:remote:/home/rekado/my-script.sh 
    Hello World
    /ssh:remote:/home/rekado $ 

I'm not sure if this is a problem with TRAMP or eshell (or with the way
I use them).


~~~
In GNU Emacs 24.3.1 (i686-redhat-linux-gnu, GTK+ Version 3.10.9)
 of 2014-09-30 on buildhw-01.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11404000
Configured using:
 `configure '--build=i686-redhat-linux-gnu'
 '--host=i686-redhat-linux-gnu' '--program-prefix='
 '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr'
 '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
 '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib'
 '--libexecdir=/usr/libexec' '--localstatedir=/var'
 '--sharedstatedir=/var/lib' '--mandir=/usr/share/man'
 '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg'
 '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm'
 '--with-x-toolkit=gtk3' '--with-gpm=no'
 'build_alias=i686-redhat-linux-gnu' 'host_alias=i686-redhat-linux-gnu'
 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -m32 -march=i686 -mtune=atom
 -fasynchronous-unwind-tables' 'LDFLAGS=-Wl,-z,relro ''

Important settings:
  value of $LC_MONETARY: en_US.utf8
  value of $LC_NUMERIC: en_US.utf8
  value of $LC_TIME: en_US.utf8
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Minor modes in effect:
  display-time-mode: t
  shell-switcher-mode: t
  magit-auto-revert-mode: t
  diff-auto-refine-mode: t
  my-global-centered-cursor-mode: t
  centered-cursor-mode: t
  desktop-save-mode: t
  global-whitespace-mode: t
  fullscreen-mode: t
  ido-yes-or-no-mode: t
  ido-ubiquitous-mode: t
  shell-dirtrack-mode: t
  global-paren-face-mode: t
  show-paren-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t


Load-path shadows:
~/.emacs.d/custom hides /usr/share/emacs/24.3/lisp/custom

Features:
(shadow emacsbug hippie-exp woman man misearch multi-isearch em-unix
em-term term ehelp electric em-script em-prompt em-ls em-hist em-pred
em-glob em-dirs em-cmpl em-basic em-banner em-alias haskell-doc
inf-haskell haskell-cabal haskell-utils haskell-decl-scan imenu
haskell-indentation haskell-font-lock haskell-mode haskell-string
haskell-sort-imports haskell-align-imports haskell-compat
haskell-complete-module flymake etags dabbrev inf-ruby ruby-mode sql
vc-git org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc
org-jsinfo org-infojs org-html org-exp ob-exp org-exp-blocks org-agenda
org-info org-gnus org-docview org-bibtex bibtex org-bbdb org ob-tangle
ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys
org-pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob org-compat org-macs ob-eval org-loaddefs
find-func cal-menu calendar cal-loaddefs time linum page-break-lines
shell-switcher rswitcher esh-var esh-io esh-cmd esh-opt esh-ext esh-proc
esh-arg eldoc esh-groups eshell esh-module esh-mode esh-util
magit-key-mode magit view grep compile diff-mode autorevert
git-rebase-mode thingatpt git-commit-mode server log-edit pcvs-util
add-log god-mode mu4e mu4e-speedbar speedbar sb-image ezimage dframe
mu4e-main mu4e-view epa derived epg epg-config browse-url mu4e-headers
mu4e-compose mu4e-draft mu4e-actions rfc2368 smtpmail mu4e-mark
mu4e-message html2text mu4e-proc mu4e-utils doc-view jka-compr
image-mode mu4e-lists mu4e-about mu4e-vars message sendmail rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev mail-utils gmm-utils mailheader hl-line cl
mu4e-meta smex easy-mmode centered-cursor-mode re-builder desktop
disp-table whitespace fullscreen-mode ido-yes-or-no ido-ubiquitous
warnings tramp tramp-compat auth-source eieio byte-opt bytecomp
byte-compile cconv gnus-util mm-util mail-prsvr password-cache
tramp-loaddefs shell pcomplete comint ansi-color ring help-mode dired+
image-dired format-spec image-file dired-x dired-aux dired
visual-regexp-steroids visual-regexp smart-mode-line-respectful-theme
rich-minority smart-mode-line mule-util spolsky-theme paren-face
better-defaults ac-inf-ruby-autoloads ace-jump-mode-autoloads
auctex-autoloads tex-site auto-complete-autoloads
better-defaults-autoloads paren saveplace uniquify advice advice-preload
ido centered-cursor-mode-autoloads dired+-autoloads
dired-details-autoloads erc-hl-nicks-autoloads expand-region-autoloads
fullscreen-mode-autoloads geiser-autoloads god-mode-autoloads
haskell-mode-autoloads helm-autoloads htmlize-autoloads
hungry-delete-autoloads ido-ubiquitous-autoloads ido-yes-or-no-autoloads
idomenu-autoloads inf-ruby-autoloads magit-autoloads info easymenu
git-rebase-mode-autoloads git-commit-mode-autoloads
markdown-mode-autoloads multiple-cursors-autoloads
page-break-lines-autoloads paredit-autoloads paren-face-autoloads
popup-autoloads projectile-autoloads pkg-info-autoloads
rect-mark-autoloads ruby-block-autoloads scss-mode-autoloads
shell-switcher-autoloads edmacro kmacro skewer-mode-autoloads
js2-mode-autoloads simple-httpd-autoloads smart-mode-line-autoloads
rich-minority-autoloads smex-autoloads sublime-themes-autoloads
undo-tree-autoloads visual-regexp-steroids-autoloads
visual-regexp-autoloads web-mode-autoloads yasnippet-autoloads
znc-autoloads cask help-fns cl-macs gv cask-bootstrap package-build json
lisp-mnt shut-up epl git commander cl-lib f dash s ucs-normalize
commander-autoloads epl-autoloads git-autoloads f-autoloads
dash-autoloads package-build-autoloads s-autoloads shut-up-autoloads
finder-inf package time-date tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18782; Package emacs. (Fri, 19 Dec 2014 16:38:02 GMT) Full text and rfc822 format available.

Message #8 received at 18782 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: rekado <rekado <at> elephly.net>
Cc: 18782 <at> debbugs.gnu.org
Subject: Re: bug#18782: 24.3;
 Eshell constructs bad path when executing script in current directory
 on remote host
Date: Fri, 19 Dec 2014 17:36:49 +0100
rekado <rekado <at> elephly.net> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18782; Package emacs. (Tue, 23 Dec 2014 17:54:01 GMT) Full text and rfc822 format available.

Message #11 received at 18782 <at> debbugs.gnu.org (full text, mbox):

From: rekado <rekado <at> elephly.net>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 18782 <at> debbugs.gnu.org
Subject: Re: bug#18782: 24.3;
 Eshell constructs bad path when executing script in current directory
 on remote host
Date: Tue, 23 Dec 2014 18:53:30 +0100
Michael Albinus writes:
> 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?

I tried this patch in Emacs 24.4 and it works for me.
Thank you.

-- rekado





Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Wed, 24 Dec 2014 08:56:01 GMT) Full text and rfc822 format available.

Notification sent to rekado <rekado <at> elephly.net>:
bug acknowledged by developer. (Wed, 24 Dec 2014 08:56:02 GMT) Full text and rfc822 format available.

Message #16 received at 18782-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: rekado <rekado <at> elephly.net>
Cc: 18782-done <at> debbugs.gnu.org
Subject: Re: bug#18782: 24.3;
 Eshell constructs bad path when executing script in current directory
 on remote host
Date: Wed, 24 Dec 2014 09:55:05 +0100
Version: 25.1

rekado <rekado <at> elephly.net> writes:

> I tried this patch in Emacs 24.4 and it works for me.
> Thank you.

Thanks for confirmation. I've committed the patch to the trunk, closing
the bug.

> -- rekado

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 21 Jan 2015 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 203 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.