Fork me on GitHub
#tools-deps
<
2022-08-19
>
Derek16:08:55

Encountering one of those nasty CRC errors when creating an uberjar with build-clj. Is there anyway to quickly identify which JAR is malformed? Details in thread:

Derek16:08:14

Execution error (ZipException) at java.util.zip.ZipInputStream/readEnd (ZipInputStream.java:409).
invalid entry CRC (expected 0x843c9fb1 but got 0xee027fb2)

Derek16:08:35

{:clojure.main/message
 "Execution error (ZipException) at java.util.zip.ZipInputStream/readEnd (ZipInputStream.java:409).\ninvalid entry CRC (expected 0x843c9fb1 but got 0xee027fb2)\n",
 :clojure.main/triage
 {:clojure.error/class java.util.zip.ZipException,
  :clojure.error/line 409,
  :clojure.error/cause
  "invalid entry CRC (expected 0x843c9fb1 but got 0xee027fb2)",
  :clojure.error/symbol java.util.zip.ZipInputStream/readEnd,
  :clojure.error/source "ZipInputStream.java",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.util.zip.ZipException,
    :message
    "invalid entry CRC (expected 0x843c9fb1 but got 0xee027fb2)",
    :at
    [java.util.zip.ZipInputStream readEnd "ZipInputStream.java" 409]}],
  :trace
  [[java.util.zip.ZipInputStream readEnd "ZipInputStream.java" 409]
   [java.util.zip.ZipInputStream read "ZipInputStream.java" 198]
   [java.util.jar.JarInputStream read "JarInputStream.java" 194]
   [java.util.zip.ZipInputStream closeEntry "ZipInputStream.java" 142]
   [java.util.zip.ZipInputStream
    getNextEntry
    "ZipInputStream.java"
    120]
   [java.util.jar.JarInputStream
    getNextEntry
    "JarInputStream.java"
    129]
   [java.util.jar.JarInputStream
    getNextJarEntry
    "JarInputStream.java"
    166]
   [clojure.tools.build.tasks.uber$explode invokeStatic "uber.clj" 150]
   [clojure.tools.build.tasks.uber$explode invoke "uber.clj" 141]
   [clojure.tools.build.tasks.uber$uber$fn__3529$fn__3533
    invoke
    "uber.clj"
    257]
   [clojure.lang.PersistentVector reduce "PersistentVector.java" 343]
   [clojure.core$reduce invokeStatic "core.clj" 6885]
   [clojure.core$reduce invoke "core.clj" 6868]
   [clojure.tools.build.tasks.uber$uber$fn__3529 invoke "uber.clj" 256]
   [clojure.core.protocols$iter_reduce invokeStatic "protocols.clj" 49]
   [clojure.core.protocols$fn__8230 invokeStatic "protocols.clj" 75]
   [clojure.core.protocols$fn__8230 invoke "protocols.clj" 75]
   [clojure.core.protocols$fn__8178$G__8173__8191
    invoke
    "protocols.clj"
    13]
   [clojure.core$reduce invokeStatic "core.clj" 6886]
   [clojure.core$reduce invoke "core.clj" 6868]
   [clojure.tools.build.tasks.uber$uber invokeStatic "uber.clj" 254]
   [clojure.tools.build.tasks.uber$uber invoke "uber.clj" 241]
   [clojure.lang.Var invoke "Var.java" 384]
   [clojure.tools.build.api$uber invokeStatic "api.clj" 480]
   [clojure.tools.build.api$uber invoke "api.clj" 408]
   [org.corfield.build$uber invokeStatic "build.clj" 250]
   [org.corfield.build$uber invoke "build.clj" 208]
   [clojure.lang.AFn applyToHelper "AFn.java" 154]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$apply invoke "core.clj" 662]
   [clojure.run.exec$exec invokeStatic "exec.clj" 48]
   [clojure.run.exec$exec doInvoke "exec.clj" 39]
   [clojure.lang.RestFn invoke "RestFn.java" 423]
   [clojure.run.exec$_main$fn__205 invoke "exec.clj" 180]
   [clojure.run.exec$_main invokeStatic "exec.clj" 176]
   [clojure.run.exec$_main doInvoke "exec.clj" 139]
   [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]],
  :cause "invalid entry CRC (expected 0x843c9fb1 but got 0xee027fb2)"}}

Derek16:08:15

I copied the project’s deps.edn file into a pretty bare repository and binary searched it, but it would be nice if the error had context? Maybe there’s a verbose setting I’m missing

Alex Miller (Clojure team)16:08:32

I don't think there is a way to quickly do so right now

Derek16:08:57

Thanks Alex

Alex Miller (Clojure team)16:08:13

but you could clone tools.build, hack whatever debug you want in and point to it instead using org.clojure/tools.build {:local/root "../mybuild"} etc

Derek16:08:01

I was able to identify the jar using a bare repo approach (with the problematic deps.edn file) and luckily there’s a more recent version of the package I’m exploring

Drew Verlee16:08:18

Is there a way to get a list of all installed tools from the top level clj? or search from there for existing tools?

Alex Miller (Clojure team)16:08:59

clj -Ttools list

👀 1
🎉 1
hlship23:08:26

:default-deps provides a set of default coordinate versions to use if no coordinate is specified. The default deps can be used across a set of shared projects to act as a dependency management system:

hlship23:08:47

What does that mean in practice? How do you not specify a coordinate, and how would this apply across a set of shared projects?

Alex Miller (Clojure team)23:08:44

It is possible to specify a nil coordinate that will be filled by a default dep in an alias, but generally I consider this an unfinished part of tools.deps. The intent was in the vein of Maven/lein managed deps, but I've been thinking off and on about a different direction to go with this which might overlap with other things (like bill of materials poms)

Darin Douglass14:08:03

ooo the rare BOM POM

hlship23:08:39

I guess you can specify nil for the coordinates, but I still don't see how that would apply across shared projects.