Subject: bug#64644: emacs-next eshell-tramp not working when ssh to non Guix System

From: Moisés Simón <[email-masked]>
Date: Sat, 15 Jul 2023 09:17:28 +0000

emacs-next eshell tramp can't execute external command on non Guix
system when ssh this is:

> eshell internal command work
/ssh:[email-masked]:~ $ ls 
00-installer-config.yaml  Repositories  management  transfer_0145.out
> external commands don't work
/ssh:[email-masked]:~ $ id
sh: cd: /home/admin/: No such file or directory
///269dceab5ed29f1610133abb297d9507#$ exit
/ssh:[email-masked]:~ $

<reily> reports the same error
[[https://logs.guix.gnu.org/guix/2023-07-13.log#211903]] and has some
done some debbuging.  I paste the relevant parts:

--8<---------------cut here---------------start------------->8---
IRC channel logs

<reily>I'm having some troubles using TRAMP in emacs to connect to a non-guix system. I am able to use TRAMP to open and edit files, but running commands in eshell results in the error "sh: cd: /some/dir/: No such file or directory." (where /some/dir/ is a directory that absolutely exists on the remote system). After this, the eshell prompt changes to the value of tramp-end-of-output until exit is run. This does not happen when using
<reily>eshell-builtin commands, or when using shell-mode. Has anyone else encountered this?

<reily>Guest28: My guix is up to date and I use emacs-pgtk-next

<lilyp>reily: could you dig into tramp via edebug and see what command actually gets executed on the remote?

<reily>lilyp: This is what tramp-debug shows: https://paste.debian.net/1285797/

<reily>lilyp: A lot of the junk seems to come from having emacs-eat enabled. Disabling that results in this: https://paste.debian.net/1285799/
<lilyp>and this ls succeeds or not?

<reily>lilyp: I just spent a long time working my way down the edebug callstack for sending a command, to find out at the end its just running make-process, and appears to be doing so correctly. make-process is a C function, so I cant really get any more insight into whats going on until it resurfaces in the tramp logs. Any advice?
<reily>Update, it looks like TRAMP is trying to run the command on the local host instead of the remote, as making the corresponding directory on the local machine results in "/usr/bin/ls: No such file or directory." Again, this file exists at this location on the remote, just not the local host. Any idea why eshell and tramp only have this behavior when connnecting to a non-guix host? Everything works fine when connecting to another guix
<lilyp>sneek later tell reily our emacs ships with some workaround to fix tramp as the receiving end but I don't have the means to debug it as sending end, sadly
<sneek>Will do.

--8<---------------cut here---------------end--------------->8---

The oldest system I have that is experiencing the problem is:
--8<---------------cut here---------------start------------->8---
(list (channel
        (name 'guix)
        (url "https://git.savannah.gnu.org/git/guix.git")
        (branch "master")
        (commit
          "cbc14b3baea457cf2718b85f767d39ff3911ce91")
        (introduction
          (make-channel-introduction
            "9edb3f66fd807b096b48283debdcddccfea34bad"
            (openpgp-fingerprint
              "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA"))))
      (channel
        (name 'my-guix)
        (url "/home/msv/src/guix-config/")
        (branch "master")
        (commit
          "c19ddf3edd8688f9982d9c6f89b58f330a9aa637"))
      (channel
        (name 'nonguix)
        (url "https://gitlab.com/nonguix/nonguix")
        (branch "master")
        (commit
          "15e5924de8696cc4a19a8f508501d07f799650e1")
        (introduction
          (make-channel-introduction
            "897c1a470da759236cc11798f4e0a5f7d4d59fbc"
            (openpgp-fingerprint
              "2A39 3FFF 68F4 EF7A 3D29  12AF 6F51 20A0 22FB B2D5")))))
--8<---------------cut here---------------end--------------->8---