Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs 24.3 for windows, Tramp byte-code: Couldn't find a proper `ls' command

24.2 works well, but 24.3 bounded tramp got following error when open remote Linux system files or directories:

"byte-code: Couldn't find a proper `ls' command"

I open tramp trace and find that, all remote search path and file path are extend by something, adding a extra "c:" at the beginning. The results is that tramp can find neither command nor file I want to open.

16:04:51.768000 tramp-get-connection-property (7) # process-buffer nil
16:04:51.769000 tramp-set-file-property (8) # c:/bin file-directory-p nil 
16:04:51.770000 tramp-get-file-property (8) # c:/usr/bin file-directory-p undef 
... 
16:04:59.531000 tramp-sh-handle-file-truename (5) # Check /c: 
16:04:59.532000 tramp-get-file-property (8) # c:/c: file-attributes-integer undef 
... 
16:04:51.773000 tramp-get-connection-property (7) # process-name nil 
16:04:51.773000 tramp-get-connection-property (7) # chunksize 0 
16:04:51.773000 tramp-set-connection-property (7) # last-cmd-time (20809 28067 773000 0) 
16:04:51.774000 tramp-send-string (10) # test -d c\:/usr/bin 2>/dev/null; echo tramp_exit_status $? 

Anyone know something about this? Thanks in advance.

like image 311
Carthage Avatar asked Mar 21 '13 05:03

Carthage


2 Answers

Merging the answer by @AlanThird and the comment by @uscjeremy, here is what worked for me (GNU Emacs 24.3.1 (i386-mingw-nt5.1.2600) of 2013-03-17 on MARVIN, Windows XP/SP3/32):

  1. Byte compile tramp-sh.el (adapt path accordingly):

    (byte-compile-file "C:/Program Files (X86)/emacs/lisp/net/tramp-sh.el")
    
  2. Exit Emacs.

  3. Delete Tramp cache: ~/.emacs.d/tramp

  4. Start Emacs.

See also bug report #14030 on gnu.org.

like image 177
feklee Avatar answered Oct 03 '22 01:10

feklee


It seems this is a bug in tramp but you don't need to upgrade tramp, all you have to do is recompile tramp-sh.el on a Windows box. See the bug report here for more information.

Enter this on the scratch buffer:

(byte-compile-file "C:/Program Files/emacs/lisp/net/tramp-sh.el")

adjusting the path to match your install, then type Ctrl-Meta-x to recompile the file. If it complains about permissions you might need to restart emacs using the "run as administrator" option in Windows.

Once the file is recompiled type M-x tramp-cleanup-all-connections in order to reset the tramp connection cache. This will close any tramp connections you have open.

like image 34
Alan Third Avatar answered Oct 03 '22 03:10

Alan Third