From b2f19ab3b567fd46a0f8b45f4b4c88fdbddac72f Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Thu, 16 Jun 2022 11:20:50 +0100 Subject: [PATCH] graalvmXX-ce: use a patched version of zlib The previous releases of zlib were not sensitive to incorrect CRC inputs with bits set above the low 32. Some programs were depended on this behavior, including GraalVM. So this commit backports a patch from `zlib` develop that brings back the old behavior. This will probably be included in the next release of zlib. Before: ``` $ rm -rf ~/.babashka $ bb -e "(babashka.pods/load-pod 'clj-kondo/clj-kondo \"2022.05.31\")" Downloading pod clj-kondo/clj-kondo (2022.05.31) ----- Error -------------------------------------------------------------------- Type: java.util.zip.ZipException Message: invalid entry CRC (expected 0x269cdf2c but got 0x13b86fd8) Location: :1:1 ----- Context ------------------------------------------------------------------ 1: (babashka.pods/load-pod 'clj-kondo/clj-kondo "2022.05.31") ^--- invalid entry CRC (expected 0x269cdf2c but got 0x13b86fd8) ----- Stack trace -------------------------------------------------------------- babashka.pods.impl.resolver/unzip - babashka.pods.impl.resolver/resolve/fn--30674 - clojure.core/mapv/fn--8535 - clojure.core.protocols/fn--8244 - clojure.core.protocols/fn--8204/G--8199--8213 - ... (run with --debug to see elided elements) babashka.pods.sci/load-pod/fn--30887 - babashka.pods.sci/load-pod - clojure.core/apply - babashka.impl.pods/load-pod - user - :1:1 ``` After: ``` $ rm -rf ~/.babashka $ ./result/bin/bb -e "(babashka.pods/load-pod 'clj-kondo/clj-kondo \"2022.05.31\")" Downloading pod clj-kondo/clj-kondo (2022.05.31) Successfully installed pod clj-kondo/clj-kondo (2022.05.31) ``` The issue should affect other programs using GraalVM, but this was the test that I had at hand. --- .../compilers/graalvm/community-edition/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 6badaa3b4c8a..724800898ace 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -1,4 +1,4 @@ -{ callPackage, Foundation }: +{ callPackage, fetchpatch, zlib, Foundation }: /* Add new graal versions and products here and then see update.nix on how to generate the sources. @@ -7,6 +7,15 @@ let mkGraal = opts: callPackage (import ./mkGraal.nix opts) { inherit Foundation; + # remove this once zlib 1.2.13 is released + zlib = zlib.overrideAttrs (oldAttrs: { + patches = (oldAttrs.patches or [ ]) ++ [ + (fetchpatch { + url = "https://github.com/madler/zlib/commit/ec3df00224d4b396e2ac6586ab5d25f673caa4c2.patch"; + sha256 = "sha256-jSa3OCigBdpWFDllCWC2rgE9GxCNR0yjsc+bpwPDBEA="; + }) + ]; + }); }; /*