使用tramp中的SSH协议连接远程的时候,第一次登录打开文件的时候直接可以打开,将buffer删掉之后,再打开的就出现:tramp-file-name-handler: Invalid base64 data
。
更奇怪的是,同一个项目里面的文件有些能直接用本地emacs打开,有些却不能,不能打开的文件同样提示上面的那个错误。
查了网上可能的解答,我本地用的是ZSH,远程用的是BASH。按照解答在.zshrc
上加了几句,重启机器还是不行。
PS:有时打开会提示 gzip: stdin: unexpected end of file
请给出相应的 Backtrace ((info “(emacs) Glossary”))
Backtrace
A backtrace is a trace of a series of function calls showing how a
program arrived at a certain point. It is used mainly for finding
and correcting bugs (q.v.). Emacs can display a backtrace when it
signals an error or when you type ‘C-g’ (*note
Glossary---Quitting::). *Note Checklist::.
看来不是emacs的问题,toggle debug 没有出现backtrace。应该是传输的时候有丢包,或者外部安装支持没有的对应起来。等到下班的时候,所有的文件打开都没有问题。
谢谢回复!
打开远程文件,其实是从远程拷贝一个副本到本地:
remote-file ~~[base64]~~> local-copy --> buffer
*Messages*
里可以看到这个过程:
--- find-file ---
Tramp: Opening connection for tokyo18 using ssh...done
Tramp: Inserting ‘/ssh:tokyo18:/root/test.org’...
Tramp: Encoding remote file ‘/ssh:tokyo18:/root/test.org’ with ‘base64 <%s’...done
Tramp: Decoding local file ‘/var/folders/vq/n6k092j5r6dk_hx_jrl62jh0000gn/T/tramp.57844y1l.org’ with ‘base64-decode-region’...done
Tramp: Inserting ‘/ssh:tokyo18:/root/test.org’...done
--- save-buffer ---
Saving file /ssh:tokyo18:/root/test.org...
Tramp: Encoding local file ‘/var/folders/vq/n6k092j5r6dk_hx_jrl62jh0000gn/T/tramp.57844__r.org’ using ‘base64-encode-region’...done
Tramp: Decoding remote file ‘/ssh:tokyo18:/root/test.org’ using ‘base64 -d -i >%s’...done
Wrote /ssh:tokyo18:/root/test.org
传输过程中出错就 base64 解码失败了。
1 个赞