Subject: bug#36685: ant-bootstrap fails on core-updates (409 dependents)

From: Ricardo Wurmus <[email-masked]>
Date: Fri, 19 Jul 2019 10:09:06 +0200

Ricardo Wurmus <[email-masked]> writes:
> Here’s a shorter patch:
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
> index 403c446a82..bd98784232 100644
> --- a/gnu/packages/java.scm
> +++ b/gnu/packages/java.scm
> @@ -152,6 +152,13 @@ and binary format defined in The Java Virtual Machine Specification.")
>               "--disable-gjdoc")
>         #:phases
>         (modify-phases %standard-phases
> +         (add-after 'unpack 'foo
> +           (lambda _
> +             (substitute* "native/jni/java-io/java_io_VMFile.c"
> +               (("result = cpio_isFileExists.*" m)
> +                (string-append m "
> +//Without a long comment the Java side will return \"true\" on x86_64 all the time.")))
> +             #t))
>           (add-after 'install 'install-data
>             (lambda _ (invoke "make" "install-data"))))))
>      (native-inputs
> --8<---------------cut here---------------end--------------->8---
>
> This only adds a comment.  If the comment is too short it won’t work.

No, that’s wrong.

To my eternal embarrassement but also great relief this substitution has
the effect of commenting the *following* line which frees up previously
claimed resources (a bunch of characters making up the file name).  The
other comments I tested must have ended on \n, so they did not have this
effect.

Thanks to Julien for pointing this out!

So!  Creating a memory leak lets us successfully build ant-bootstrap.
It does not, however, get us all the way through the Java bootstrap.
When configuring the first icedtea I get this error:

--8<---------------cut here---------------start------------->8---
checking if the VM and compiler work together... ./configure: line 9614:   697 Illegal instruction     $JAVA -classpath . $BYTECODE 1>&5 2>&1
configure: error: VM failed to run compiled class.
command "/gnu/store/h9c5g3inn5zmkixk08m27zzpj58zbfgy-bash-minimal-5.0.7/bin/bash" "./configure" "CONFIG_SHELL=/gnu/store/h9c5g3inn5zmkixk08m27zzpj58zbfgy-bash-minimal-5.0.7/bin/bash" "SHELL=/gnu/store/h9c5g3inn5zmkixk08m27zzpj58zbfgy-bash-minimal-5.0.7/bin/bash" "--prefix=/gnu/store/802356lxpjkqk66kv35mdzxhvaw6rghp-icedtea-1.13.13" "--enable-fast-install" "--docdir=/gnu/store/d4c4w9bka2bnnrwrmph1ilgjss5i37h9-icedtea-1.13.13-doc/share/doc/icedtea" "--build=x86_64-unknown-linux-gnu" "--enable-bootstrap" "--enable-nss" "--without-rhino" "--with-parallel-jobs" "--disable-downloading" "--disable-tests" "--with-ecj=/gnu/store/6dijv9ynn5j2bya86dgjn8v0qfd1nv3j-ecj-bootstrap-3.2.2/share/java/ecj-bootstrap.jar" "--with-jar=/gnu/store/hw67b3w83cc2abbgrf0wqzra07iiz3a1-fastjar-0.98/bin/fastjar" "--with-jdk-home=/gnu/store/1agbz95p2ljcvbb88w7p7jn2hnd6z3gv-classpath-0.99-1.e7c13ee0c" "--with-java=/gnu/store/ril2kk63p1grib14vl88z3aladfs33gf-jamvm-2.0.0/bin/jamvm" failed with status 1
--8<---------------cut here---------------end--------------->8---

Illegal instruction?  This uses JamVM 2.0.0 as the JVM.  I’ll try to
figure out what instruction this is and where it comes from.

--
Ricardo