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

Bazel creates non-compliant classpath jar #10620

Closed
rivashin opened this issue Jan 20, 2020 · 6 comments
Closed

Bazel creates non-compliant classpath jar #10620

rivashin opened this issue Jan 20, 2020 · 6 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug

Comments

@rivashin
Copy link

Paths in the Class-Path attribute of MANIFEST.MF should be URL-encoded.
Currently, bazel only encodes spaces:

if (x == L' ') {

It should encode all other characters too, e.g. % - which is a valid character for a filename - should be replaced with %25. If path is not encoded correctly then Java will not find the jar and will silently ignore it, resulting in a puzzling NoClassDefFoundError.

Coursier generates paths with % when username/password or port is specified as part of maven repository URL: cache/v1/https/username%40server.com%3a8080/foo.jar. As a result, any java project built with bazel & jvm_rules_external will experience this issue when the classpath gets long enough.

See this small example reproducing the issue.

@jin jin added team-Rules-Java Issues for Java rules untriaged labels Jan 23, 2020
@laszlocsomor laszlocsomor added area-Windows Windows-specific issues and feature requests and removed team-Rules-Java Issues for Java rules labels Jan 23, 2020
@laszlocsomor
Copy link
Contributor

/cc @meteorcloudy

@meteorcloudy meteorcloudy self-assigned this Jan 23, 2020
@meteorcloudy
Copy link
Member

Thanks for reporting this, I will look into this

@meteorcloudy meteorcloudy added P2 We'll consider working on this in future. (Assignee optional) type: bug and removed untriaged labels Jan 23, 2020
@rivashin
Copy link
Author

Any progress on this?
And why is it tagged with windows-team? This affects all platforms.

@meteorcloudy
Copy link
Member

@rivashin Sorry, I currently don't have any bandwidth to look into this. But I wound very much like to review the change if you can contribute to a fix!

@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
@philwo
Copy link
Member

philwo commented Nov 26, 2020

@mai93 maybe you want to look into this. :)

@Bencodes
Copy link
Contributor

Bencodes commented Feb 3, 2021

I just put up a PR that updates the other Java launcher path #12946

bazel-io pushed a commit that referenced this issue Feb 5, 2021
…n in java_stub_template

This PR fixes the url-encoding in `java_stub_template` to convert different special characters to their 2-digit hexadecimal representation.

Fixes: #10620

Closes #12969.

PiperOrigin-RevId: 355838382
Bencodes pushed a commit to Bencodes/bazel that referenced this issue Mar 23, 2021
…n in java_stub_template

This PR fixes the url-encoding in `java_stub_template` to convert different special characters to their 2-digit hexadecimal representation.

Fixes: bazelbuild#10620

Closes bazelbuild#12969.

PiperOrigin-RevId: 355838382
Bencodes pushed a commit to lyft/bazel that referenced this issue Apr 20, 2021
…n in java_stub_template

This PR fixes the url-encoding in `java_stub_template` to convert different special characters to their 2-digit hexadecimal representation.

Fixes: bazelbuild#10620

Closes bazelbuild#12969.

PiperOrigin-RevId: 355838382
Bencodes pushed a commit to lyft/bazel that referenced this issue May 6, 2021
…n in java_stub_template

This PR fixes the url-encoding in `java_stub_template` to convert different special characters to their 2-digit hexadecimal representation.

Fixes: bazelbuild#10620

Closes bazelbuild#12969.

PiperOrigin-RevId: 355838382
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Projects
None yet
7 participants