Confusing behavior when using an empty string as a system name
When quicklisp is loaded or *central-registry*
is not empty, asdf can locate the system named ""
:
;; if quicklisp is loaded
* (asdf:locate-system "")
T
NIL
#P"/home/user/quicklisp/quicklisp/"
NIL
NIL
;; if quicklisp is not loaded
;; $ sbcl --no-userinit
* (require :asdf)
("ASDF" "asdf" "UIOP" "uiop")
* (push #P"~/common-lisp/" asdf:*central-registry*)
(#P"~/common-lisp/")
* (asdf:locate-system "")
T
NIL
#P"/home/user/common-lisp/"
NIL
NIL
This leads to a confusing error message when a trying to load a system named ""
:
* (asdf:load-system "")
debugger invoked on a LOAD-SYSTEM-DEFINITION-ERROR in thread #<THREAD tid=1802466 "main thread" RUNNING {1001460003}>: Error while trying to load definition for system from pathname /home/user/common-lisp/: Can't LOAD a directory: #P"/home/user/common-lisp/".
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [RETRY ] Retry #<DEFINE-OP > on #<UNDEFINED-SYSTEM "">.
1: [ACCEPT ] Continue, treating #<DEFINE-OP > on #<UNDEFINED-SYSTEM ""> as having been successful.
2: Retry ASDF operation.
3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
4: Retry ASDF operation.
5: Retry ASDF operation after resetting the configuration.
6: [ABORT ] Exit debugger, returning to top level.
((LAMBDA (CONDITION) :IN PERFORM) #<SB-INT:SIMPLE-FILE-ERROR "Can't LOAD a directory: ~s." {1004508A43}>)
source: (ERROR (QUOTE LOAD-SYSTEM-DEFINITION-ERROR) :NAME (COERCE-NAME S) :PATHNAME PATHNAME :CONDITION CONDITION)
0]
This also manifests when loading a system that has :depends-on ("")
;; test.asd
(defsystem "test"
:depends-on (""))
;; $ sbcl --no-userinit
* (require :asdf)
("ASDF" "asdf" "UIOP" "uiop")
* (push "~/common-lisp/" asdf:*central-registry*)
("~/common-lisp/")
* (asdf:load-asd (merge-pathnames "test.asd"))
#<ASDF/FIND-SYSTEM:DEFINE-OP >
#<ASDF/PLAN:SEQUENTIAL-PLAN {10014C0BD3}>
* (asdf:load-system :test)
debugger invoked on a LOAD-SYSTEM-DEFINITION-ERROR in thread #<THREAD tid=1802775 "main thread" RUNNING {1004840093}>: Error while trying to load definition for system from pathname /home/user/common-lisp/: Can't LOAD a directory: #P"/home/user/common-lisp/".
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [RETRY ] Retry #<DEFINE-OP > on #<UNDEFINED-SYSTEM "">.
1: [ACCEPT ] Continue, treating #<DEFINE-OP > on #<UNDEFINED-SYSTEM ""> as having been successful.
2: Retry ASDF operation.
3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
4: Retry ASDF operation.
5: Retry ASDF operation after resetting the configuration.
6: [ABORT ] Exit debugger, returning to top level.
((LAMBDA (CONDITION) :IN PERFORM) #<SB-INT:SIMPLE-FILE-ERROR "Can't LOAD a directory: ~s." {100188BC23}>)
source: (ERROR (QUOTE LOAD-SYSTEM-DEFINITION-ERROR) :NAME (COERCE-NAME S) :PATHNAME PATHNAME :CONDITION CONDITION)
0]