GNU bug report logs - #75440
dejagnu does not like java.io.Console of OpenJDK >= 22

Previous Next

Package: dejagnu;

Reported by: Chris Nospam <chris21k <at> gmx.de>

Date: Wed, 8 Jan 2025 17:25:01 UTC

Severity: normal

Done: Jacob Bachmeyer <jcb62281 <at> gmail.com>

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: jcb62281 <at> gmail.com
Cc: tracker <at> debbugs.gnu.org
Subject: bug#75440: closed (dejagnu does not like java.io.Console of
 OpenJDK >= 22)
Date: Mon, 15 Sep 2025 01:52:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 14 Sep 2025 20:50:49 -0500
with message-id <ededcacf-797d-4479-926a-ba2f58f2b375 <at> gmail.com>
and subject line Re: bug#75440: dejagnu does not like java.io.Console of OpenJDK >= 22
has caused the debbugs.gnu.org bug report #75440,
regarding dejagnu does not like java.io.Console of OpenJDK >= 22
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
75440: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75440
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Chris Nospam <chris21k <at> gmx.de>
To: bug-dejagnu <at> gnu.org
Subject: dejagnu does not like java.io.Console of OpenJDK >= 22
Date: Wed, 8 Jan 2025 16:44:55 +0000
[Message part 3 (text/plain, inline)]
Dear maintainers,

starting with OpenJDK Java 22 java programs using java.io.Console cannot be testet with dejagnu any more. With JDK 21 it works like a charm.
I belive it has to do with excape sequences that are not filtered out correctly or similar. I am using dejagnu 1.6.3-1, debain package under Ubuntu 24.04.

For an easy reproduction of the bug I have attached a simple example simple.zip. Just unpack it and execute exectest.sh. Be sure to update JAVA_HOME in this script to a jdk 22 or 23 installation.

In testsuite/simple.log some escape sequences are shown were no one are expected:
^[[?1h^[=^[[?2004hhello
^[[?1l^[>^[[?1000l^[[?2004lhello

The attached simple echo example works after simply commenting the lines 13-14 (using Console) and uncommenting lines 16-17 (using BufferedReader) in testsuite/simple.sh.
Alternatively it also works by passing -Djdk.console=java.base to the jvm (1st line in exectest.sh), to trigger the old implementation in JDK.

#!/usr/bin/env -S java --source 23
// #!/usr/local/java/jdk-23.0.1/bin/java --source 23 -Djdk.console=java.base

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ConsoleTest {

    public static void main(String[] args) throws IOException {
        System.out.print("prompt> ");

        java.io.Console c = System.console();
        String input = c.readLine();

        // BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        // String input = in.readLine();

        System.out.println(input);
        System.out.println("prompt> ");
    }

}

It has something to do with the change of the Java default Console provider to JLine in Java 22.
https://bugs.openjdk.org/browse/JDK-8309141
However, as Java Console works everywhere else (windows/linux console/bash/EclipseIDE internal "console"/IntelliJ internal "console") as far I can see, it seems to be something special with dejagnu.

Thanks for dejagnu, maintaining it, and your help,
Chris
[simple.zip (application/x-zip-compressed, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Jacob Bachmeyer <jcb62281 <at> gmail.com>
To: Chris Nospam <chris21k <at> gmx.de>, 75440-done <at> debbugs.gnu.org
Subject: Re: bug#75440: dejagnu does not like java.io.Console of OpenJDK >= 22
Date: Sun, 14 Sep 2025 20:50:49 -0500
On 9/14/25 01:37, Chris Nospam via Bug-dejagnu via wrote:
> I can confirm that the OpenJDK maintainers finally fixed the problem in JDK 25.0.0 ea. They reverted back to the previous Console implementation of JDK 21.
>
> @Jacob Bachmeyer: Many tanks for your help.

Excellent, NOTOURBUG and resolved by the responsible party. Closing issue.


-- Jacob




This bug report was last modified 10 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.