Open nxtk opened 2 years ago
If anyone else is bumping into this bug and could provide a repro repository it would help a lot! I still could not reproduce this one. Also, PRs are welcome ;)
Hi, Bruno!
There you go:
Today I opened this project: https://wdho.ru/2fc25f/clojure-stefan.rar
and, right after the end of indexing the project, got an exception with the following stack trace:
java.lang.RuntimeException: Unsupported escape character: \ . at clojure.lang.Util.runtimeException(Util.java:221) at clojure.lang.EdnReader$StringReader.invoke(EdnReader.java:457) at clojure.lang.EdnReader.readDelimitedList(EdnReader.java:757) at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:680) at clojure.lang.EdnReader.read(EdnReader.java:145) at clojure.lang.EdnReader.read(EdnReader.java:111) at clojure.lang.EdnReader.readString(EdnReader.java:67) at clojure.edn$read_string.invokeStatic(edn.clj:46) at clojure.edn$read_string.invokeStatic(edn.clj:37) at clojure.edn$read_string.invoke(edn.clj:37) at clojure.lang.Var.invoke(Var.java:384) at clojure.java.api.Clojure.read(Clojure.java:93) at com.github.brcosta.cljstuffplugin.actions.AnalyzeClasspathAction$analyzeWithBuiltinLinter$1.run(AnalyzeClasspathAction.kt:81) at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:423) at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:474) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:589) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:664) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:620) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:588) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699) at java.base/java.lang.Thread.run(Thread.java:833)
So looks like the bug is in line 81 here: https://github.com/brcosta/clj-extras-plugin/blob/main/src/main/kotlin/com/github/brcosta/cljstuffplugin/actions/AnalyzeClasspathAction.kt
Please also check line 457 in this file: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java This line is throw Util.runtimeException("Unsupported escape character: \" + (char) ch); Our message is "Unsupported escape character: \ ." (so the problem is with the dot). Looks like the dot hasn't been escaped somewhere in the plugin code (Clojure requires additional escapes compared with Java).
I may be wrong but shouldn't you escape dots in AnalyzeClasspathAction.kt in these lines in string interpolations? 68 val configDir = "${basePath}${File.separatorChar}.clj-kondo" or 72 log.info("built-in clj-kondo: Linting classpath file: ${file.path}")
I'm running into this error too, though I'm on Windows 11, not Windows 10.
I see this in the source @makarichevss linked:
val filePath = StringUtil.unescapeBackSlashes(file.path)
val config =
"{:config-dir \"${configDir}\" :copy-configs true :dependencies true :lint [\"$filePath\"]}"
...and I wonder whether the configDir
value might also need to be unescaped (on Windows, where it might contain backslashes).
I've never done plugin development, but I'm happy to help if there's some way I can set some switches and provide logs etc.
Extras: 0.7.3 Cursive: 1.12.4-2022.1 OpenJDK 17.0.2.8: Microsoft build Idea CE: 2022.1.3 (IC-221.5921.22) Windows 10
java.lang.RuntimeException: Unsupported escape character: \. at clojure.lang.Util.runtimeException(Util.java:221) at clojure.lang.EdnReader$StringReader.invoke(EdnReader.java:457) at clojure.lang.EdnReader.readDelimitedList(EdnReader.java:757) at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:680) at clojure.lang.EdnReader.read(EdnReader.java:145) at clojure.lang.EdnReader.read(EdnReader.java:111) at clojure.lang.EdnReader.readString(EdnReader.java:67) at clojure.edn$read_string.invokeStatic(edn.clj:46) at clojure.edn$read_string.invokeStatic(edn.clj:37) at clojure.edn$read_string.invoke(edn.clj:37) at clojure.lang.Var.invoke(Var.java:384) at clojure.java.api.Clojure.read(Clojure.java:93) at com.github.brcosta.cljstuffplugin.actions.AnalyzeClasspathAction$analyzeWithBuiltinLinter$1.run(AnalyzeClasspathAction.kt:81) at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442) at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:244) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:189) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:176) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665) at java.base/java.lang.Thread.run(Thread.java:829)