8000 #1239 Fix Agent properties passing at Windows filesystem directory with diacritics characters by bedla · Pull Request #1737 · jacoco/jacoco · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

#1239 Fix Agent properties passing at Windows filesystem directory with diacritics characters #1737

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bedla
Copy link
@bedla bedla commented Oct 5, 2024

Hi,
for issue #1239 I have created this pull request.
When parameters are encoded (here I have chosen url-encoding) I am able to use Jacoco with diacritics in path.
What do you think?
Thx
Ivos

related-to: #1735

@bedla
Copy link
Author
bedla commented Oct 5, 2024

It is failing with JDK5, I assume that there has to be JDK 5 used, right?

@bedla bedla force-pushed the 1239-fix-windows-filepath-encoding branch from 4e54115 to 6053093 Compare October 5, 2024 15:39
@marchof
Copy link
Member
marchof commented Oct 5, 2024

@bedla Thanks for this contribution! Yes, JaCoCo minimum runtime requirement is Java 5.

For me it looks like breaking change. I don't think we can afford to change the JaCoCo agent API in an incompatible way.

@bedla
Copy link
Author
bedla commented Oct 6, 2024

I see.
What about adding new parameters for files (mind destfileEnc parameter) to make it look like this, and in case that they do not match use encoded ones?

-javaagent:C:\\Users\\bedla.czech\\IdeaProjects\\jacoco\\jacoco-maven-plugin.test\\target\\local-repo\\org\\jacoco\\org.jacoco.agent\\0.8.13-SNAPSHOT\\org.jacoco.agent-0.8.13-SNAPSHOT-runtime.jar=destfile=C%3A%5CUsers%5Cbedla.czech%5CIdeaProjects%5Cjacoco%5Cjacoco-maven-plugin.test%5Ctarget%5Cit%5Cit-dump%5Ctarget%5Cjacoco.exec,output=tcpserver
vs
-javaagent:C:\\Users\\bedla.czech\\IdeaProjects\\jacoco\\jacoco-maven-plugin.test\\target\\local-repo\\org\\jacoco\\org.jacoco.agent\\0.8.13-SNAPSHOT\\org.jacoco.agent-0.8.13-SNAPSHOT-runtime.jar=destfile=C:\Users\bedla.czech\IdeaProjects\jacoco\jacoco-maven-plugin.test\target\it\it-dump\target\jacoco.exec,destfileEnc=C%3A%5CUsers%5Cbedla.czech%5CIdeaProjects%5Cjacoco%5Cjacoco-maven-plugin.test%5Ctarget%5Cit%5Cit-dump%5Ctarget%5Cjacoco.exec,output=tcpserver

I mean, without having that bug fixed in the JDK, Jacoco (and other Agents) is not usable on Windows with diacritics in filepaths (eg. in corporate laptops where you do not have power to change some parent directories :( ).

@marchof
Copy link
Member
marchof commented Oct 7, 2024

@bedla I'm a bit reluctant to add extra code for this situation, for the following reasons:

  • JaCoCo is widely used and we only got two reports over all the years
  • I've never seen an organization that uses written user names as Windows profile names (especially with non-ASCII characters in the profile name)

I would rather prefer to:

  • find a way to set environment variables/system properties in a way that the current JVM behaves correctly
  • fix the root cause upstream in the JDK

@bedla
Copy link
Author
bedla commented Oct 7, 2024

I understand and agree in general.
BUT

  • I saw it at almost every corporate, I worked for, to put those characters into names :( and because corporate organization you have zero power to change it (I agree that putting strange characters into directories is total non-sense, I also found in the wild that some Mac guys putting colon : into file name because they can and making git clones broken on Windows fs :D). And in my country it is very common to have diacritics in surnames.
  • I understand this as workaround until JDK fix found.
  • Find environment variable) from discussion above I thought that there is no other way except to fix it in JDK - I can give a try to it to find needle in haystack :)
  • Could you share link to JDK reported issue? I want to follow and see progress.

@marchof
Copy link
Member
marchof commented Oct 7, 2024

@bedla

Maybe you misunderstood me: Of course the organizations put your real name into the directory entry, but the Windows profile id typically is a handle like u123456. This is also done as names can change over time.

@bedla
Copy link
Author
bedla commented Oct 7, 2024

I am talking about directory name like c:\Users\IvoŠmíd\ I currently have. At least operations are able not to put spaces into directory names :) - like c:\Users\Ivo Šmíd\ what I saw in the past.

@marchof
Copy link
Member
marchof commented Oct 7, 2024

Exactly. In this case "IvoŠmíd" is the profile name. Which is a interesting choice to actually use names for this in an organization. I would guess JaCoCo is their least problem...

@bedla
Copy link
Author
bedla commented Oct 7, 2024

I was digging little bit today in JDK and did not find any option that might help to fix it. I also found related issue in JDK issue tracker and linked them into original Github issue here.

It looks like that until fixed in JDK the only solution is to not to have path specified with UTF-8 characters. :( This should be mentioned in documentation, if not already there.

I am also thinking if having this behavior change behind some flag (eg encodeOptions=true) might be good enough for you. Only informed user will set it with all consequences. What do you think?

6022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0