Subject: bug#43190: feature/native-comp; failure to compile json-mode leaves Emacs broken

From: Andrea Corallo <[email-masked]>
Date: Fri, 04 Sep 2020 07:56:21 +0000

Hi Tom,

thanks for the detailed report.

Tom Gillespie <[email-masked]> writes:

> While this is clearly a bug in the way that json-snatcher is written
> (the symbol should never have been added to the hook before the
> function was defined), it is only causing an issue with the new native
> comp code.

had no time to reproduce but to a very first look I'm quite unconvinced
this is a native-comp bug.  I think you'd get the same exact error
byte-compiling the file from shell using a vanilla Emacs.

The fact is that native async compilations are child processes so they
start with a clean environment.  This makes the native compiler a little
more picky on bugs when the compilation is relaying silently on some
definition sneaked in from the environment.

This lead already to a number of packages to fix their requires.

The proof is typically trying to byte-compile from shell, this give
systematically the same error, this because the front-end of the native
compiler *is* the byte-compiler :)

Each compilation unit should be consistent and compilable autonomously
without relaying on previous modifications of the environment.

Thanks

  Andrea