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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: jeberger <at> free.fr
Subject: bug#61748: closed (Re: bug#61748: 27.2; Eglot should use
 shell-file-name when launching the language server for a remote file)
Date: Tue, 07 Mar 2023 10:14:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#61748: 27.2; Eglot should use shell-file-name when launching the language server for a remote file

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 61748 <at> debbugs.gnu.org.

-- 
61748: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61748
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: João Távora <joaotavora <at> gmail.com>
To: jeberger <at> free.fr, 61748-done <at> debbugs.gnu.org
Cc: Michael Albinus <michael.albinus <at> gmx.de>
Subject: Re: bug#61748: 27.2; Eglot should use shell-file-name when launching
 the language server for a remote file
Date: Tue, 7 Mar 2023 10:15:13 +0000
On Thu, Mar 2, 2023 at 1:28 PM João Távora <joaotavora <at> gmail.com> wrote:
>
> On Wed, Mar 1, 2023 at 8:09 AM <jeberger <at> free.fr> wrote:
> > `tramp-own-remote-path` and making sure that it is set correctly
> > fixes my point 2, but then `rust-analyzer` doesn't have the path set and
> > so fails to find the Rust toolchain.
>
> AFAIC is a different problem now. Earlier, the program couldn't be invoked
> at all.
>
> >  So my patch is still required to fix that part.
>
> I've pushed a simpler patch to emacs-29.  Please test.

I'm going to assume the lack of reply is because the problem
doesn't happen anymore.  It doesn't in my tests, but my remote
language server in the remote $HOME doesn't rely on PATH
to figure out the toolchain and thus doesn't suffer from this
vulnerability.

Closing.  If the problem persists, we can reopen.

João

[Message part 3 (message/rfc822, inline)]
From: jeberger <at> free.fr
To: bug-gnu-emacs <at> gnu.org
Subject: 27.2; Eglot should use shell-file-name when launching the language
 server for a remote file
Date: Fri, 24 Feb 2023 08:39:45 +0100 (CET)
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.:

```lisp
(defun eglot--cmd (contact)
  "Helper for `eglot--connect'."
  (if (file-remote-p default-directory)
      ;; TODO: this seems like a bug, although it’s everywhere. For
      ;; some reason, for remote connections only, over a pipe, we
      ;; need to turn off line buffering on the tty.
      ;;
      ;; Not only does this seem like there should be a better way,
      ;; but it almost certainly doesn’t work on non-unix systems.
      (list (or shell-file-name "sh") "-c"
            (string-join (cons "stty raw > /dev/null;"
                               (mapcar #'shell-quote-argument contact))
                         " "))
    contact))
```

It still fails to autodetect the server and asks for the program to execute though.

----

In GNU Emacs 27.2 (build 1, x86_64-w64-mingw32)
 of 2021-03-26 built on CIRROCUMULUS
Repository revision: deef5efafb70f4b171265b896505b92b6eef24e6
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19042
System Description: Microsoft Windows 10 Enterprise (v10.0.2009.19042.2604)

Recent messages:
Cleaning up the recentf list...done (0 removed)
Quit
Cleaning up the recentf list...done (0 removed)
Timer #[257 "\303!\205!\0r\211q\210\203\0	\203\0\304\305\306\307	$\210\310\311!\210\312\211)\207" [flymake-mode flymake-no-changes-timeout flymake-timer buffer-live-p flymake--log-1 :debug flymake "starting syntax check after idle for %s seconds" flymake-start t nil] 6 "

(fn BUFFER)"] ran for 00:00:17 from 08:15:39 to 08:15:56
Couldn’t find local shell prompt for C:/ProgramData/chocolatey/lib/Emacs/tools/emacs/libexec/emacs/27.2/x86_64-w64-mingw32/cmdproxy.exe
Cleaning up the recentf list...done (0 removed)
Timer flycheck--handle-idle-trigger ran for 00:00:49 from 08:15:38 to 08:16:27
Auto-saving...

Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: FRA
  locale-coding-system: cp1252

Major mode: Rust

Minor modes in effect:
  flymake-mode: t
  flycheck-mode: t
  desktop-save-mode: t
  rainbow-delimiters-mode: t
  which-function-mode: t
  shell-dirtrack-mode: t
  recentf-mode: t
  global-linum-mode: t
  linum-mode: t
  global-hl-line-mode: t
  global-leerzeichen-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  ws-butler-global-mode: t
  ws-butler-mode: t
  global-whitespace-mode: t
  tabbar-mwheel-mode: t
  tabbar-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  global-semantic-idle-local-symbol-highlight-mode: t
  global-semantic-idle-summary-mode: t
  global-semantic-highlight-func-mode: t
  semantic-mode: t
  phi-rectangle-mode: t
  ivy-mode: t
  highlight-doxygen-global-mode: t
  global-dash-fontify-mode: t
  global-company-mode: t
  company-mode: t
  bar-cursor-mode: t
  override-global-mode: t
  show-paren-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
d:/home/.emacs.d/elpa/jsonrpc-1.0.16/jsonrpc hides c:/ProgramData/chocolatey/lib/Emacs/tools/emacs/share/emacs/27.2/lisp/jsonrpc
d:/home/.emacs.d/elpa/xref-1.6.2/xref hides c:/ProgramData/chocolatey/lib/Emacs/tools/emacs/share/emacs/27.2/lisp/progmodes/xref
d:/home/.emacs.d/elpa/project-0.9.8/project hides c:/ProgramData/chocolatey/lib/Emacs/tools/emacs/share/emacs/27.2/lisp/progmodes/project
d:/home/.emacs.d/elpa/flymake-1.2.2/flymake hides c:/ProgramData/chocolatey/lib/Emacs/tools/emacs/share/emacs/27.2/lisp/progmodes/flymake
d:/home/.emacs.d/packages/mpuz hides c:/ProgramData/chocolatey/lib/Emacs/tools/emacs/share/emacs/27.2/lisp/play/mpuz
d:/home/.emacs.d/elpa/seq-2.23/seq hides c:/ProgramData/chocolatey/lib/Emacs/tools/emacs/share/emacs/27.2/lisp/emacs-lisp/seq
d:/home/.emacs.d/elpa/eldoc-1.13.0/eldoc hides c:/ProgramData/chocolatey/lib/Emacs/tools/emacs/share/emacs/27.2/lisp/emacs-lisp/eldoc

Features:
(shadow sort mail-extr emacsbug message rmc rfc822 mml mml-sec epa
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail tramp-cmds counsel-gtags minimal-session-saver
css-mode sgml-mode eww mm-url gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils mm-util mail-prsvr
url-queue url url-proxy url-privacy url-expand url-methods url-history
mailcap shr text-property-search url-cookie url-domsuf puny svg xml dom
ffap eieio-opt semantic/sb speedbar sb-image dframe eglot
external-completion array filenotify jsonrpc ert ewoc debug backtrace
flymake-proc flymake warnings url-util cl-print help-fns radix-tree
web-mode bitbake mmm-mode mmm-univ mmm-class mmm-region mmm-auto
mmm-vars mmm-utils mmm-compat markdown-mode yaml-mode python sh-script
smie executable semantic/bovine/make semantic/bovine/make-by make-mode
toml-mode conf-mode racer f etags fileloop generator add-log
semantic/tag-file semantic/imenu semantic/db-file data-debug cedet-files
semantic/bovine/c semantic/decorate/include semantic/decorate/mode
semantic/decorate semantic/bovine/c-by semantic/lex-spp
semantic/bovine/gcc semantic/dep semantic/bovine semantic/analyze/refs
semantic/db-find semantic/db-ref hideif hideshow jb-prog-licences
jb-prog-font align jb-cc-mode cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs flycheck-rust flycheck
rust-utils rust-mode rust-rustfmt rust-playpen rust-compile rust-cargo
tramp-cache vc-dispatcher vc-hg diff-mode desktop frameset thingatpt
counsel xdg xref project dired dired-loaddefs swiper matlab matlab-scan
matlab-syntax matlab-compat pulse rainbow-delimiters windmove s server
ibuf-macs which-func imenu tramp-sh tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell pcomplete parse-time
iso8601 time-date format-spec recentf tree-widget linum hl-line
leerzeichen yasnippet ws-butler cus-edit wid-edit whitespace tabbar
smart-mode-line-light-theme smart-mode-line rich-minority
semantic/db-mode semantic/idle semantic/analyze semantic/sort
semantic/scope semantic/analyze/fcn semantic/db eieio-base
semantic/format ezimage semantic/tag-ls semantic/find semantic/ctxt
semantic/util-modes semantic/util semantic pp semantic/tag semantic/lex
semantic/fw mode-local find-func cedet phi-rectangle rect kconfig-mode
derived ivy-hydra hydra lv ivy ivy-faces ivy-overlay colir color flx avy
ht highlight-doxygen noutline outline dash company-oddmuse company-files
company-capf company-cmake company-clang company-semantic company-css
company-nxml company-bbdb company-keywords company-gtags
company-template company-dabbrev-code company-dabbrev company pcase
bar-cursor peg cl-extra help-mode advice use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core finder-inf edmacro kmacro compile comint
ansi-color ring paren avoid delsel cus-start cus-load epg epg-config
gnu-elpa-keyring-update rx info package easymenu browse-url url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads w32notify w32
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 1041436 370370)
 (symbols 48 44596 7)
 (strings 32 219890 55700)
 (string-bytes 1 6131935)
 (vectors 16 115782)
 (vector-slots 8 2654593 430756)
 (floats 8 347 768)
 (intervals 56 50094 1190)
 (buffers 1000 168))



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.