-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8339460: CDS error when module is located in a directory with space in the name #20987
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
Conversation
👋 Welcome back mkartashev! A progress list of the required criteria for merging this PR into |
@mkartashev This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 265 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@calvinccheung, @iklam) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
@mkartashev The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Hi, could you point at the place where the URI is written? Do we know what code produced the URI? |
The URI is coming from the Java side. When a module is defined, its location is kept as a URI. See
Later on, the URI is converted into a path name, see
That path name, untouched, is passed to
At this point, if the original URI had any escaped characters, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this bug. I've re-assigned the bug to you. Couple of comments below.
if (str[index] == '%' | ||
&& isxdigit(str[index + 1]) | ||
&& isxdigit(str[index + 2])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to bound check the index because the uri
from ClassLoaderExt::process_module_table
could just be a directory name, e.g. dir%, without the jar file name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
str
is still zero-terminated, so if str[index] == '%'
is true, then str[index + 1]
at least exists and might be 0
. If isxdigit(str[index + 1])
is true then str[index + 2]
at least exists and might be 0
, in which case isxdigit()
is going to be false for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if isxdigit(str[index + 1])
is false, it won't proceed to check isxdigit(str[index + 2])
?
The bound check I'm thinking about is like the following:
if (index >= strlen(str) - 2) {
return str[index];
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if
isxdigit(str[index + 1])
is false, it won't proceed to checkisxdigit(str[index + 2])
? The bound check I'm thinking about is like the following:
That is exactly correct.
The bound check I'm thinking about is like the following:
if (index >= strlen(str) - 2) { return str[index]; }
This seems unnecessary as we already assume that the string is null-terminated in the caller, and, as I have demonstrated out earlier, null-terminated strings are quite safe to check character-by-character.
|
||
public class ComplexURITest { | ||
final static String listFileName = "test-classlist.txt"; | ||
final static String archiveName = "test-dynamic.jsa"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're using the same archiveName
for both static and dynamic test cases. I'd suggest declare a different archive name for the static case. E.g.
final static String staticArchiveName = "test-static.jsa";
final static String dynamicArchiveName = "test-dynamic.jsa";
Also, I think this test should be excluded from the hotspot_appcds_dynamic
test group in the open/test/hotspot/jtreg/TEST.groups
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I also added the code to safeguard against IOException
on Windows in the case of deleting the read-only archive created previously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test changes look good. I will run some testing on your patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Some small nits.
#ifdef _WINDOWS | ||
if (decoded == '/') { | ||
decoded = '\\'; | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary for this patch? If not, I think we should not include it, since it changes behavior (i.e., strcmp() on the path may start failing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary for this patch?
I suppose, not. Let me check that the test still passes on Windows, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me check that the test still passes on Windows, though.
The test does pass on Windows with all the recent changes.
|
||
#ifdef _WINDOWS | ||
if (uri[0] == '/') { | ||
// Absolute path name on Windows does not begin with a slash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use 2-space indents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly. Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran tiers 1 - 4 testing prior to this latest change and saw no new failures.
/integrate |
@mkartashev |
/sponsor |
Going to push as commit aceae76.
Your commit was automatically rebased without conflicts. |
@calvinccheung @mkartashev Pushed as commit aceae76. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The crux of the problem is that path names in CDS are saved as URIs and subsequently "converted" back to path names simply by stripping off the prefix without appropriate conversion of the rest of the name. This commit adds such a conversion.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20987/head:pull/20987
$ git checkout pull/20987
Update a local copy of the PR:
$ git checkout pull/20987
$ git pull https://git.openjdk.org/jdk.git pull/20987/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20987
View PR using the GUI difftool:
$ git pr show -t 20987
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20987.diff
Webrev
Link to Webrev Comment