Subject: bug#47067: 28.0.50; [feature/native-comp] Crash while scrolling through dispnew.c

From: Andrea Corallo <[email-masked]>
Date: Sun, 21 Mar 2021 08:26:45 +0000

Eli Zaretskii <[email-masked]> writes:

> A related question: what happens when a .el which was preloaded at
> some point is no longer preloaded?
>
> When it was preloaded, we had its .eln file under native/lisp/, but
> when it ceases to be preloaded, its name is removed from $shortlisp
> (in src/lisp.mk), and we no longer ELC+ELN it during the build.  So we
> now have a stale .eln file in native-lisp, and at some future point in
> time, when that file is loaded into Emacs, it will be
> natively-compiled into ~/.emacs.d/eln-cache/.  At which point we have
> 2 versions of the .eln file.
>
> Question #1: will Emacs load the up-to-date .eln file in eln-cache, or
> could it by any chance load the outdated file in native-lisp?

If the .el file was not changed Emacs will load the original .eln in
'native-lisp' without having to recompile it.

If the .el was modified we will recompile it in 'eln-cache' and load it,
when we do this we clean-up the stale .eln present in
`comp-eln-load-path'.  Unfortunatelly for this case we don't do this for
the last directory in `comp-eln-load-path' (as this is tipically
read-only when Emacs is installed).

> Question #2: can we somehow remove the stale .eln file in these
> situations?

I guess we should make it work for non installed case.

be22cda7be should do this.

Thanks

  Andrea