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

4

18

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.

Capers answered 21/3, 2013 at 5:32 Comment(0)
G
3

I had the same problem after switching to Emacs 24.3. The solution was to upgrade to the latest Tramp 2.2.7. Here is what I did:

  1. downloaded http://ftp.gnu.org/gnu/tramp/tramp-2.2.7.tar.gz
  2. unpacked the archive to my ~/.emacs.d/src. I am using emacs-starter-kit which adds this directory and all its subdirectories to the load-path. Otherwise follow the instructions in the Tramp's INSTALL file.
  3. used Cygwin bash to configure and compile the files. I don't use Cygwin's Emacs normally but it is convenient to have it for occasions like this.
  4. deleted the old tramp's el and elc files in my emacs/lisp/net for safety.
  5. restarted Emacs of course.

Do M-x tramp-version to make sure it is installed correctly. Now tramp works everywhere (dired, eshell, shell, etc).

Geocentric answered 21/3, 2013 at 17:15 Comment(7)
Thanks AlexV, I compiled and installed 2.2.7 according to your steps. The extra c: is eliminated now. And I can connect to remote linux server and list files with Dired. However, when I tried to open a remote file with pscp, it fails with 6 times authentication failure, but I'm sure I entered correct password. Then I can not open file, tramp fails with message "file exits, but cannot be read". Do you possibly saw the problem before too?Capers
BTW, I copied the pscp command out from tramp trace, and run it manually in cmd window, it works fine. "D:/Program Files/emacs-24.3/bin/cmdproxy.exe -c pscp -l XXXXX -sftp -p -q -r "XXXXX@server:/aaa/bbb/ccc/ddd.C" "c:/Users/XXXXX/AppData/Local/Temp/tramp.7216api.C" && echo tramp_exit_status 0 || echo tramp_exit_status 1w"Capers
I do not use the pscp method, only plink/plinkx and ssh. Did you try setting (setq tramp-verbose 10) and then monitoring buffers *tramp/pscp...* and *debug tramp/pscp...*? It could be some executable not found on the other end or some variable having some stale value in your emacs session.Geocentric
I found that, all inline transfer method can succeed, but external transfer methods such like psftp, pscp will fail with authentication error. After 6 times tries, connection is broken. I will open another thread to ask for this question. Thanks again for your help on this!Capers
I don't want to install Cygwin for just this. Is it expectable that the next Emacs release will fix this or should I file a bug?Dicephalous
I found out a bug report (debbugs.gnu.org/cgi/bugreport.cgi?bug=14030) has been filed on this. There one may read of a simple work-around: byte compile (emacs-install-path)/lisp/net/tramp-sh.el. I have confirmed that this does indeed work.Magill
I was not able to get either fix to work (installing 2.2.7, or re-byte-compiling tramp-sh.el) until I also deleted the cached information in ~/.emacs.d/tramp. After applying the fix but before deleting this cache, all remote sites I'd attempted to access before the bug-fix continued to fail, while accessing new sites began to work.Bags
H
19

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.

Heimer answered 12/9, 2013 at 12:57 Comment(2)
According to a comment on #22381561 doing "M-x tramp-cleanup-all-connections" might save the hassle of restarting emacs and deleting the file.Esmeraldaesmerelda
@Alan: no, for me it did not help. I had to restart an Emacs anyway.Feat
E
8

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.

Esmeraldaesmerelda answered 8/5, 2013 at 13:9 Comment(1)
Doesn't work over here (GNU Emacs 24.3.1 (i386-mingw-nt5.1.2600) of 2013-03-17 on MARVIN, Windows XP/SP3/32). I successfully byte compiled tramp-sh.el, then restarted Emacs, and there still is the error message: byte-code: Couldn't find a proper ls' command`Heimer
G
3

I had the same problem after switching to Emacs 24.3. The solution was to upgrade to the latest Tramp 2.2.7. Here is what I did:

  1. downloaded http://ftp.gnu.org/gnu/tramp/tramp-2.2.7.tar.gz
  2. unpacked the archive to my ~/.emacs.d/src. I am using emacs-starter-kit which adds this directory and all its subdirectories to the load-path. Otherwise follow the instructions in the Tramp's INSTALL file.
  3. used Cygwin bash to configure and compile the files. I don't use Cygwin's Emacs normally but it is convenient to have it for occasions like this.
  4. deleted the old tramp's el and elc files in my emacs/lisp/net for safety.
  5. restarted Emacs of course.

Do M-x tramp-version to make sure it is installed correctly. Now tramp works everywhere (dired, eshell, shell, etc).

Geocentric answered 21/3, 2013 at 17:15 Comment(7)
Thanks AlexV, I compiled and installed 2.2.7 according to your steps. The extra c: is eliminated now. And I can connect to remote linux server and list files with Dired. However, when I tried to open a remote file with pscp, it fails with 6 times authentication failure, but I'm sure I entered correct password. Then I can not open file, tramp fails with message "file exits, but cannot be read". Do you possibly saw the problem before too?Capers
BTW, I copied the pscp command out from tramp trace, and run it manually in cmd window, it works fine. "D:/Program Files/emacs-24.3/bin/cmdproxy.exe -c pscp -l XXXXX -sftp -p -q -r "XXXXX@server:/aaa/bbb/ccc/ddd.C" "c:/Users/XXXXX/AppData/Local/Temp/tramp.7216api.C" && echo tramp_exit_status 0 || echo tramp_exit_status 1w"Capers
I do not use the pscp method, only plink/plinkx and ssh. Did you try setting (setq tramp-verbose 10) and then monitoring buffers *tramp/pscp...* and *debug tramp/pscp...*? It could be some executable not found on the other end or some variable having some stale value in your emacs session.Geocentric
I found that, all inline transfer method can succeed, but external transfer methods such like psftp, pscp will fail with authentication error. After 6 times tries, connection is broken. I will open another thread to ask for this question. Thanks again for your help on this!Capers
I don't want to install Cygwin for just this. Is it expectable that the next Emacs release will fix this or should I file a bug?Dicephalous
I found out a bug report (debbugs.gnu.org/cgi/bugreport.cgi?bug=14030) has been filed on this. There one may read of a simple work-around: byte compile (emacs-install-path)/lisp/net/tramp-sh.el. I have confirmed that this does indeed work.Magill
I was not able to get either fix to work (installing 2.2.7, or re-byte-compiling tramp-sh.el) until I also deleted the cached information in ~/.emacs.d/tramp. After applying the fix but before deleting this cache, all remote sites I'd attempted to access before the bug-fix continued to fail, while accessing new sites began to work.Bags
D
2

Using eval-expression with (byte-compile-file ..) didn't work for me, but the following did:

  1. Open emacs as administrator (right click on emacs button on taskbar, right click on emacs icon in resulting popup, click 'Run as Administrator')
  2. Use Alt-X to do the compilation rather than eval-expression: M-x byte-compile-file: c:/Program Files/emacs-24.3/lisp/net/tramp-sh.el
  3. Enter tramp-cleanup-all-connections in original emacs window, then try opening your remote file again.
Dropline answered 16/4, 2014 at 13:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.