-
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
8311575: Fix invalid format parameters #14783
Conversation
👋 Welcome back djelinski! A progress list of the required criteria for merging this PR into |
@djelinski 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
|
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 - thanks for fixing. One suggested further fix.
@@ -3948,7 +3948,7 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) { | |||
const NMT_TrackingLevel lvl = NMTUtil::parse_tracking_level(NativeMemoryTracking); | |||
if (lvl == NMT_unknown) { | |||
jio_fprintf(defaultStream::error_stream(), | |||
"Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", nullptr); | |||
"Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]"); |
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 it also needs a trailing \n
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.
Good point. I triggered this error and it didn't look pretty:
> java.exe -XX:NativeMemoryTracking=blah
Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I noticed a few other spots in this file where trailing \n
is missing. I'll fix them here as well.
@djelinski 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 9 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ 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.
A couple pre-existing indentation nits, but otherwise looks good.
@@ -2855,7 +2855,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m | |||
if (jvmciFlag != nullptr && jvmciFlag->is_unlocked()) { | |||
if (!JVMCIGlobals::enable_jvmci_product_mode(origin, use_graal_jit)) { | |||
jio_fprintf(defaultStream::error_stream(), | |||
"Unable to enable JVMCI in product mode"); |
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.
[pre-existing] Unusual indentation.
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.
This kind of indentation is pretty common in this file. I'd rather not touch it here.
@@ -2838,7 +2838,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m | |||
if (jvmci_compiler != nullptr) { | |||
if (strncmp(jvmci_compiler, "graal", strlen("graal")) != 0) { | |||
jio_fprintf(defaultStream::error_stream(), | |||
"Value of jvmci.Compiler incompatible with +UseGraalJIT: %s", jvmci_compiler); |
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.
[pre-existing] Unusual indentation.
@@ -3948,7 +3948,7 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) { | |||
const NMT_TrackingLevel lvl = NMTUtil::parse_tracking_level(NativeMemoryTracking); | |||
if (lvl == NMT_unknown) { | |||
jio_fprintf(defaultStream::error_stream(), | |||
"Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", nullptr); |
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.
This would have been caught already if JDK-8198918 had been fixed.
@@ -222,7 +222,7 @@ static bool is_directory_secure(const char* path) { | |||
else { | |||
// unexpected error, declare the path insecure | |||
if (PrintMiscellaneous && Verbose) { | |||
warning("could not get attributes for file %s: ", |
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.
Too bad ATTRIBUTE_PRINTF is empty for Windows. Visual Studio doesn't seem to be an equivalent to
gcc's __attribute__((format(printf(...)))
.
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.
The best I could find in Visual Studio was _Printf_format_string_
It needs to be specified next to the parameter, and it's only checked when compiling with -analyze
, so not really useful for us at this moment.
Thanks for the reviews! /integrate |
Going to push as commit 34004e1.
Your commit was automatically rebased without conflicts. |
@djelinski Pushed as commit 34004e1. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review this change that fixes a few issues with printf-like function parameters.
No new tests. I'll run tier1 & tier2 before integrating, just to make sure.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14783/head:pull/14783
$ git checkout pull/14783
Update a local copy of the PR:
$ git checkout pull/14783
$ git pull https://git.openjdk.org/jdk.git pull/14783/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 14783
View PR using the GUI difftool:
$ git pr show -t 14783
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14783.diff
Webrev
Link to Webrev Comment