fukamachi / qlot

A project-local library installer for Common Lisp
https://qlot.tech
MIT License
453 stars 37 forks source link

Qlot finds strange versions of itself #269

Open fosskers opened 2 weeks ago

fosskers commented 2 weeks ago

Describe the bug

I was trying to load the :ultralisp system so that I could develop it. Note that Ultralisp depends on the qlot system as a dependency, but when I tried to load, it was complaining that with-local-quicklisp was missing (Ultralisp uses it). You recently readded it, and yet it still couldn't find it. The copy of qlot in the project's local .qlot/ was also correct.

I then checked (asdf:find-system :qlot) and discovered it was loading my local clone of qlot, found at ~/code/common-lisp/qlot/. Note: this path is not in my asdf:*central-registry* list. I then looked at .qlot/source-registry.conf and found this:

(:source-registry
 :ignore-inherited-configuration
 (:also-exclude ".qlot")
 (:also-exclude ".bundle-libs")
 (:directory #P"/home/colin/code/common-lisp/qlot/"))

I compared this to the same file in another project (transducers) and found it referencing /usr/lib/qlot/ instead, which matches my official installation of the qlot package. So, as an experiment I deleted that .qlot/ as well as my local clone of qlot and reran qlot install in transducers/. Now I see:

(:source-registry
 :ignore-inherited-configuration
 (:also-exclude ".qlot")
 (:also-exclude ".bundle-libs")
 (:directory #P"/home/colin/code/common-lisp/ultralisp/.qlot/dists/ultralisp/software/fukamachi-qlot-20240814155119/"))

^^^ It found a version of itself in a very strange place! My conclusion is that Qlot appears to be searching for itself (its systems?) whereever it can find them, including in locations that ASDF doesn't normally look. And also that it searches in /home/user/... before it looks in global places like /usr/lib/.

I don't know why Qlot needs to "find itself" like this, but either way, I'd expect it to prioritize the /usr/lib/ variant. At least when qlot is being used as a dependency in a project, it should prioritize the version found in .qlot/.

Reproducible steps

  1. Have copies of qlot systems in various locations on your filesystem.
  2. Initialize a project with qlot init / qlot install.
  3. Observe it finding a strange version of qlot in source-registry.conf.
  4. Delete that copy of qlot, the original .qlot/ you made, and rerun qlot install.
  5. Observe a different version of qlot detected.

Error messages

No specific errors.

Versions:

fukamachi commented 2 weeks ago

The searching logic is in ASDF bundled with SBCL, so there's nothing Qlot can do about it. I personally don't use ~/common-lisp because of the problem.

This section will help you to solve it. https://github.com/fukamachi/qlot?tab=readme-ov-file#asdf-configuration-to-prevent-from-loading-by-mistake

fukamachi commented 2 weeks ago

Can you paste the content of qlot script? (such as /usr/local/bin/qlot)

fosskers commented 2 weeks ago
#!/bin/sh
exec /usr/lib/qlot/scripts/run.sh "$@"

which leads to https://github.com/fukamachi/qlot/blob/master/scripts/run.sh

Thanks, I will try the other configuration option. Or I'll hand-configure that :directory field if I notice it's the wrong value.

fosskers commented 2 weeks ago

If I add

(push ".qlot" asdf::*default-source-registry-exclusions*)
(asdf:initialize-source-registry)

to my SBCL config and run sbcl, I'm told:

Package ASDF does not exist.

and a condition is raised.

fukamachi commented 2 weeks ago

You must add (require 'asdf) in case you haven't loaded ASDF or Quicklisp before.

fukamachi commented 2 weeks ago

It seems the loaded Qlot will be overwritten by another Qlot in ~/common-lisp (or in other user space) by ASDF in any case.