Automatic self upgrades broken on ECL
If the ASDF repo is checked out into
~/common-lisp (or another place the source registry searches), then the first time ASDF automatically upgrades itself will work, but subsequent times will fail.
The proximate cause is that there's an unbound slot in
action-status that should never be unbound. This also exhausts the stack because when printing the slot-unbound error, it triggers another slot-unbound error ad infinitum.
The root cause is that when loading a fasl, ECL eagerly interns symbols into packages, instead of delaying the intern until the top-level form it appears in is processed. This results in the package of the
stamp slot name changing at an inopportune time, causing the slot to become unbound in existing instances.
A contributing factor is that the bug is only seen if ASDF locates itself using the source registry. If the
*central-registry* is used instead, the bug doesn't seem to appear during the self upgrade. There may still be other issues after the self upgrade, however.
I believe that the difference between the central and source registries is likely due to ECL bundling a very old version of ASDF. But I have not been able to prove that yet. It also means that our tests would never catch this because the upgrade tests only use the central registry for configuration.
This is likely an implementation-bug and has been reported upstream: https://gitlab.com/embeddable-common-lisp/ecl/-/issues/676, but they have yet to determine for sure if their current behavior is allowed by the spec or not.
As for remediation on our end: I think if we export
stamp from the
asdf/action package that the upgrade will succeed (because the package for the slot name won't change). However, I'm hesitant to do that because there might be other hidden traps after the upgrade has finished.
Another option is to prevent self upgrades on ECL from using a fasl and force them to
cl:load asdf.lisp. But I'm uncertain how to do that.
The best option is probably just to tell folks running ECL that if they want to upgrade ASDF, they should manually
cl:load asdf.lisp. Alternatively they can load a fasl, so long as they never load ECL's bundled ASDF.