I have posted [Issue 150](https://gitlab.common-lisp.net/asdf/asdf/-/issues/150) on ASDF, with a shell script for replicating the issue.

On 4 Jan 2024, at 9:16, Robert Goldman wrote:

Maybe there's an issue with using `(asdf:load-system "asdf")` instead of using `(asdf:upgrade-asdf)`.

Starting Allegro 11 with no user customization (`-q`) I get this:

```
International Allegro CL Enterprise Edition
11.0 [64-bit macOS (Apple Silicon)]
Copyright (C) 1985-2023, Franz Inc., Lafayette, CA, USA. All Rights Reserved.
...
CL-USER(1): (require :asdf)
; Fast loading
;    /Applications/AllegroCL64.app/Contents/Resources/code/ASDF.fasl
; Autoloading for class SYNONYM-STREAM:
;   Fast loading from bundle code/streamc.fasl.
;     Fast loading from bundle code/efft-utf-8s-base.fasl.
;     Fast loading from bundle code/efft-utf8-base.fasl.
;     Fast loading from bundle code/efft-void.fasl.
;     Fast loading from bundle code/efft-latin1-base.fasl.
; Autoloading for package "EXCL.OSI":
;   Fast loading
;      /Applications/AllegroCL64.app/Contents/Resources/code/OSI.fasl
;     Fast loading from bundle code/fileutil.fasl.
;     Fast loading from bundle code/acldns.fasl.
;     Fast loading from bundle code/iodefs.fasl.
;       Fast loading from bundle code/iordefs.fasl.
;         Fast loading from bundle code/efmacs.fasl.
TCL-USER(4): (asdf:asdf-version)
"3.2.0"
CL-USER(5): (push "/Users/rpg/lisp/asdf/" asdf:*central-registry*)
("/Users/rpg/lisp/asdf/" "/Users/rpg/lisp/asdf/build/")
```

The following makes it look like ASDF is getting loaded multiple times (could it be because ASDF loads ASDF in order that it can ... load ASDF?):
```
; Loading /Users/rpg/lisp/asdf/asdf.asd
; Fast loading
; /Users/rpg/.cache/common-lisp/acl-11.0-macosx-64-bit_apple_silicon/Users/rpg/lisp/asdf/build/asdf.fasl
Warning: FIRST-FEATURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: IMPLEMENTATION-TYPE is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: *IMPLEMENTATION-TYPE* is defined more than once as `variable'
         in file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: OPERATING-SYSTEM is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: ARCHITECTURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
; Loading /Users/rpg/lisp/asdf/asdf.asd
; Fast loading
; /Users/rpg/.cache/common-lisp/acl-11.0-macosx-64-bit_apple_silicon/Users/rpg/lisp/asdf/build/asdf.fasl
Warning: FIRST-FEATURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: IMPLEMENTATION-TYPE is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: *IMPLEMENTATION-TYPE* is defined more than once as `variable'
         in file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: OPERATING-SYSTEM is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lis
```

Doing the same process, only with `upgrade-asdf` instead of `load-system` also seems to load ASDF more than once:
```
; /Users/rpg/.cache/common-lisp/acl-11.0-macosx-64-bit_apple_silicon/Users/rpg/lisp/asdf/build/asdf.fasl
Warning: FIRST-FEATURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: IMPLEMENTATION-TYPE is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: *IMPLEMENTATION-TYPE* is defined more than once as `variable'
         in file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: OPERATING-SYSTEM is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: ARCHITECTURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
; Upgrading ASDF from version 3.2.0 to version 3.3.6.2
; Loading /Users/rpg/lisp/asdf/asdf.asd
; Fast loading
; /Users/rpg/.cache/common-lisp/acl-11.0-macosx-64-bit_apple_silicon/Users/rpg/lisp/asdf/build/asdf.fasl
Warning: FIRST-FEATURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: IMPLEMENTATION-TYPE is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: *IMPLEMENTATION-TYPE* is defined more than once as `variable'
         in file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: OPERATING-SYSTEM is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: ARCHITECTURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
; Loading /Users/rpg/lisp/asdf/asdf.asd
; Fast loading
; /Users/rpg/.cache/common-lisp/acl-11.0-macosx-64-bit_apple_silicon/Users/rpg/lisp/asdf/build/asdf.fasl
Warning: FIRST-FEATURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: IMPLEMENTATION-TYPE is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: *IMPLEMENTATION-TYPE* is defined more than once as `variable'
         in file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: OPERATING-SYSTEM is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: ARCHITECTURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
; Loading /Users/rpg/lisp/asdf/asdf.asd
; Fast loading
; /Users/rpg/.cache/common-lisp/acl-11.0-macosx-64-bit_apple_silicon/Users/rpg/lisp/asdf/build/asdf.fasl
Warning: FIRST-FEATURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: IMPLEMENTATION-TYPE is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: *IMPLEMENTATION-TYPE* is defined more than once as `variable'
         in file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: OPERATING-SYSTEM is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: ARCHITECTURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
; Loading /Users/rpg/lisp/asdf/asdf.asd
T
```

So the process I have gone through is:

1. Start `alisp` with no user customization
2. `(require :asdf)` to load the copy of ASDF that is bundled with Allegro (no idea why it's so old)
3. Push the ASDF directory on `asdf:*central-registry*`
4. `(asdf:upgrade-asdf)`

This isn't actually the precise process I wanted to demonstrate -- that was ASDF reloading itself when I was just loading a `.asd` file through `find-system` -- but it's the same issue.

I noticed this because I have some CI scripts for `random-state` that tests to see if `random-state` builds cleanly (without warnings or style-warnings) and it fails that check not because of anything in `random-state`, but because the triggered reloading of ASDF causes redefinition warnings to be signaled (as above). After the above steps (ending in `upgrade-asdf`) I tested, and was able to replicate this behavior:

```
CL-USER(4): (push "/Users/rpg/lisp/random-state/" asdf:*central-registry*)
("/Users/rpg/lisp/random-state/" "/Users/rpg/lisp/asdf/")
CL-USER(5): (asdf:find-system "random-state")
; Fast loading
; /Users/rpg/.cache/common-lisp/acl-11.0-macosx-64-bit_apple_silicon/Users/rpg/lisp/asdf/build/asdf.fasl
Warning: FIRST-FEATURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: IMPLEMENTATION-TYPE is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: *IMPLEMENTATION-TYPE* is defined more than once as `variable'
         in file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: OPERATING-SYSTEM is defined more than once as `operator' in
         file /Users/rpg/lisp/asdf/build/asdf.lisp.
Warning: ARCHITECTURE is defined more than once as `operator' in file
         /Users/rpg/lisp/asdf/build/asdf.lisp.
; Loading /Users/rpg/lisp/asdf/asdf.asd
; Loading /Users/rpg/lisp/random-state/random-state.asd
#<ASDF/SYSTEM:SYSTEM "random-state">
```

I'm not sure why `find-system` should cause ASDF to reload (again). Could this be caused by the call to `definition-dependencies-up-to-date-p` in [the string method for find-system](https://gitlab.common-lisp.net/asdf/asdf/-/blame/master/find-system.lisp?ref_type=heads#L256) ?

I'll do some more tests with a bunch of the function calls in `definition-dependencies-up-to-date-p` traced, and make an issue for this with a runnable replication script.


On 2 Jan 2024, at 19:24, Faré wrote:

Do you have multiple versions of ASDF installed? e.g. one from Allegro and another from your source-registry or system-registry ? ASDF always upgrades
itself first thing to avoid Big Problems otherwise.

If that's what you're experiencing, I recommend the right after you
(require "asdf") and configure it (if you do), you should explicitly
(asdf:upgrade-asdf) with whatever warning need be muffled, and then you'll
be good.

If there's more than that, please send instructions to reproduce the issue.

-#f

On Tue, Jan 2, 2024, 16:47 Robert Goldman <rpgold...@sift.info> wrote:

I am finding that ASDF loads itself multiple times, unnecessarily, at least on Allegro 11. E.g., it reloads when I simply invoke (asdf:component-pathname
(asdf:find-system "foo")) for one of my systems.

This is annoying because I get redefinition style warnings every time I do
this, which makes it hard to tell when a system loads cleanly.

I have a vague memory of a discussion that addressed the question of why this happens. Does anyone recall the answer, or have a pointer to the
discussion?

Interestingly, when I load ASDF and then invoke (asdf/component:component-operation-times
(asdf:find-system "asdf")) the only time listed is for define-op

Thanks,
R

Reply via email to