Package command fails with zip error
See original GitHub issueVersion(s)
> scala-cli about
Scala CLI version 0.1.2
jvm and others, as installed by the tool at the first step:
❯ echo 'println("Hello")' | scala-cli -
Downloading JVM index
Downloading JVM temurin:17
Bloop daemon status: not running
Starting Bloop 1.4.19 at /home/vascod/.local/share/scalacli/bloop/daemon using JVM /home/vascod/.cache/coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17%252B35/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz/jdk-17+35/bin/java
Downloading compilation server 1.4.19
Downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/maven-metadata.xml
Downloaded https://repo1.maven.org/maven2/org/scala-lang/scala-library/maven-metadata.xml
Downloading https://repo1.maven.org/maven2/org/scala-lang/scala3-library_3/maven-metadata.xml
Downloaded https://repo1.maven.org/maven2/org/scala-lang/scala3-library_3/maven-metadata.xml
Getting list of Scala CLI-supported Scala versions
Downloading Scala 3.1.1 compiler
Downloading one dependency and one internal dependency
Compiling project (Scala 3.1.1, JVM)
Compiled project (Scala 3.1.1, JVM)
Hello
os: Archlinux, x86_64
Describe the bug
Installed scala-cli and was following the Getting started guide: https://scala-cli.virtuslab.org/docs/getting_started
When reaching the step packaging (https://scala-cli.virtuslab.org/docs/getting_started#packaging) the output of the tool is the following:
❯ scala-cli package . -o countByExtension
Error: java.util.zip.ZipException: invalid entry CRC (expected 0xb6119209 but got 0x3392577b)
For more details, please see '/home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721542-14117431504118333474.log'
To Reproduce
Basically I was just following along the tutorial. Installed the tool, did the script, made a new file, things are compiling and running, but at the package step it fails.
All steps ran in the folder I did for testing:
░▒▓ ~/dev/r/test-proj ▓▒░─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ echo 'println("Hello")' | scala-cli -
Downloading JVM index
Downloading JVM temurin:17
Bloop daemon status: not running
Starting Bloop 1.4.19 at /home/vascod/.local/share/scalacli/bloop/daemon using JVM /home/vascod/.cache/coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17%252B35/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz/jdk-17+35/bin/java
Downloading compilation server 1.4.19
Downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/maven-metadata.xml
Downloaded https://repo1.maven.org/maven2/org/scala-lang/scala-library/maven-metadata.xml
Downloading https://repo1.maven.org/maven2/org/scala-lang/scala3-library_3/maven-metadata.xml
Downloaded https://repo1.maven.org/maven2/org/scala-lang/scala3-library_3/maven-metadata.xml
Getting list of Scala CLI-supported Scala versions
Downloading Scala 3.1.1 compiler
Downloading one dependency and one internal dependency
Compiling project (Scala 3.1.1, JVM)
Compiled project (Scala 3.1.1, JVM)
Hello
❯ scala-cli hello.sc
Compiling project (Scala 3.1.1, JVM)
Compiled project (Scala 3.1.1, JVM)
Hello!
❯ scala-cli hello.sc -- yes
Hello: yes!
❯ scala-cli repl --dep com.lihaoyi::os-lib:0.7.8
Downloading 2 dependencies
Welcome to Scala 3.1.1 (17.0.3, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> os.pwd
val res0: os.Path = /home/vascod/dev/r/test-proj
scala> os.walk(os.pwd)
val res1: IndexedSeq[os.Path] = ArraySeq(/home/vascod/dev/r/test-proj/.scala-build, /home/vascod/dev/r/test-proj/.scala-build/ide-options.json, /home/vascod/dev/r/test-proj/.scala-build/.bloop, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627.json, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627/project_940fb43dce_940fb43dce-78cc9a9627-analysis.bin, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627/bloop-internal-classes, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627/bloop-internal-classes/main-M28pOQYsSIiO18sXX6DXSg==, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627/bloop-internal-classes/main-M28pOQYsSIiO18sXX6DXSg==/hello_sc$.class, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a96 ... large output truncated, print value to show all
scala>
░▒▓ ~/dev/r/test-proj ▓▒░─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ mkdir scala-cli-getting-started
░▒▓ ~/dev/r/test-proj/scala-cli-getting-started ▓▒░───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ nvim files.scala
❯ scala-cli compile .
Compiling project (Scala 3.1.1, JVM)
Compiled project (Scala 3.1.1, JVM)
❯ lx
drwxr-xr-x - vascod 31 Mar 11:09 .bsp
drwxr-xr-x - vascod 31 Mar 11:09 .scala-build
.rw-r--r-- 220 vascod 31 Mar 11:09 files.scala
❯ nvim countByExtension.sc
❯ scala-cli . -- scala
files.scala
.scala-build/project_97d768c1d3_97d768c1d3/src_generated/main/countByExtension.scala
❯ scala-cli package . -o countByExtension
Error: java.util.zip.ZipException: invalid entry CRC (expected 0xb6119209 but got 0x3392577b)
For more details, please see '/home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721542-14117431504118333474.log'
❯ bat '/home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721542-14117431504118333474.log'
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: /home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721542-14117431504118333474.log
│ Size: 1.8 KB
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ java.util.zip.ZipException: invalid entry CRC (expected 0xb6119209 but got 0x3392577b)
2 │ java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:409)
3 │ java.util.zip.ZipInputStream.read(ZipInputStream.java:198)
4 │ coursier.launcher.internal.FileUtil$.readFullyUnsafe(FileUtil.scala:20)
5 │ coursier.launcher.internal.Zip$$anon$1.next(Zip.scala:20)
6 │ coursier.launcher.internal.Zip$$anon$1.next(Zip.scala:10)
7 │ scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:514)
8 │ scala.collection.Iterator.foreach(Iterator.scala:943)
9 │ scala.collection.Iterator.foreach$(Iterator.scala:943)
10 │ scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
11 │ coursier.launcher.BootstrapGenerator$.writeZip(BootstrapGenerator.scala:112)
12 │ coursier.launcher.BootstrapGenerator$.$anonfun$generate$2(BootstrapGenerator.scala:62)
13 │ coursier.launcher.BootstrapGenerator$.$anonfun$generate$2$adapted(BootstrapGenerator.scala:18)
14 │ coursier.launcher.internal.FileUtil$.withOutputStream(FileUtil.scala:43)
15 │ coursier.launcher.BootstrapGenerator$.generate(BootstrapGenerator.scala:18)
16 │ scala.cli.commands.Package$.scala$cli$commands$Package$$bootstrap(Package.scala:484)
17 │ scala.cli.commands.Package$stateMachine$async$1.apply(Package.scala:174)
18 │ scala.build.EitherStateMachine.start(EitherCps.scala:58)
19 │ scala.cli.commands.Package$.doPackage(Package.scala:98)
20 │ scala.cli.commands.Package$.run(Package.scala:83)
21 │ scala.cli.commands.Package$.run(Package.scala:32)
22 │ caseapp.core.app.CaseApp.main(CaseApp.scala:149)
23 │ caseapp.core.app.CommandsEntryPoint.main(CommandsEntryPoint.scala:116)
24 │ scala.cli.ScalaCliCommands.main(ScalaCliCommands.scala:89)
25 │ scala.cli.ScalaCli$.main0(ScalaCli.scala:148)
26 │ scala.cli.ScalaCli$.main(ScalaCli.scala:71)
27 │ scala.cli.ScalaCli.main(ScalaCli.scala)
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ scala-cli package . -o xx
Error: java.util.zip.ZipException: invalid entry CRC (expected 0xb6119209 but got 0x3392577b)
For more details, please see '/home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721679-10697199402516022739.log'
❯ lx
drwxr-xr-x - vascod 31 Mar 11:09 .bsp
drwxr-xr-x - vascod 31 Mar 11:12 .scala-build
.rw-r--r-- 72k vascod 31 Mar 11:12 countByExtension
.rw-r--r-- 345 vascod 31 Mar 11:11 countByExtension.sc
.rw-r--r-- 220 vascod 31 Mar 11:09 files.scala
.rw-r--r-- 72k vascod 31 Mar 11:14 xx
Doing a clean an retrying again same error.
Expected behaviour I should be getting the output script to be run as the docs say (./countByExtension), instead of an error when packaging.
Issue Analytics
- State:
- Created a year ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
As was commented on https://github.com/oracle/graal/issues/4479, this seems to originate from (apparently legit?) changes in zlib. It seems a workaround should be available in Arch Linux at some point.
That seems to be a native image issue… I opened https://github.com/oracle/graal/issues/4479 for it. https://github.com/VirtusLab/scala-cli/pull/865 should help in the mean time.