technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.61k forks source link

Leiningen 2.11.0 breaks Eastwood #2814

Closed eerohele closed 9 months ago

eerohele commented 9 months ago

Given this project.clj:

(defproject foo "1.0.0"
  :dependencies [[org.clojure/clojure "1.11.0"]]
  :plugins [[jonase/eastwood "1.4.2"]])

Then:

λ curl -sOL https://raw.githubusercontent.com/technomancy/leiningen/2.11.0/bin/lein && chmod +x lein && env JVM_OPTS='-Dclojure.main.report=stderr' ./lein eastwood
{:clojure.main/message
 "Syntax error reading source at (/private/var/folders/r_/pv69pzqn2gd02b4d0hq617hm0000gq/T/form-init15047040516032255484.clj:1:8160).\nNo reader function for tag object\n",
 :clojure.main/triage
 {:clojure.error/phase :read-source,
  :clojure.error/line 1,
  :clojure.error/column 8160,
  :clojure.error/source "form-init15047040516032255484.clj",
  :clojure.error/path
  "/private/var/folders/r_/pv69pzqn2gd02b4d0hq617hm0000gq/T/form-init15047040516032255484.clj",
  :clojure.error/cause "No reader function for tag object"},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.Compiler$CompilerException,
    :message
    "Syntax error reading source at (/private/var/folders/r_/pv69pzqn2gd02b4d0hq617hm0000gq/T/form-init15047040516032255484.clj:1:8160).",
    :data
    {:clojure.error/phase :read-source,
     :clojure.error/line 1,
     :clojure.error/column 8160,
     :clojure.error/source
     "/private/var/folders/r_/pv69pzqn2gd02b4d0hq617hm0000gq/T/form-init15047040516032255484.clj"},
    :at [clojure.lang.Compiler load "Compiler.java" 7660]}
   {:type java.lang.RuntimeException,
    :message "No reader function for tag object",
    :at
    [clojure.lang.LispReader$CtorReader
     readTagged
     "LispReader.java"
     1444]}],
  :trace
  [[clojure.lang.LispReader$CtorReader
    readTagged
    "LispReader.java"
    1444]
   [clojure.lang.LispReader$CtorReader invoke "LispReader.java" 1427]
   [clojure.lang.LispReader$DispatchReader
    invoke
    "LispReader.java"
    846]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader read "LispReader.java" 220]
   [clojure.lang.LispReader access$200 "LispReader.java" 41]
   [clojure.lang.LispReader$MetaReader invoke "LispReader.java" 962]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader readDelimitedList "LispReader.java" 1398]
   [clojure.lang.LispReader$MapReader invoke "LispReader.java" 1355]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader read "LispReader.java" 220]
   [clojure.lang.LispReader access$200 "LispReader.java" 41]
   [clojure.lang.LispReader$MetaReader invoke "LispReader.java" 954]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader readDelimitedList "LispReader.java" 1398]
   [clojure.lang.LispReader$VectorReader invoke "LispReader.java" 1347]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader readDelimitedList "LispReader.java" 1398]
   [clojure.lang.LispReader$MapReader invoke "LispReader.java" 1355]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader read "LispReader.java" 220]
   [clojure.lang.LispReader access$200 "LispReader.java" 41]
   [clojure.lang.LispReader$MetaReader invoke "LispReader.java" 962]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader readDelimitedList "LispReader.java" 1398]
   [clojure.lang.LispReader$MapReader invoke "LispReader.java" 1355]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader readDelimitedList "LispReader.java" 1398]
   [clojure.lang.LispReader$MapReader invoke "LispReader.java" 1355]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader read "LispReader.java" 220]
   [clojure.lang.LispReader access$200 "LispReader.java" 41]
   [clojure.lang.LispReader$MetaReader invoke "LispReader.java" 954]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader readDelimitedList "LispReader.java" 1398]
   [clojure.lang.LispReader$ListReader invoke "LispReader.java" 1243]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader readDelimitedList "LispReader.java" 1398]
   [clojure.lang.LispReader$ListReader invoke "LispReader.java" 1243]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader readDelimitedList "LispReader.java" 1398]
   [clojure.lang.LispReader$ListReader invoke "LispReader.java" 1243]
   [clojure.lang.LispReader read "LispReader.java" 285]
   [clojure.lang.LispReader read "LispReader.java" 216]
   [clojure.lang.Compiler load "Compiler.java" 7648]
   [clojure.lang.Compiler loadFile "Compiler.java" 7591]
   [clojure.main$load_script invokeStatic "main.clj" 475]
   [clojure.main$init_opt invokeStatic "main.clj" 477]
   [clojure.main$init_opt invoke "main.clj" 477]
   [clojure.main$initialize invokeStatic "main.clj" 508]
   [clojure.main$null_opt invokeStatic "main.clj" 542]
   [clojure.main$null_opt invoke "main.clj" 539]
   [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 "No reader function for tag object",
  :phase :read-source}}

Syntax error reading source at (/private/var/folders/r_/pv69pzqn2gd02b4d0hq617hm0000gq/T/form-init15047040516032255484.clj:1:8160).
No reader function for tag object

Subprocess failed (exit code: 1)

cf. Leiningen 2.10.0:

λ curl -sOL https://raw.githubusercontent.com/technomancy/leiningen/2.10.0/bin/lein && chmod +x lein && env JVM_OPTS='-Dclojure.main.report=stderr' ./lein eastwood
== Eastwood 1.4.2 Clojure 1.11.0 JVM 21 ==
Directories scanned for source files: src test
== Linting done in 102 ms ==
== Warnings: 0. Exceptions thrown: 0
== No namespaces were linted. This might indicate a misconfiguration.
Subprocess failed (exit code: 1)

I have moved my profiles.clj out of the way, and I am using the newest available version of the Eastwood Leiningen plugin.

Possibly related issues:

marcobiscaro2112 commented 9 months ago

Same error when using the lein-midje plugin.

It seems I reintroduced #2328 here 😓

marcobiscaro2112 commented 9 months ago

https://codeberg.org/leiningen/leiningen/pulls/39

marcobiscaro2112 commented 9 months ago

For reference, it seems that these plugins include the project in the code that is eval'ed, and the leiningen project includes metadata that refer to vars and functions, such as (can be checked with :eval-in :pprint):

            :compile-path
            #<Var@22b7ef2b:
              #object[leiningen.core.classpath$checkout_deps_paths 0xd0b814d "leiningen.core.classpath$checkout_deps_paths@d0b814d"]>],

...

          :deploy-repositories
          ^{:reduce
            #object[leiningen.core.project$reduce_repo_step 0xb788dc2 "leiningen.core.project$reduce_repo_step@b788dc2"]}
eerohele commented 9 months ago

FWIW, you can also reproduce this with either lein trampoline repl :headless (but not with either lein repl :headless or lein trampoline repl, interestingly).

pieterbreed commented 9 months ago

I am using another plugin that is also broken by the 2.11.0 upgrade, :plugins [[reifyhealth/lein-git-down "0.4.1"]]. I'm not sure if I should report a separate ticket for this issue? The failure I am getting relates to computing the classpath.

(lein-git-down is no longer maintained by the original authors, but it's been working quite well for me up till now. I'm assuming you want to know about breaking changes...)

With this project.clj:

(defproject lein-repro "0.1.0-SNAPSHOT"
  :plugins [[reifyhealth/lein-git-down "0.4.1"]]
  :middleware [lein-git-down.plugin/inject-properties]
  :git-down {pieterbreed/empty-clj-library {:coordinates pieterbreed/empty-clj-library}}
  :repositories [["github" {:url "git://github.com"}]]
  :dependencies [[org.clojure/clojure "1.11.1"]
                 [pieterbreed/empty-clj-library "d1d8fef7dcad05ec5da2505fdd326142d226436b"]])

works with lein 2.10.0:

$ lein clean && rm -rf ~/.m2/repository/pieterbreed/empty-clj-library && lein -v && lein deps

Leiningen 2.10.0 on Java 19 OpenJDK 64-Bit Server VM
Retrieving pieterbreed/empty-clj-library/d1d8fef7dcad05ec5da2505fdd326142d226436b/empty-clj-library-d1d8fef7dcad05ec5da2505fdd326142d226436b.pom from github
Retrieving pieterbreed/empty-clj-library/d1d8fef7dcad05ec5da2505fdd326142d226436b/empty-clj-library-d1d8fef7dcad05ec5da2505fdd326142d226436b.jar from github
Created /home/pieter/.gitlibs/libs/pieterbreed/empty-clj-library/d1d8fef7dcad05ec5da2505fdd326142d226436b/target/empty-clj-library-0.1.0-SNAPSHOT.jar

fails with lein 2.11.0 and 2.11.1

$ lein clean && rm -rf ~/.m2/repository/pieterbreed/empty-clj-library && lein -v && lein deps

Leiningen 2.11.0 on Java 19 OpenJDK 64-Bit Server VM
Retrieving pieterbreed/empty-clj-library/d1d8fef7dcad05ec5da2505fdd326142d226436b/empty-clj-library-d1d8fef7dcad05ec5da2505fdd326142d226436b.pom from github
Could not find destination file to checksum
Could not find destination file to checksum
Retrieving pieterbreed/empty-clj-library/d1d8fef7dcad05ec5da2505fdd326142d226436b/empty-clj-library-d1d8fef7dcad05ec5da2505fdd326142d226436b.jar from github
Created /home/pieter/.gitlibs/libs/pieterbreed/empty-clj-library/d1d8fef7dcad05ec5da2505fdd326142d226436b/target/empty-clj-library-0.1.0-SNAPSHOT.jar
Could not find destination file to checksum
Could not find destination file to checksum
Could not find artifact pieterbreed:empty-clj-library:jar:d1d8fef7dcad05ec5da2505fdd326142d226436b in central (https://repo1.maven.org/maven2/)
Could not find artifact pieterbreed:empty-clj-library:jar:d1d8fef7dcad05ec5da2505fdd326142d226436b in clojars (https://repo.clojars.org/)
Could not transfer artifact pieterbreed:empty-clj-library:jar:d1d8fef7dcad05ec5da2505fdd326142d226436b from/to github (git://github.com): Checksum validation failed, no checksums available
Failed to read artifact descriptor for pieterbreed:empty-clj-library:jar:d1d8fef7dcad05ec5da2505fdd326142d226436b
This could be due to a typo in :dependencies, file system permissions, or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
technomancy commented 9 months ago

@pieterbreed this seems like a different problem.

Just to confirm, can you apply https://codeberg.org/leiningen/leiningen/pulls/39 to see if it solves the problem? If not, it's probably caused by an upstream change from the new version of https://codeberg.org/leiningen/leiningen/commit/d0b2a51580307d1dc08e33b0c1626259db260c02 in which case it would need to be fixed outside Leiningen.

pieterbreed commented 9 months ago

Hi @technomancy , I did as you requested; checked out marcobiscaro2112/mb/dont-print-meta, made (local-only) change to lein project.cl for version ((defproject leiningen "2.11.2-SNAPSHOT"), built uberjar and set LEIN_JAR.

I am getting the same issue as I reported, so this is a seperate issue than the one addressed in the MR.

I'm pasting a log below just to help rule out my own mistakes.

$ env | grep -i lein; lein clean && rm -rf ~/.m2/repository/pieterbreed/empty-clj-library && lein -v && DEBUG=true lein deps

PWD=/home/pieter/Source/github.com/pieterbreed/lein-repro
LEIN_JAR=/home/pieter/Source/codeberg.org/leiningen/leiningen/target/leiningen-2.11.2-SNAPSHOT-standalone.jar
Leiningen 2.11.0 on Java 19 OpenJDK 64-Bit Server VM
Leiningen's classpath: /home/pieter/Source/codeberg.org/leiningen/leiningen/target/leiningen-2.11.2-SNAPSHOT-standalone.jar
Applying task deps to []
Retrieving pieterbreed/empty-clj-library/d1d8fef7dcad05ec5da2505fdd326142d226436b/empty-clj-library-d1d8fef7dcad05ec5da2505fdd326142d226436b.pom from github
Could not find destination file to checksum
Could not find destination file to checksum
Retrieving pieterbreed/empty-clj-library/d1d8fef7dcad05ec5da2505fdd326142d226436b/empty-clj-library-d1d8fef7dcad05ec5da2505fdd326142d226436b.jar from github
Applying task javac to nil
Running javac with [@/tmp/.leiningen-cmdline9837684533248710530.tmp]
Applying task compile to nil
All namespaces already AOT compiled.
Created /home/pieter/.gitlibs/libs/pieterbreed/empty-clj-library/d1d8fef7dcad05ec5da2505fdd326142d226436b/target/empty-clj-library-0.1.0-SNAPSHOT.jar
Could not find destination file to checksum
technomancy commented 9 months ago

Fixed by 82e0927647e58d2ed7afddedfe4eba36d2dff39c.

technomancy commented 9 months ago

@pieterbreed I got a different error with 2.11.1:

Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:476).
org.apache.commons.io.output.TeeOutputStream

Updating to the latest git main (with marcobiscaro2112/mb/dont-print-meta merged) seems to have fixed that problem, but I still get the problem about the missing checksums.

Reverting d0b2a51580307d1dc08e33b0c1626259db260c02 makes the problem go away. Since the main change in that commit was to bump the version of clj-commons/pomegranate, I believe the issue to be caused by changes in that library rather than changes in Leiningen. I don't think we can fix it here unfortunately. It will need to be fixed upstream.

technomancy commented 9 months ago

@eerohele I hope to release the version with the fix for eastwood by early next week.

eerohele commented 9 months ago

Many thanks for the quick turnaround!

technomancy commented 9 months ago

2.11.2 is out with this fix.