From a4f6c4dcf2d6e4f087eefde3ac46e5aa96a4dc6e Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Wed, 6 Nov 2024 18:21:46 +0100 Subject: [PATCH] Ultimate: fix search for available java The previous search failed to use the java version on the PATH, as glob.glob("java") always returned the empty list. The new version coincides more closely with the implementation in the Ultimate.py wrapper script, and thus should ensure that the same java version is used from the tool info module and by Ultimate itself. Also not explicitly that the two implementations should match. --- benchexec/tools/ultimate.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/benchexec/tools/ultimate.py b/benchexec/tools/ultimate.py index 219a735d9..8cad56f69 100644 --- a/benchexec/tools/ultimate.py +++ b/benchexec/tools/ultimate.py @@ -467,6 +467,8 @@ def get_value_from_output(self, output, identifier): return None def get_java_installations(self): + # The code in this method is (and should remain) consistent with the method `get_java` in + # . candidates = [ "java", "/usr/bin/java", @@ -475,11 +477,16 @@ def get_java_installations(self): "/usr/lib/jvm/java-*-openjdk-amd64/bin/java", ] - candidates = [c for entry in candidates for c in glob.glob(entry)] + candidates_extended = [] + for c in candidates: + if "*" in c: + candidates_extended += glob.glob(c) + else: + candidates_extended += [c] pattern = r'"(\d+\.\d+).*"' rtr = {} - for c in candidates: + for c in candidates_extended: candidate = shutil.which(c) if not candidate: continue