Skip to content

Commit f9dc21a

Browse files
committed
Do pedantic cycle detection based on strings, not dependency nodes.
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.
1 parent 7936cc1 commit f9dc21a

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

leiningen-core/src/leiningen/core/pedantic.clj

+4-3
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,11 @@
119119
(if (empty? paths)
120120
results
121121
(recur (for [{:keys [node parents]} paths
122-
:when (not (some #{node} parents))
122+
;; hashing is broken for dependency nodes in aether so we
123+
;; have to do cycle detection based on strings instead
124+
:when (not (some #{(str node)} (map str parents)))
123125
c (.getChildren node)]
124-
{:node c
125-
:parents (conj parents node)})
126+
{:node c :parents (conj parents node)})
126127
(doall (concat results paths))))))
127128

128129
(defn- transform-graph

leiningen-core/test/leiningen/core/test/pedantic.clj

+10
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,13 @@
169169
:ranges [{:node [a "2"]
170170
:parents [[range "2"]]}]}])))
171171

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

0 commit comments

Comments
 (0)