Skip to content

Commit

Permalink
Do pedantic cycle detection based on strings, not dependency nodes.
Browse files Browse the repository at this point in the history
Fixes #2798

This is caused by what seems like a bug in Aether's DependencyNode
implementation; most nodes will hash correctly such that

    (some #{node} parents)

works to do cycle detection, but certain ones in Netty's boringssl do
not hash correctly, so we have to convert them to strings before using
them for cycle detection purposes.
  • Loading branch information
technomancy committed Jul 24, 2022
1 parent 7936cc1 commit f9dc21a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions leiningen-core/src/leiningen/core/pedantic.clj
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@
(if (empty? paths)
results
(recur (for [{:keys [node parents]} paths
:when (not (some #{node} parents))
;; hashing is broken for dependency nodes in aether so we
;; have to do cycle detection based on strings instead
:when (not (some #{(str node)} (map str parents)))
c (.getChildren node)]
{:node c
:parents (conj parents node)})
{:node c :parents (conj parents node)})
(doall (concat results paths))))))

(defn- transform-graph
Expand Down
10 changes: 10 additions & 0 deletions leiningen-core/test/leiningen/core/test/pedantic.clj
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,13 @@
:ranges [{:node [a "2"]
:parents [[range "2"]]}]}])))

(deftest netty-boringssl-works
(let [project {:root "/tmp"
:dependencies '[[io.netty/netty-tcnative-boringssl-static
"2.0.50.Final"]]
:pedantic? :warn
:repositories [["c" {:url "https://repo1.maven.org/maven2/"
:snapshots false}]]}]
;; this will result in an infinite loop in lein 2.9.8
(is (leiningen.core.classpath/get-classpath project))))

0 comments on commit f9dc21a

Please sign in to comment.