-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8301065: Handle control characters in java_lang_String::print #12190
Conversation
👋 Welcome back kevinw! A progress list of the required criteria for merging this PR into |
@kevinjwalls 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
|
@kevinjwalls This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
(I will get back to this...) |
@kevinjwalls This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@kevinjwalls 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 37 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. ➡️ To integrate this PR with the above commit message to the |
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.
Escaping the control characters this way seems quite reasonable to me. I assume we never intentionally include them, but if tracking down a bug we might be printing a corrupt string and so this aids in showing the actual character content. Arguably in such a situation all non-printable characters should be escaped, so there could be a second RFE to handle that generalization.
Thanks.
We actually have some intentional use of non printable characters. For example, for string concatenation like this:
We'll pass a parameter to the
|
That doesn't seem a valid thing to do as string literals could contain any character, including \u0001. ?? |
String literals that contain special characters are passed as separate bootstrap arguments, and are marked by \u0002 in the first bootstrap argument to |
Thanks Ioi and David for looking over this. The additional StringConcatFactory mention is also educational! |
/integrate |
Going to push as commit 41d6be4.
Your commit was automatically rebased without conflicts. |
@kevinjwalls Pushed as commit 41d6be4. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Change to avoid printing raw control characters in java_lang_String::print.
Usually called in debug printing and error reporting. One usage from debug logging for modules.
Format as \x followed by two hex digits, e.g. \x0A
Small change, in a routine with few callers. Could make two calls to value->byte_at(), which I left in as it reads more clearly, and this is not called at time critical situations.
The error reporting and debug.cpp usages I can test manually, with some trial and error, trying to catch the register info containing relevant info. This same String printing routine is used for showing register contents or stack slot mappings, and for a String, or a class containing a String.
Before the change: (newlines and null embedded in String)
With the change:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/12190/head:pull/12190
$ git checkout pull/12190
Update a local copy of the PR:
$ git checkout pull/12190
$ git pull https://git.openjdk.org/jdk.git pull/12190/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12190
View PR using the GUI difftool:
$ git pr show -t 12190
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12190.diff
Webrev
Link to Webrev Comment