Subject: Re: bug#38309: Recent $EMACSLOADPATH changes crash gnome-session

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 24 Nov 2019 12:45:51 +0900

Hello,

Ludovic Courtès <[email-masked]> writes:

> Hi Maxim,
>
> Maxim Cournoyer <[email-masked]> skribis:
>
>> Really sorry about this ugly regression :-/.
>
> Should we revert 47b3b4c2aa49e21f4cc32c97ff7bbbd069bb849c so we can
> address this without pressure in the meantime?
>
> I think I missed the discussions around this patch, but we should get
> Alex Kost into the loop (Alex did the initial work in that area, if I’m
> not mistaken.)
>
> Thanks,
> Ludo’.

There would be a couple more commits to include in the revert to undo
the changes (one to the build system, others to adapt the renaming of
the emacs-set-load-path phase for some packages:

--8<---------------cut here---------------start------------->8---
63edbb65e4 * origin/master gnu: emacs-protobuf-mode: Rename the set-emacs-load-path phase.
ffb2316548 * gnu: emacs-erlang: Rename the set-emacs-load-path phase.
ed94123667 * gnu: emacs-pdf-tools: Adapt phase name.
418febb54f * gnu: emacs-scel: Fix build.
1bb39982f1 * gnu: emacs-realgud: Fix build.
c51d4c7746 * gnu: emacs-pdf-tools: Fix build.
b44357d02a * gnu: emacs-forge: Fix build.
47b3b4c2aa * gnu: emacs: Adapt the autoloads auxiliary code to use EMACSLOADPATH.
e1d31e6457 * build-system: emacs: Simplify the SET-EMACS-LOAD-PATH phase.
215a45d9b8 * gnu: emacs: Locate Elisp libraries via EMACSLOADPATH.
--8<---------------cut here---------------end--------------->8---

The bug in questino seems to have to do with a regression in recent
versions PCRE, that trigger a crash on large environment variables as
reported in [0].  There's a new version of PCRE2 (10.34) available; but
I'm unsure if it addresses this particular problem:
https://pcre.org/changelog.txt.  If it doesn't we should report the
problem to them.

This could happen with any other environment variable than
EMACSLOADPATH; it's just a matter of having an environment variable grow
sufficiently long to trigger it.

I'm testing a patch that may workaround this problem successfully right
now (that would reduce the length of EMACSLOADPATH) I'll send an
incomplete patch shortly for discussing the idea or testing.  In case
it's not clear; I'd rather workaround the issue or have it fixed at its
source, ideally.

WDYT?

Maxim

[0]  https://bugzilla.redhat.com/show_bug.cgi?id=1430103