From: "Ludovic Courtès" <ludo@gnu.org>
To: Efraim Flashner <efraim@flashner.co.il>
Cc: 49990@debbugs.gnu.org
Subject: bug#49990: [core-updates-frozen] Ant-bootstrap broken by classpath-bootstrap
Date: Wed, 01 Sep 2021 00:32:39 +0200 [thread overview]
Message-ID: <878s0h8cu0.fsf@gnu.org> (raw)
In-Reply-To: <YSzGTY+7unWe0zRA@3900XT> (Efraim Flashner's message of "Mon, 30 Aug 2021 14:51:41 +0300")
[-- Attachment #1: Type: text/plain, Size: 2134 bytes --]
Hello!
As discussed on IRC, I had a semi-victory with the attached patch, which
works around a miscompilation issue in ‘Java_java_io_VMFile_isFile’.
Unfortunately, with this patch applied, ‘ant-bootstrap’ fails to build
with:
--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build -e '(@@ (gnu packages java) ant-bootstrap)' -K
[…]
... Copying Required Files
... Building Ant Distribution
Buildfile: /tmp/guix-build-ant-bootstrap-1.8.4.drv-0/apache-ant-1.8.4/build.xml
BUILD FAILED
Could not load the version information.
Total time: 0 seconds
... Failed Building Ant Distribution !
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "bash" arguments: ("bootstrap.sh" "-Ddist.dir=/gnu/store/88qc3rkp3bc6qsf6gmknv51vprd3r8j4-ant-bootstrap-1.8.4") exit-status: 1 term-signal: #f stop-signal: #f>
phase `build' failed after 0.8 seconds
command "bash" "bootstrap.sh" "-Ddist.dir=/gnu/store/88qc3rkp3bc6qsf6gmknv51vprd3r8j4-ant-bootstrap-1.8.4" failed with status 1
--8<---------------cut here---------------end--------------->8---
The message “Could not load the version information.” indicates a
NullPointerException in Main.java:
--8<---------------cut here---------------start------------->8---
try {
Properties props = new Properties();
InputStream in =
Main.class.getResourceAsStream("/org/apache/tools/ant/version.txt");
props.load(in);
// …
} catch (NullPointerException npe) {
throw new BuildException("Could not load the version information.");
}
--8<---------------cut here---------------end--------------->8---
Specifically, ‘in’ is null.
‘version.txt’ is looked for in
/tmp/guix-build-ant-bootstrap-1.8.4.drv-0/apache-ant-1.8.4/build/classes/org/apache/tools/ant/version.txt
but at this point it’s still in src/ only. My understanding is that the
“build” target in ‘build.xml’ should copy it to build/classes/.
Ideas? What a wonderful puzzle we have! :-)
Thanks,
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2874 bytes --]
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 08ef7a8213..d3c95a456d 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -230,7 +230,8 @@ only faster.")
(sha256
(base32
"0i99wf9xd3hw1sj2sazychb9prx8nadxh2clgvk3zlmb28v0jbfz"))
- (patches (search-patches "classpath-aarch64-support.patch"))))
+ (patches (search-patches "classpath-aarch64-support.patch"
+ "classpath-miscompilation.patch"))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags
@@ -247,17 +248,6 @@ only faster.")
"--disable-gjdoc")
#:phases
(modify-phases %standard-phases
- ;; XXX: This introduces a memory leak as we remove a call to free up
- ;; memory for the file name string. This was necessary because of a
- ;; runtime error that would have prevented us from building
- ;; ant-bootstrap later. See https://issues.guix.gnu.org/issue/36685
- ;; for the gnarly details.
- (add-after 'unpack 'remove-call-to-free
- (lambda _
- (substitute* "native/jni/java-io/java_io_VMFile.c"
- (("result = cpio_isFileExists.*" m)
- (string-append m "\n//")))
- #t))
(add-after 'install 'install-data
(lambda _ (invoke "make" "install-data"))))))
(native-inputs
diff --git a/gnu/packages/patches/classpath-miscompilation.patch b/gnu/packages/patches/classpath-miscompilation.patch
new file mode 100644
index 0000000000..835113df71
--- /dev/null
+++ b/gnu/packages/patches/classpath-miscompilation.patch
@@ -0,0 +1,31 @@
+For some reason, the original code gets miscompiled on x86_64, leading
+'Java_java_io_VMFile_isFile' to return true when the return value of
+'cpio_checkType' is ENOENT (= 2).
+
+See <https://issues.guix.gnu.org/issue/36685>
+and <https://issues.guix.gnu.org/49990>.
+
+diff --git a/native/jni/java-io/java_io_VMFile.c b/native/jni/java-io/java_io_VMFile.c
+index de1320b..9a5d375 100644
+--- a/native/jni/java-io/java_io_VMFile.c
++++ b/native/jni/java-io/java_io_VMFile.c
+@@ -278,6 +278,7 @@ Java_java_io_VMFile_isFile (JNIEnv * env,
+ const char *filename;
+ int result;
+ jint entryType;
++ jboolean isfile;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+@@ -288,9 +289,10 @@ Java_java_io_VMFile_isFile (JNIEnv * env,
+ }
+
+ result = cpio_checkType (filename, &entryType);
++ isfile = (result == CPNATIVE_OK && entryType == CPFILE_FILE ? 1 : 0);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+- return result == CPNATIVE_OK && entryType == CPFILE_FILE ? 1 : 0;
++ return isfile;
+ #else /* not WITHOUT_FILESYSTEM */
+ return 0;
+ #endif /* not WITHOUT_FILESYSTEM */
next prev parent reply other threads:[~2021-08-31 22:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 21:38 bug#49990: [core-updates-frozen] Ant-bootstrap broken by classpath-bootstrap Julien Lepiller
2021-08-30 11:51 ` Efraim Flashner
2021-08-31 22:32 ` Ludovic Courtès [this message]
2021-09-01 1:02 ` Julien Lepiller
2021-09-01 13:53 ` Ludovic Courtès
2021-09-02 14:15 ` Maxime Devos
2021-09-02 14:57 ` Julien Lepiller
2021-09-03 10:11 ` Ludovic Courtès
2021-09-02 22:27 ` bug#49990: [PATCH] gnu: Fix classpath-bootstrap compilation muradm
2021-09-02 22:38 ` muradm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878s0h8cu0.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=49990@debbugs.gnu.org \
--cc=efraim@flashner.co.il \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).