Subject: Re: bug#61637: 30.0.50; Fix Eglot tests that need HOME=~USER

From: João Távora <[email-masked]>
Date: Sat, 04 Mar 2023 01:04:45 +0000

Hi Eli, Basil

I've recently bumped into this problem myself.  As I've been doing more
development on Eglot recently, running the test suite becomes a real
necessity.  

I installed some language servers like clangd, rust-analyzer and pylsp,
and they need to a valid HOME to be able to function.  Bare 'make check'
always fails for me as of late.  If one happens to have the servers
installed, the problem is twofold:

* For Eglot developers, it's impossible to batch-test Eglot

* For other devs who are doing changes elsewhere and looking for
  breakage, they'll have to reason about the 'make check' failure.

Another option is to have eglot-tests.el read a new environment var:

diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el
index 5d5de59a19a..ad994915c52 100644
--- a/test/lisp/progmodes/eglot-tests.el
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -116,9 +116,7 @@ eglot--call-with-fixture
                    ;; installations for LSP servers like pylsp, making
                    ;; these tests mostly useless, so we hack around it
                    ;; here with a great big hack.
-                   ,(format "HOME=%s"
-                            (if (file-exists-p home) home
-                              (format "/home/%s" (getenv "USER")))))
+                   ,(format "HOME=%s" (or (getenv "EGLOT_REAL_HOME") (getenv "HOME"))))
                  process-environment))
                ;; Prevent "Can't guess python-indent-offset ..." messages.
                (python-indent-guess-indent-offset-verbose . nil)

This is acceptable for Eglot devs like me, but other devs that don't
know about this variable will still be confused. WDYT?

> Why not do this the other way around: trick Eglot to think the home
> directory doesn't exist (as I understand it already knows how to
> handle this)?

I don't understand what you mean: this is entirely constrained to how
certain language servers work, so eglot.el itself can't handle it.

João