Infinite loop caused by recursion walk
xinzhengzhang opened this issue · 1 comments
xinzhengzhang commented
I am integrating with bazel system, but the process found that the walk function is not handled correctly, resulting in an infinite loop. I tried to make a patch and it has been successfully integrated in bazel with 'manually' provide a list of dependencies through a shell script, located either at [project root]/kls-classpath
+++ b/shared/src/main/kotlin/org/javacs/kt/SourceExclusions.kt
@@ -18,7 +18,14 @@ class SourceExclusions(private val workspaceRoots: Collection<Path>) {
fun walkIncluded(): Sequence<Path> = workspaceRoots.asSequence().flatMap { root ->
root.toFile()
.walk()
- .onEnter { isPathIncluded(it.toPath()) }
+ .onEnter {
+ val enter = if (it.canonicalPath != it.absolutePath) {
+ false
+ } else {
+ isPathIncluded(it.toPath())
+ }
+ enter
+ }
.map { it.toPath() }
}
0001-Handle-recursive-walk-infinite-loops-such-as-bazel-s.patch
xinzhengzhang commented
Close duplicate issues due to crash of github yesterday