Sean Whitton <spwhit...@spwhitton.name> writes:

> control: tag -1 + moreinfo
>
> Hello Xiyue,
>
> On Mon 03 Mar 2025 at 12:44pm -08, Xiyue Deng wrote:
>
>> There are several reports against Emacs 30.1 backports that some
>> packages are seeing byte-compilation errors when upgrading to Emacs
>> 30.1[1][2].
>
> To be clear, these are reports about Emacs in bookworm-backports, not in
> bookworm.  We don't yet know about upgrades to trixie.
>
>> Currently we identified that this could be caused by the install script
>> from dh-elpa-helper which compiles each .el source file one by one.
>> This has been changed to use byte-recompile-directory since 2.1.2, which
>> is probably why we don't see this issue in Sid/Trixie.  It's not clear
>> to me why byte-compile files one by one stopped working.
>> [...]
>> As this could be an issue affecting Trixie upgrades, I wonder whether
>> the changes warrants a stable update.
>
> A couple of meta points:
>
> - for any stable update, we can't touch stable without completely
>   understanding the impact of our patch and what it is trying to fix
>
> - for this particular case, we can't know whether or not a stable update
>   would even help until we more fully understand the issue.
>
> So basically: we need analysis and investigation right now, not patches,
> so far as I can tell.
>
> Thanks for all your work so far.  If you have the time to do more it
> will be greatly appreciated.
>

Thanks Sean.  I think you have a point.

So to understand this matter better, I sent an email to
emacs-de...@gnu.org earlier today asking for help on this matter.  So
far I have received some insights on the cause of errors and behavior
differences between `byte-compile' and `byte-recompile-directory':

* Eli replied[1] saying that "Emacs 30 warns about more problems in Lisp
  code than previous versions did".  This is not surprising, and the
  errors are worth fixing, and may have already been fixed in newer
  versions of the addons.

* Stefan replied[2] with a possible explanation of why
  `byte-recompile-directory' doesn't error sometimes: "My guess is that
  `byte-recompile-directory` loads more than one file into the compiling
  Emacs process."  This makes sense, as loading more files definitely
  helps with loading some file for `require' or adding more `require's
  for definitions.

To summarize, the errors are caused by stricter error reporting since
Emacs 30 when byte compiling single source files, but we don't see them
in Trixie/Sid because we started using `byte-recompile-directory' some
time ago, and loading multiple files during byte compilation hides those
issues.

So we have 2 obvious paths forward:

1) Fix each package that shows errors.
2) Make a stable update to dh-elpa-helper to use
   `byte-recompile-directory' to be consistent with Trixie/Sid.

Option 1 has too many uncertainties.  So far we know that it could
trigger the errors with certain combinations of Emacs, dh-elpa-helper,
and addons.  Currently we already receive reports that upgrading to
Emacs 30 causes issues from reports regarding backports, so it's
possible that when Trixie releases, if a user only upgrades Emacs
without dh-elpa(-helper) and addons they will encounter the same
problem.  We are also unsure about the full system upgrade scenario as
the sequence of package upgrades can be random.  And more importantly,
option 1 requires fixing each package in question.  Currently we know
that elpa-php-mode and elpa-compat so at least 2 packages need updates.
We don't yet know if any other packages could cause any issues, and it's
likely we wouldn't know for sure until Trixie releases and we start
receiving reports of more packages failed to upgrade, which could be a
bit late.

Option 2 has the obvious advantage of "single point of fix".  And
because `byte-recompile-directory' has been in use in Trixie/Sid for
some time, it is kind of tested, or we'll receive FTBFS bug reports
already (or may have fixed them already).  We also don't have to worry
about the upgrade sequence because byte compiling is done the same way
as in Trixie with this update.  Additionally, I have verified it to be
working for elpa-php-mode and elpa-compat in the stable upgrade
scenario, which should also cover the rare only-upgrade-Emacs-in-Trixie
case.  All in all, this is a safer option compared with option 1, and
requires less effort (1 stable update).

Obviously I would choose option 2.  Let me know what you think.

> [...]

[1] https://lists.gnu.org/archive/html/emacs-devel/2025-03/msg00214.html
[2] https://lists.gnu.org/archive/html/emacs-devel/2025-03/msg00217.html

-- 
Regards,
Xiyue Deng

Attachment: signature.asc
Description: PGP signature

Reply via email to