Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed stack exhausting when trying to collect dependencies for some ASDF systems. #38

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions full/locatives/asdf-system.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,25 @@
serves as an example of a symbol that's not accessible in the
current package and consequently is not exported.")


(defun find-system (name)
"ASDF:FIND-SYSTEM is 1000 times slower than ASDF:REGISTERED-SYSTEM,
but REGISTERED-SYSTEM sometimes unable to find a system (for example
when this is a primary ASDF system, but it's defpackage defines
package with the name of primary system and a nickname equal to the
subsystem name. See log4cl-extras/core as example).

This we first try to use fast method and fallback to the slow one."
(or (asdf:registered-system name)
(asdf:find-system name)))


(defmethod locate-object (symbol (locative-type (eql 'asdf:system))
locative-args)
(assert (endp locative-args))
;; FIXME: This is slow as hell.
;; TODO: check if replacement of find-system with registered-system helped
(or (asdf:registered-system symbol)
(or (find-system symbol)
(locate-error)))

(defmethod canonical-reference ((system asdf:system))
Expand Down Expand Up @@ -118,9 +131,14 @@

(defgeneric asdf-system-dependencies (system)
(:method ((system-name string))
(asdf-system-dependencies (asdf:registered-system system-name)))
(asdf-system-dependencies (find-system system-name)))
(:method ((system-name (eql nil)))
;; Sometimes find-system might return NIL
;; and if we'll not process it separately, execution will go back
;; to the method where system-name is a symbol leading to heap exhaustion.
nil)
(:method ((system-name symbol))
(asdf-system-dependencies (asdf:registered-system system-name)))
(asdf-system-dependencies (find-system system-name)))
(:method ((system asdf:system))
(loop with base-system = (asdf:primary-system-name system)
with results = nil
Expand Down
2 changes: 2 additions & 0 deletions src/changelog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
"*DOCUMENT-DOWNCASE-UPPERCASE-CODE*"
;; These objects are not documented yet:
"40ANTS-DOC/COMMONDOC/XREF:XREF"))
(0.15.2 2023-11-28
"* Fixed stack exhausting when trying to collect dependencies for some ASDF systems.")
(0.15.1 2023-08-05
"* Fixed issue with unpacking Highlight.js archive when it is having absolute pathnames.

Expand Down