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

Unknown error while linting tools.reader #413

Closed
frenchy64 opened this issue Aug 1, 2021 · 4 comments · Fixed by the-benchmarker/web-frameworks#4518
Closed

Unknown error while linting tools.reader #413

frenchy64 opened this issue Aug 1, 2021 · 4 comments · Fixed by the-benchmarker/web-frameworks#4518

Comments

@frenchy64
Copy link

If you try and lint clojure/tools.reader@3b0211b you get the following error:

== Eastwood 0.9.4 Clojure 1.10.0-master-SNAPSHOT JVM 16.0.1 ==
Unknown error: {:type :reader-exception, :ex-kind :reader-error}
Subprocess failed (exit code: 1)

It has something to do with reading an octal number in this file: https://github.com/clojure/tools.reader/blob/3b0211b3504e9a8e321bfaa16fe6d5f517fa44be/src/test/clojure/clojure/tools/common_tests.clj

To work around this in my tools.reader fork, I inlined this file instead of loading it. It would be nice if eastwood gave a little more information, like the specific exception and/or file.

@vemv
Copy link
Collaborator

vemv commented Aug 1, 2021

Cheers for the report, I'll make sure to add tools.reader to the git submodules we lint as part of Eastwood's CI pipeline

@frenchy64
Copy link
Author

Turns out by inlining the file, you get a better error message from eastwood. This is the offending line:

https://github.com/clojure/tools.reader/blob/3b0211b3504e9a8e321bfaa16fe6d5f517fa44be/src/test/clojure/clojure/tools/common_tests.clj#L223

These values fail to be read: "\340", "\377".

This is the new error on my fork:

Trace
== Linting typed-test.clj.reader ==
Unknown error: [#error {
 :cause "typed_test/clj/reader.clj [line 245, col 15] Octal escape sequence must be in range [0, 377]."
 :data {:type :reader-exception, :ex-kind :reader-error, :file "typed_test/clj/reader.clj", :line 245, :col 15}
 :via
 [{:type clojure.lang.ExceptionInfo
   :message "typed_test/clj/reader.clj [line 245, col 15] Octal escape sequence must be in range [0, 377]."
   :data {:type :reader-exception, :ex-kind :reader-error, :file "typed_test/clj/reader.clj", :line 245, :col 15}
   :at [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_ex invokeStatic "errors.clj" 34]}]
 :trace
 [[eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_ex invokeStatic "errors.clj" 34]
  [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_ex doInvoke "errors.clj" 24]
  [clojure.lang.RestFn invoke "RestFn.java" 442]
  [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$reader_error invokeStatic "errors.clj" 40]
ools.reader.impl.errors$reader_error doInvoke "errors.clj" 36]
  [clojure.lang.RestFn invoke "RestFn.java" 423]
  [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_bad_octal_number invokeStatic "errors.clj" 158]
  [eastwood.copieddeps.dep10.clojure.tools.reader.impl.errors$throw_bad_octal_number invoke "errors.clj" 157]
  [eastwood.copieddeps.dep10.clojure.tools.reader$escape_char invokeStatic "reader.clj" 287]
  [eastwood.copieddeps.dep10.clojure.tools.reader$escape_char invoke "reader.clj" 270]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_string_STAR_ invokeStatic "reader.clj" 297]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_string_STAR_ invoke "reader.clj" 291]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invokeStatic "reader.clj" 924]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invoke "reader.clj" 905]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_delimited invokeStatic "reader.clj" 196]
clojure.tools.reader$read_delimited invoke "reader.clj" 189]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invokeStatic "reader.clj" 207]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invoke "reader.clj" 203]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invokeStatic "reader.clj" 924]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invoke "reader.clj" 905]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_delimited invokeStatic "reader.clj" 196]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_delimited invoke "reader.clj" 189]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invokeStatic "reader.clj" 207]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invoke "reader.clj" 203]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invokeStatic "reader.clj" 924]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invoke "reader.clj" 905]
imited invokeStatic "reader.clj" 196]tools.reader$read_del
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_delimited invoke "reader.clj" 189]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invokeStatic "reader.clj" 207]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_list invoke "reader.clj" 203]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invokeStatic "reader.clj" 924]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read_STAR_ invoke "reader.clj" 905]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read invokeStatic "reader.clj" 973]
  [eastwood.copieddeps.dep10.clojure.tools.reader$read invoke "reader.clj" 950]
  [eastwood.analyze_ns$analyze_file invokeStatic "analyze_ns.clj" 388]
  [eastwood.analyze_ns$analyze_file doInvoke "analyze_ns.clj" 314]
  [clojure.lang.RestFn invoke "RestFn.java" 486]
  [eastwood.analyze_ns$analyze_ns$fn__5089 invoke "analyze_ns.clj" 514]
  [eastwood.analyze_ns$with_form_writers invokeStatic "analyze_ns.clj" 104]
form_writers invoke "analyze_ns.clj" 102]
  [eastwood.analyze_ns$analyze_ns invokeStatic "analyze_ns.clj" 509]
  [eastwood.analyze_ns$analyze_ns doInvoke "analyze_ns.clj" 487]
  [clojure.lang.RestFn invoke "RestFn.java" 439]
  [eastwood.lint$lint_ns invokeStatic "lint.clj" 321]
  [eastwood.lint$lint_ns invoke "lint.clj" 300]
  [eastwood.lint$lint_namespace invokeStatic "lint.clj" 546]
  [eastwood.lint$lint_namespace invoke "lint.clj" 544]
  [eastwood.lint$eval8058$fn__8060$fn__8062 invoke "lint.clj" 569]
  [clojure.lang.PersistentVector reduce "PersistentVector.java" 343]
  [clojure.core$reduce invokeStatic "core.clj" 6829]
  [clojure.core$reduce invoke "core.clj" 6812]
  [eastwood.lint$eval8058$fn__8060 invoke "lint.clj" 567]
  [clojure.lang.MultiFn invoke "MultiFn.java" 252]
  [eastwood.lint$eastwood_core invokeStatic "lint.clj" 630]
  [eastwood.lint$eastwood_core invoke "lint.clj" 590]
  [eastwood.lint$eastwood invokeStatic "lint.clj" 738]
  [eastwood.lint$eastwood invoke "lint.clj" 718]
  [eastwood.lint$eastwood invokeStatic "lint.clj" 719]
  [eastwood.lint$eastwood invoke "lint.clj" 718]
  [eastwood.lint$eastwood_from_cmdline invokeStatic "lint.clj" 750]
  [eastwood.lint$eastwood_from_cmdline invoke "lint.clj" 749]
  [eastwood.lint$_main invokeStatic "lint.clj" 886]
  [eastwood.lint$_main doInvoke "lint.clj" 859]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.lang.Var applyTo "Var.java" 705]
  [clojure.core$apply invokeStatic "core.clj" 667]
  [clojure.main$main_opt invokeStatic "main.clj" 514]
  [clojure.main$main_opt invoke "main.clj" 510]
  [clojure.main$main invokeStatic "main.clj" 664]
  [clojure.main$main doInvoke "main.clj" 616]
  [clojure.lang.RestFn applyTo "RestFn.java" 137]
  [clojure.lang.Var applyTo "Var.java" 705]
  [clojure.main main "main.java" 40]]}]
  [clojure.main$main_opt invokeStatic "main.clj" 514]

Stopped analyzing namespaces after typed-test.clj.reader
due to exception thrown.  140 namespaces left unanalyzed.

@vemv
Copy link
Collaborator

vemv commented Aug 1, 2021

Looks like a matter of backporting clojure/tools.reader@d0e416e

I should upgrade tools.reader if at hand (we have a funny way to bundle it)

Thanks again!

vemv added a commit that referenced this issue Aug 1, 2021
@vemv vemv closed this as completed in 73b63c5 Aug 1, 2021
@vemv
Copy link
Collaborator

vemv commented Aug 1, 2021

0.9.6 is out 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants