【问题标题】:Emacs 24.3 for windows, Tramp byte-code: Couldn't find a proper `ls' command适用于 Windows 的 Emacs 24.3,Tramp 字节码:找不到合适的“ls”命令
【发布时间】:2013-03-10 12:45:45
【问题描述】:

24.2 运行良好,但是 24.3 bounded tramp 在打开远程 Linux 系统文件或目录时出现以下错误:

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

我打开tramp trace发现,所有的远程搜索路径和文件路径都被扩展了一些东西,在开头添加了一个额外的“c:”。结果是tramp找不到我想打开的命令和文件。

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 $? 

有人知道吗?提前致谢。

【问题讨论】:

    标签: windows emacs tramp


    【解决方案1】:

    我在切换到 Emacs 24.3 后遇到了同样的问题。解决方案是升级到最新的 Tramp 2.2.7。这是我所做的:

    1. 已下载http://ftp.gnu.org/gnu/tramp/tramp-2.2.7.tar.gz
    2. 将存档解压缩到我的 ~/.emacs.d/src。我正在使用 emacs-starter-kit 将此目录及其所有子目录添加到加载路径。否则请按照 Tramp 的 INSTALL 文件中的说明进行操作。
    3. 使用 Cygwin bash 配置和编译文件。我一般不使用 Cygwin 的 Emacs,但在这种情况下使用它很方便。
    4. 为安全起见,删除了我的 emacs/lisp/net 中老流浪汉的 el 和 elc 文件。
    5. 当然重启了 Emacs。

    执行 M-x tramp-version 以确保它安装正确。现在 tramp 无处不在(dired、eshell、shell 等)。

    【讨论】:

    • 谢谢AlexV,我按照你的步骤编译安装了2.2.7。额外的 c: 现在被消除了。我可以连接到远程 linux 服务器并使用 Dired 列出文件。但是,当我尝试使用 pscp 打开远程文件时,它失败了 6 次身份验证失败,但我确定我输入了正确的密码。然后我无法打开文件,tramp 失败并显示消息“文件退出,但无法读取”。你以前可能也看到过这个问题吗?
    • 顺便说一句,我从tramp trace中复制了pscp命令,并在cmd窗口中手动运行它,它工作正常。 "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:/用户/XXXXX/AppData/Local/Temp/tramp.7216api.C" && echo tramp_exit_status 0 || echo tramp_exit_status 1w"
    • 我不使用pscp方式,只使用plink/plinkx和ssh。您是否尝试设置(setq tramp-verbose 10),然后监视缓冲区*tramp/pscp...**debug tramp/pscp...*?它可能是在另一端找不到某些可执行文件,或者是某个变量在您的 emacs 会话中具有一些陈旧值。
    • 我发现,所有的内联传输方法都可以成功,但是像psftp,pscp这样的外部传输方法会失败,并出现身份验证错误。尝试 6 次后,连接断开。我将打开另一个线程来询问这个问题。再次感谢您对此的帮助!
    • 我发现已经提交了一个错误报告 (debbugs.gnu.org/cgi/bugreport.cgi?bug=14030)。人们可能会读到一种简单的解决方法:byte compile (emacs-install-path)/lisp/net/tramp-sh.el。我已经确认这确实有效。
    【解决方案2】:

    这似乎是 tramp 中的一个错误,但您不需要升级 tramp,您所要做的就是在 Windows 机器上重新编译 tramp-sh.el。有关详细信息,请参阅错误报告 here

    在暂存缓冲区中输入:

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

    调整路径以匹配您的安装,然后键入 Ctrl-Meta-x 以重新编译文件。如果它抱怨权限,您可能需要使用 Windows 中的“以管理员身份运行”选项重新启动 emacs。

    一旦文件被重新编译,键入 M-x tramp-cleanup-all-connections 以重置tramp 连接缓存。这将关闭您打开的所有流浪者连接。

    【讨论】:

    • 在这里不起作用 (GNU Emacs 24.3.1 (i386-mingw-nt5.1.2600) of 2013-03-17 on MARVIN, Windows XP /SP3/32). 字节编译成功tramp-sh.el,然后重启Emacs,还是报错:byte-code: Couldn't find a proper ls' command`
    【解决方案3】:

    合并answer by @AlanThird 和@uscjeremy 的评论,这对我有用(GNU Emacs 24.3.1 (i386-mingw-nt5.1.2600) of 2013-03-17 on MARVIN, Windows XP /SP3/32):

    1. 字节编译tramp-sh.el(相应地调整路径):

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

    3. 删除 Tramp 缓存:~/.emacs.d/tramp

    4. 启动 Emacs。

    另请参阅 gnu.org 上的 bug report #14030

    【讨论】:

    • 根据stackoverflow.com/questions/22381061/… 的评论,执行“M-x tramp-cleanup-all-connections”可能会省去重启 emacs 和删除文件的麻烦。
    • @Alan:不,对我来说没有帮助。无论如何,我不得不重新启动 Emacs。
    【解决方案4】:

    eval-expression(byte-compile-file ..) 一起使用对我不起作用,但以下方法对我有用:

    1. 以管理员身份打开 emacs(右键单击任务栏上的 emacs 按钮,右键单击弹出窗口中的 emacs 图标,单击“以管理员身份运行”)
    2. 使用 Alt-X 而不是 eval-expression 进行编译:M-x byte-compile-file:c:/Program Files/emacs-24.3/lisp/net/tramp-sh.el
    3. 在原始 emacs 窗口中输入 tramp-cleanup-all-connections,然后再次尝试打开远程文件。

    【讨论】:

      猜你喜欢
      • 2019-05-17
      • 2021-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-19
      • 2014-07-27
      相关资源
      最近更新 更多