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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 04 Mar 2023 14:46:35 +0200

> From: João Távora <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Sat, 04 Mar 2023 11:48:27 +0000
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> From: João Távora <[email-masked]>
> >> Cc: "Basil L. Contovounesios" <[email-masked]>,  [email-masked]
> >> Date: Sat, 04 Mar 2023 01:04:45 +0000
> >> 
> >> I installed some language servers like clangd, rust-analyzer and pylsp,
> >> and they need to a valid HOME to be able to function.
> >
> > Please tell more about this: what exactly do these servers need from
> > the home directory?
> 
> Every server is different.  This is the complain for a pylsp installed
> with 'pip install pylsp' for the regular user, which you can find in the
> output of e.g.
> 
>    make -C test lisp/progmodes/eglot-tests SELECTOR='"basic-completions"'
> 
> This are the relevant parts of the output.  Here, it looks like the
> pylsp trampoline in ~/.local/bin/pylsp can't find the main supporing
> library, which probably lives around the corner in
> ~/.local/lib/python3.10/site-packages.

Is it reasonable to have an LSP installed in the HOME directory when
running the Emacs test suite, when we clearly document that HOME is
ignored for these tests?

How about if we ask users who install LSP servers under their home
directory to somehow specify the exact location of that installation,
so that the LSP will find its components, but Emacs won't access any
files in the user's HOME via the "~" shortcut?

> > As I said, I don't like the idea of using the user's real home
> > directory for test purposes.  We could end up clobbering precious
> > files there.  We could also have tests fail because some user setting
> > in the home directory makes the test results unpredictable.
> 
> As I understand it, the concern of cloberring user customizations is
> mostly related to Emacs' own packages like ido or auto-save-mode, some
> of them do write files in ~/.emacs.d and similar.  That is reasonable.
> 
> But this is different IMO.  We're talking about user-installed language
> servers, which presumably these users are already using (because they
> installed them).  Only for the specific invocations of these servers is
> HOME spoofed.  Overall I think the risk is low.  Eglot has had these
> types of tests since practically the beginning and I've never had
> complains of clobbered files.

You disregarded the second part of my reasoning, which has to do with
the test results being non-deterministic once the user's real home
directory is accessible to Emacs.  How do we overcome that?