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

Error in java_home fails to print the error message #14631

Closed
pnicolas-vmware opened this issue Jan 24, 2022 · 0 comments
Closed

Error in java_home fails to print the error message #14631

pnicolas-vmware opened this issue Jan 24, 2022 · 0 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules type: bug

Comments

@pnicolas-vmware
Copy link

Description of the problem / feature request:

If the jdk specified by java_home is not present, the error message itself fails with

ERROR: An error occurred during the fetch of repository 'toolchain_oracle_jdk8_lin64':
   Traceback (most recent call last):
        File "[...]/external/bazel_tools/tools/jdk/local_java_repository.bzl", line 28, column 32, in _local_java_repository_impl
                "does not exist." % (java_home, str(java_home_path)))
Error: not all arguments converted during string formatting

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

specify a non-existent jdk, run the build

What operating system are you running Bazel on?

Linux

What's the output of bazel info release?

release 4.1.0-vmware

Any other information, logs, or outputs that you want to share?

Patch to fix the issue

diff --git a/tools/jdk/local_java_repository.bzl b/tools/jdk/local_java_repository.bzl
index 4c0a433f8f..68402a7cce 100644
--- a/tools/jdk/local_java_repository.bzl
+++ b/tools/jdk/local_java_repository.bzl
@@ -123,8 +123,8 @@ def _local_java_repository_impl(repository_ctx):
     java_home = repository_ctx.attr.java_home
     java_home_path = repository_ctx.path(java_home)
     if not java_home_path.exists:
-        fail('The path indicated by the "java_home" attribute "%s" (absolute: "%s") ' +
-             "does not exist." % (java_home, str(java_home_path)))
+        fail(('The path indicated by the "java_home" attribute "%s" (absolute: "%s") ' +
+             "does not exist.") % (java_home, str(java_home_path)))

     repository_ctx.file(
         "WORKSPACE",
@gregestren gregestren added team-Rules-Java Issues for Java rules untriaged labels Jan 31, 2022
@comius comius added P2 We'll consider working on this in future. (Assignee optional) type: bug and removed untriaged labels Feb 2, 2022
@comius comius self-assigned this Feb 2, 2022
ckolli5 added a commit that referenced this issue Jun 30, 2022
Fixes #14631

Closes #14686.

PiperOrigin-RevId: 426080592

Co-authored-by: Ivo List <ilist@google.com>
fmeum pushed a commit to fmeum/bazel that referenced this issue Jul 2, 2022
Fixes bazelbuild#14631

Closes bazelbuild#14686.

PiperOrigin-RevId: 426080592

Co-authored-by: Ivo List <ilist@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants