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

SharedHttpCacheStorage is not stripping * characters from URIs, even though this character is illegal on Windows #2589

Closed
gab1one opened this issue Jun 26, 2023 · 0 comments · Fixed by #2590

Comments

@gab1one
Copy link
Contributor

gab1one commented Jun 26, 2023

Hi Tycho maintainers,
I discovered a bug in the handling of characters that are valid parts of URIs but not legal file names under Windows. Building with an update site that contains a * character in the path, causes the whole build to fail.

This is caused by the URI cleanup in SharedHttpCacheStorage not stripping * characters from URIs:

String cleanPath = uri.normalize().toASCIIString().replace(':', '/').replace('?', '/').replace('&', '/')
.replaceAll("/+", "/");
, then it tries to create a file with the * character in its path, resulting in a RuntimeException:

Failed to load p2 repository with ID '<ID>` from location <REPOURL_WITH_ASTERISK>: Unable to read repository at <REPOURL_WITH_ASTERISK>. Cannot create directory

Taking a look at the legal special characters in URIs: - . _ ~ : / ? # [ ] @ ! $ & ' ( ) * + , ; = and the characters that are not allowed in Windows file names: : " / \ | ? * < >, we can see that the * character is the only one character remaining in the intersection of both sets ( / ? * :) that is not yet covered by this method.

See this PR for the fix: #2590

@gab1one gab1one changed the title SharedHttpCacheStorage is not stripping * characters from URIs, even though SharedHttpCacheStorage is not stripping * characters from URIs, even though this character is illegal on Windows Jun 26, 2023
gab1one added a commit to gab1one/tycho that referenced this issue Jun 26, 2023
This character is illegal in Windows file paths.
@laeubi laeubi linked a pull request Jun 26, 2023 that will close this issue
laeubi pushed a commit that referenced this issue Jun 27, 2023
This character is illegal in Windows file paths.
github-actions bot pushed a commit that referenced this issue Jun 27, 2023
This character is illegal in Windows file paths.

(cherry picked from commit dbb779b)
laeubi pushed a commit that referenced this issue Jun 27, 2023
This character is illegal in Windows file paths.

(cherry picked from commit dbb779b)
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 a pull request may close this issue.

1 participant