REQUIRE on contribs can pull in the wrong things via ASDF
Describe the bug
REQUIRE now appears to try ASDF's system resolution mechanism before the older contrib provider functions in *MODULE-PROVIDE-FUNCTIONS*
.
If it turns out that ASDF can find a <contrib>.asd for file any of CMUCL's contrib names, REQUIRE will turn out to use that, rather than loading the already-compiled library files in #P"library:".
This can complicate attempting to work with multiple CMUCL versions installed on the same host.
To Reproduce
One way this can happen on a Debian 10 host is to install Debian's cmucl-source package, which package puts a number of .asd files beneath /usr/share/common-lisp, where ASDF will find them. Then launch a different version of CMUCL, e.g., from a snapshot, and attempt to REQUIRE a contrib, e.g., (require :clx)
.
Expected behavior
I'd expect that in a complete CMUCL installation, (require <contrib>)
will locate and load a precompiled <contrib>-library fasl in the library search list.
Desktop
- OS: Debian 10 x86_64
- Version: I noticed this in the 2021-07 snapshot, but it looks as if this behavior first appeared between the 2019-06 and 2020-04 snapshots.
Additional context
I suspect, but have not confirmed, that this behavior is a consequence of the work undertaken to address issues 79 and 80.
I'm not sure what the best way to fix this should be. As a stopgap workaround, it's possible to reorder *MODULE-PROVIDER-FUNCTIONS*
after loading ASDF and before loading any other contrib:
;; Before REQUIRE'ing any other contrib
(require :asdf)
(setf *module-provider-functions* '(lisp::module-provide-cmucl-defmodule
lisp::module-provide-cmucl-library
asdf/operate:module-provide-asdf))
This seems okay for interactive use, but it's a little clunky, in that any files that might contain REQUIRE would need those 4 lines before the first REQUIRE.