Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK updates and removals #344544

Merged
merged 22 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pkgs/by-name/je/jextract/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, fetchFromGitHub
, makeBinaryWrapper
, gradle
, jdk22
, jdk23
, llvmPackages
}:

Expand All @@ -25,7 +25,7 @@ stdenv.mkDerivation {

gradleFlags = [
"-Pllvm_home=${llvmPackages.libclang.lib}"
"-Pjdk22_home=${jdk22}"
"-Pjdk22_home=${jdk23}"
];

doCheck = true;
Expand All @@ -46,8 +46,10 @@ stdenv.mkDerivation {
description = "Tool which mechanically generates Java bindings from a native library headers";
mainProgram = "jextract";
homepage = "https://github.com/openjdk/jextract";
platforms = jdk22.meta.platforms;
platforms = jdk23.meta.platforms;
license = licenses.gpl2Only;
maintainers = with maintainers; [ jlesquembre sharzy ];
# Not yet updated for JDK 23
broken = true;
Comment on lines +52 to +53
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more respectful to jextract users to wait with the jdk22 removal

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping older versions of Java that are possible insecure is more of an issue than having one specific package to break. We could just have marked the JDK22 (and all packages that depend on it) as insecure instead and keep it for longer, but I concur that we should, if anything, to reduce the number of Java packages in the tree to make sure that the ones that we have are up to date.

Copy link
Member Author

@emilazy emilazy Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jextract for the LTS JDK 21 is still in‐tree. There’s been seemingly no movement in the jextract repository porting it to a non‐EOL JDK, so I don’t know what’s going on there. The same upstream that maintains jextract sets the OpenJDK support policy and since it is guaranteed that we will get these versions going EOL every release (when it’s not time for a new LTS) we can’t let the list of insecure, unsupported JDKs keep growing indefinitely, as happened before the 24.11 cycle. I would prefer we move to a scheme like Fedora where the latest JDK is available as openjdk_latest and simply rolls over to the new version when released.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

older versions of Java that are possibly insecure

Well all software is possibly insecure. I know that you mean unmaintained, which is similar.

We could just have marked the JDK22 (and all packages that depend on it) as insecure instead and keep it for longer

That would seem like a better solution to me.

reduce the number of Java packages in the tree to make sure that the ones that we have are up to date

I agree with this as well. But I would suggest something like what I see for java in Debian Trixie where they support:

  • 17
  • 21
  • 22
  • 23
  • 24-ea

At an absolute minimum provide: LTS versions, the latest release, the previous release. It would also be nice to see EA versions installable through Nix, but obviously someone has to do the work.

Releases that are unmaintained upstream could be marked as unsupported/insecure/deprecated, just so long as projects aren't broken without a few months warning.

In the case of jextract, which is a tool to build bindings for Java's Foreign Function & Memory API which went final in JDK 22. The only way (I'm pretty sure) to build bindings for the final API is with the JDK 22-based jextract. So, at this point, there is no way to do that using nixpkgs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jextract for the LTS JDK 21 is still in‐tree.

As I mentioned in my reply above, this version is not very useful because it is for a non-final FFM API and requires use of JDK 21 with "preview features" enabled.

There’s been seemingly no movement in the jextract repository porting it to a non‐EOL JDK

This appears to be the case and is disappointing. Maybe someone should reach out to the OpenJDK project and ask about it.

we can’t let the list of insecure, unsupported JDKs keep growing indefinitely

I agree. But hopefully there's a way to do this with a little more warning (e.g. a 3-6 months) to dependent projects.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well all software is possibly insecure. I know that you mean unmaintained, which is similar.

Well, looking at the latest advisory for Java it seems there are new security issues affecting all supported Java versions. It is very unlikely this doesn't also affect JDK 22 so we actually know it has security issues: https://openjdk.org/groups/vulnerability/advisories/2024-10-15.

Those security advisories are released every 3 months and almost always have at least one security issue, so for a version that is maintained by 9 months like our stable branches we are unlikely to ship the previous version and keep it secure.

I actually like the proposal from @emilazy here to keep all LTS versions+openjdk_latest with the last version, because at least we can ensure that it is possible to keep our JDK versions up to date in stable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I spent about 30 minutes looking into a way to patch jextract for the latest JDK and I didn’t succeed, but I suspect someone with more familiarity would have an easier time with it. It didn’t seem like it should be impossible by any means; it just exceeded the time‐box I had allocated to it. If we could do that then it could also be sent upstream to OpenJDK.

I agree. But hopefully there's a way to do this with a little more warning (e.g. a 3-6 months) to dependent projects.

The OpenJDK release and support cycle is fixed – the 6 months warning is when a new non‐LTS release comes out, and the 3 months warning is 3 months after that. That cycle is on the OpenJDK project; we don’t have the resources to support them longer than upstream does. We’ve regularly lagged behind on security‐critical updates even to the versions we currently have, and 24.05 was in a much worse state (I think all the JDKs there should actually be marked as knownVulnerabilities).

I believe our stable branches are actually maintained for 7 months? But: that means that OpenJDK 23 is going to go EOL during the 24.11 cycle, which is really awkward. Either we mark it with knownVulnerabilities and have only programs using LTS JDKs working without a security version for the last few months of the release cycle, or we backport a bump to the next JDK and potentially break other software in the process. I believe long‐term support distributions like RHEL don’t even bother shipping non‐LTS JDKs. It’s really something you should only depend on if you can be sufficiently agile at supporting upcoming versions, given the upstream policy.

Copy link
Member Author

@emilazy emilazy Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mailing list message claims that jextract should basically “just work” with JDK 23. That was unfortunately not my experience, but it could just be build system issues I’d be running into, so if someone wanted to have a go at getting the package unbroken I suspect it shouldn’t be too difficult.

Edit: It looks like they just released an early access build a few days ago that they claim has Java 23 compatibility. Perhaps a version bump is all it would take now.

Copy link
Contributor

@msgilligan msgilligan Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The arguments about security are compelling. And I know this is a volunteer project with limited resources. I am new to Nixpkgs and am trying to contribute as much as I can (e.g. #271127), but am not (yet) ready to try to (help) support OpenJDK itself.

I have been trying to replace (as much as possible) Homebrew and SDKMAN! with Nixpkgs.

I personally prefer to focus on getting jextract updated: #354591

But I also want to share my experiences a a Nixpkgs user and having something like jdk22 disappear so quickly is not very friendly to downstream projects. A difference between installing JDK binaries with Homebrew or SDKMAN! and using Nix flakes is that dropping JDK 22 will actually break Nix builds, whereas Homebrew or SDKMAN! will allow you to leave your old (unmaintained/insecure) JDK installed and usable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, it’s possible to pin the last Nixpkgs version with OpenJDK 22, and use that package alongside other packages on your system, thanks to Nix’s hermetic pinning of dependency trees. That’s of course inconvenient, and in some ways slightly worse than if we were carrying an insecure‐marked OpenJDK 22 in the current tree (namely: its dependencies won’t get updates either, though since the JDK itself is probably the biggest source of vulnerabilities in its dependency closure that might not matter too much), but hopefully it can at least serve at a pinch when you really can’t do without the old version. (It also avoids having to build the JDK yourself, since we don’t spend Hydra build farm resources on insecure packages.)

I realize it’s frustrating from a user point of view, though, and I sympathize with the pain of dealing with short support cycles – ideally OpenJDK would provide an overlapping support window for their non‐LTS releases, but they don’t. I think they would have the ability to do that; we support a one month security support overlap between our own stable versions despite having considerably fewer resources than Oracle. I don’t really know why they don’t; I was wondering if perhaps it’s because they sell extended commercial support, but that’s only for the LTS releases. I get the impression that they consider their non‐LTS releases to essentially be previews for the next LTS.

If you want to try updating jextract to the latest early access build and seeing if it’ll work on JDK 23 that would be great, and please do ping me for review! I can try to help if you run into any issues as well. I didn’t want to mark it as broken here but making sure we had the latest supported JDK and weren’t at risk of shipping an EOL one in 24.11 took priority. If we could get it fixed before the 24.11 release I’d be very happy.

};
}
8 changes: 3 additions & 5 deletions pkgs/by-name/mo/moneydance/package.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{ lib, stdenv, fetchzip, makeWrapper, openjdk22, openjfx22, jvmFlags ? [ ] }:
{ lib, stdenv, fetchzip, makeWrapper, openjdk23, jvmFlags ? [ ] }:
let
openjfx = openjfx22;
jdk = openjdk22.override {
jdk = openjdk23.override {
enableJavaFX = true;
inherit openjfx;
};
in
stdenv.mkDerivation (finalAttrs: {
Expand All @@ -16,7 +14,7 @@ stdenv.mkDerivation (finalAttrs: {
};

nativeBuildInputs = [ makeWrapper ];
buildInputs = [ jdk openjfx ];
buildInputs = [ jdk ];

# Note the double escaping in the call to makeWrapper. The escapeShellArgs
# call quotes each element of the flags list as a word[1] and returns a
Expand Down
6 changes: 3 additions & 3 deletions pkgs/development/compilers/openjdk/11.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
let
major = "11";
minor = "0";
update = "23";
build = "9";
update = "24";
build = "8";

# when building a headless jdk, also bootstrap it with a headless jdk
openjdk-bootstrap = openjdk11-bootstrap.override { gtkSupport = !headless; };
Expand All @@ -25,7 +25,7 @@ let
owner = "openjdk";
repo = "jdk${major}u";
rev = "jdk-${version}";
sha256 = "sha256-6y6wge8ZuSKBpb5QNihvAlD4Pv/0d3AQCPOkxUm/sJk=";
hash = "sha256-H/VmT6NYbbZBba7Js8xk+epVZ2kLfvlwTNgg5SQ4ljA=";
};

nativeBuildInputs = [ pkg-config autoconf unzip ];
Expand Down
6 changes: 3 additions & 3 deletions pkgs/development/compilers/openjdk/17.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
let
version = {
feature = "17";
interim = ".0.11";
build = "9";
interim = ".0.12";
build = "7";
};

# when building a headless jdk, also bootstrap it with a headless jdk
Expand All @@ -26,7 +26,7 @@ let
owner = "openjdk";
repo = "jdk${version.feature}u";
rev = "jdk-${version.feature}${version.interim}+${version.build}";
sha256 = "sha256-aO4iSc9MklW/4q9U86WEfiiWnlq6iZSbxzq2fbsqd0A=";
hash = "sha256-9UB1H3gd+b4wWxOMgsdDPgX/IGWNORKk1gMsSjYoZMw=";
};

nativeBuildInputs = [ pkg-config autoconf unzip ];
Expand Down
6 changes: 3 additions & 3 deletions pkgs/development/compilers/openjdk/21.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
let
version = {
feature = "21";
interim = ".0.3";
build = "9";
interim = ".0.4";
build = "7";
};

# when building a headless jdk, also bootstrap it with a headless jdk
Expand All @@ -29,7 +29,7 @@ let
owner = "openjdk";
repo = "jdk${version.feature}u";
rev = "jdk-${version.feature}${version.interim}+${version.build}";
hash = "sha256-zRN16lrc5gtDlTVIQJRRx103w/VbRkatCLeEc9AXWPE=";
hash = "sha256-+xpQtQ1IQ7btVWnENT9XS5A/2VP101/+XR3BMo8BqYI=";
};

nativeBuildInputs = [ pkg-config autoconf unzip ensureNewerSourcesForZipFilesHook ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
, libXcursor
, libXrandr
, fontconfig
, openjdk22-bootstrap
, openjdk23-bootstrap
, ensureNewerSourcesForZipFilesHook
, setJavaClassPath
# TODO(@sternenseemann): gtk3 fails to evaluate in pkgsCross.ghcjs.buildPackages
Expand All @@ -51,13 +51,13 @@ let
# $FEATURE.$INTERIM.$UPDATE.$PATCH
# See
# https://openjdk.org/jeps/223
# https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/Runtime.Version.html
featureVersion = "22";
# https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/lang/Runtime.Version.html
featureVersion = "23";
info = builtins.getAttr featureVersion (lib.importJSON ./info.json);
version = info.version;

# when building a headless jdk, also bootstrap it with a headless jdk
openjdk-bootstrap = openjdk22-bootstrap.override { gtkSupport = !headless; };
openjdk-bootstrap = openjdk23-bootstrap.override { gtkSupport = !headless; };
in

stdenv.mkDerivation (finalAttrs: {
Expand Down Expand Up @@ -108,19 +108,9 @@ stdenv.mkDerivation (finalAttrs: {
patches = [
./fix-java-home-jdk21.patch
./read-truststore-from-env-jdk10.patch
./currency-date-range-jdk10.patch
./increase-javadoc-heap-jdk13.patch
./ignore-LegalNoticeFilePlugin-jdk18.patch

# -Wformat etc. are stricter in newer gccs, per
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677
# so grab the work-around from
# https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24
(fetchurl {
url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";
sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";
})

# Fix build for gnumake-4.4.1:
# https://github.com/openjdk/jdk/pull/12992
(fetchpatch {
Expand Down Expand Up @@ -274,7 +264,7 @@ stdenv.mkDerivation (finalAttrs: {
${finalAttrs.finalPackage}/bin/java \
-cp ${java-json} \
${./JavaUpdater.java} \
22 pkgs/development/compilers/openjdk/info.json
${featureVersion} pkgs/development/compilers/openjdk/info.json
'';

home = "${finalAttrs.finalPackage}/lib/openjdk";
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/openjdk/8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let
powerpc64le-linux = "ppc64le";
}.${stdenv.system} or (throw "Unsupported platform ${stdenv.system}");

update = "412";
update = "422";
build = "ga";

# when building a headless jdk, also bootstrap it with a headless jdk
Expand All @@ -34,7 +34,7 @@ let
owner = "openjdk";
repo = "jdk8u";
rev = "jdk${version}";
sha256 = "sha256-o+H5n5p6JG1giJj9OADgMbQPaoKMzLMFquKH536SHhM=";
hash = "sha256-uMo1DIkji+FPTbFRwURXybkLE5xv+teSClWP9RfAvfo=";
};
outputs = [ "out" "jre" ];

Expand Down
40 changes: 0 additions & 40 deletions pkgs/development/compilers/openjdk/bootstrap.nix

This file was deleted.

13 changes: 4 additions & 9 deletions pkgs/development/compilers/openjdk/info.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"22": {
"version": "22.0.2-ga",
"repo": "jdk22u",
"hash": "sha256-Zo1LOumkt9zTaPqbDcRL8lVJMqVle0QqzThtIz0JRNo="
},
"21": {
"version": "21.0.3-ga",
"repo": "jdk21u",
"hash": "sha256-zRN16lrc5gtDlTVIQJRRx103w/VbRkatCLeEc9AXWPE="
"23": {
"version": "23-ga",
"repo": "jdk23u",
"hash": "sha256-lcLnWAiskWindOqWmOWiIHiYKXGSJZK4d20k19QZfrE="
}
}
31 changes: 0 additions & 31 deletions pkgs/development/compilers/openjdk/make-bootstrap.nix

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, fetchFromGitHub
, fetchpatch2
, writeText
, openjdk21_headless
, openjdk23_headless
, gradle
, pkg-config
, perl
Expand All @@ -25,29 +25,29 @@

let
pname = "openjfx-modular-sdk";
major = "22";
update = ".0.2";
major = "23";
update = "";
build = "-ga";
repover = "${major}${update}${build}";
jdk = openjdk21_headless;
jdk = openjdk23_headless;

in stdenv.mkDerivation {
inherit pname;
version = "${major}${update}${build}";

src = fetchFromGitHub {
owner = "openjdk";
repo = "jfx22u";
repo = "jfx23u";
rev = repover;
hash = "sha256-7Q9nZ2p3KfQPt1A2ULwk64OU/5/ghEkcsf9ECD6Ln2g=";
hash = "sha256-a/ev91Rq7D3z9O56ZZQCgvvbfj5GBt5Lonow2NH3s/E=";
};

patches = [
# 8338701: Provide media support for libavcodec version 61
# <https://github.com/openjdk/jfx/pull/1552>
# <https://github.com/openjdk/jfx23u/pull/18>
(fetchpatch2 {
url = "https://github.com/openjdk/jfx/commit/6115b396bacf62f39dcaa93c7c0adcd60b428b8c.patch?full_index=1";
hash = "sha256-6EES4qsumFgXePZSDEetJC1Li65zquz3UjwRbq/6YJM=";
url = "https://github.com/openjdk/jfx23u/commit/aba60fda1c82f00e8e685107592305c403a31287.patch?full_index=1";
hash = "sha256-+aRhTwi4VQthAq1SH1jxPl0mTosNMKoTY52jm+jiKso=";
})
];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/temurin-bin/generate-sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import requests
import sys

feature_versions = (8, 11, 17, 21, 22)
feature_versions = (8, 11, 17, 21, 23)
oses = ("mac", "linux", "alpine-linux")
types = ("jre", "jdk")
impls = ("hotspot",)
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/temurin-bin/jdk-darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ in
jdk-21 = common { sourcePerArch = sources.jdk.openjdk21; };
jre-21 = common { sourcePerArch = sources.jre.openjdk21; };

jdk-22 = common { sourcePerArch = sources.jdk.openjdk22; };
jre-22 = common { sourcePerArch = sources.jre.openjdk22; };
jdk-23 = common { sourcePerArch = sources.jdk.openjdk23; };
jre-23 = common { sourcePerArch = sources.jre.openjdk23; };
}
4 changes: 2 additions & 2 deletions pkgs/development/compilers/temurin-bin/jdk-linux.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ in
jdk-21 = common { sourcePerArch = sources.jdk.openjdk21; };
jre-21 = common { sourcePerArch = sources.jre.openjdk21; };

jdk-22 = common { sourcePerArch = sources.jdk.openjdk22; };
jre-22 = common { sourcePerArch = sources.jre.openjdk22; };
jdk-23 = common { sourcePerArch = sources.jdk.openjdk23; };
jre-23 = common { sourcePerArch = sources.jre.openjdk23; };
}
Loading
Loading