GNU bug report logs - #61748
27.2; Eglot should use shell-file-name when launching the language server for a remote file

Previous Next

Package: emacs;

Reported by: jeberger <at> free.fr

Date: Fri, 24 Feb 2023 07:40:01 UTC

Severity: normal

Found in version 27.2

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 61748 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: jeberger <at> free.fr, Michael Albinus <michael.albinus <at> gmx.de>
Cc: 61748 <at> debbugs.gnu.org
Subject: Re: bug#61748: 27.2;
 Eglot should use shell-file-name when launching the language server
 for a remote file
Date: Fri, 24 Feb 2023 10:15:52 +0200
> Date: Fri, 24 Feb 2023 08:39:45 +0100 (CET)
> From: jeberger <at> free.fr
> 
> >From https://github.com/joaotavora/eglot/issues/1175
> 
> # Steps to reproduce:
> 
> - On the remote machine:
>     - Install a language server in a non-standard path (e.g. `rust-analyzer`, which installs in a subdirectory under `$HOME` and not `/usr/bin`)
>     - Make sure that the server is in the path for a shell other than `sh` (e.g. set the path in `.zprofile` for `zsh`).
> - On the local machine:
>     - Open a file remotely through TRAMP
>     - Set `shell-file-name` to the shell you're using on the remote (e.g. `(setq shell-file-name "zsh")`)
>     - <key>M-x</key> `eglot`.
> 
> # Expected result:
> 
> Eglot should start
> 
> # Actual result:
> 
> Eglot asks `Enter program to execute (or <host>:<port>):`, then when I type `rust-analyzer` it fails with message `[jsonrpc] Server exited with status 127`. Looking at `eglot-events-buffer`, it is clear that eglot tried to use `sh` to start the server.
> 
> # Partial fix
> 
> The server starts correctly if I change function `eglot--cmd` to use `(or shell-file-name "sh")` instead of plain `"sh"`, e.g.:

I don't think this is the correct fix.  The literal "sh -c" is used in
Eglot only for remote server invocations, and I presume this was done
to avoid the problems with running Eglot on MS-Windows.  Using
shell-file-name is incorrect for this use case because shell-file-name
gives you the name of the _local_ shell.  I think we have better ways
of dealing with this issue' I've CC'ed Michael in the hope that he
will tell how to solve this properly.

Thanks.




This bug report was last modified 2 years and 161 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.