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

8311575: Fix invalid format parameters #14783

Closed
wants to merge 2 commits into from

Conversation

djelinski
Copy link
Member

@djelinski djelinski commented Jul 6, 2023

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

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8311575: Fix invalid format parameters (Enhancement - P4)

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 6, 2023

👋 Welcome back djelinski! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jul 6, 2023

@djelinski The following label will be automatically applied to this pull request:

  • hotspot

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.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Jul 6, 2023
@djelinski djelinski changed the title Fix invalid format arguments 8311575 Jul 6, 2023
@openjdk openjdk bot changed the title 8311575 8311575: Fix invalid format parameters Jul 6, 2023
@djelinski djelinski marked this pull request as ready for review July 6, 2023 12:03
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 6, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 6, 2023

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a 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]");
Copy link
Member

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

Copy link
Member Author

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.

@openjdk
Copy link

openjdk bot commented Jul 7, 2023

@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:

8311575: Fix invalid format parameters

Reviewed-by: dholmes, kbarrett, mli

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 master branch:

  • 25cbe85: 8310550: Adjust references to rt.jar
  • 848abd2: 8311511: Improve description of NativeLibrary JFR event
  • 6485b7d: 6875229: Wrong placement of icons in JTabbedPane in Nimbus
  • 27de536: 8311581: Remove obsolete code and comments in TestLVT.java
  • e848d94: 8310923: Refactor Currency tests to use JUnit
  • 0c86c31: 8302351: "assert(!JavaThread::current()->is_interp_only_mode() || !nm->method()->is_continuation_enter_intrinsic() || ContinuationEntry::is_interpreted_call(return_pc)) failed: interp_only_mode but not in enterSpecial interpreted entry" in fixup_callers_callsite
  • ec7da91: 8240567: MethodTooLargeException thrown while creating a jlink image
  • 97e99f0: 8311087: PhiNode::wait_for_region_igvn should break early
  • 7173c30: 8307766: Linux: Provide the option to override the timer slack

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 7, 2023
Copy link

@kimbarrett kimbarrett left a 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");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pre-existing] Unusual indentation.

Copy link
Member Author

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);

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);

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: ",

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(...))).

Copy link
Member Author

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.

@djelinski
Copy link
Member Author

Thanks for the reviews!

/integrate

@openjdk
Copy link

openjdk bot commented Jul 7, 2023

Going to push as commit 34004e1.
Since your change was applied there have been 12 commits pushed to the master branch:

  • 9084b6c: 8311514: Incorrect regex in TestMetaSpaceLog.java
  • 0ef03f1: 8311285: report some fontconfig related environment variables in hs_err file
  • 92ca670: 8310170: Use sp's argument to improve performance of outputStream::indent and remove SP_USE_TABS
  • 25cbe85: 8310550: Adjust references to rt.jar
  • 848abd2: 8311511: Improve description of NativeLibrary JFR event
  • 6485b7d: 6875229: Wrong placement of icons in JTabbedPane in Nimbus
  • 27de536: 8311581: Remove obsolete code and comments in TestLVT.java
  • e848d94: 8310923: Refactor Currency tests to use JUnit
  • 0c86c31: 8302351: "assert(!JavaThread::current()->is_interp_only_mode() || !nm->method()->is_continuation_enter_intrinsic() || ContinuationEntry::is_interpreted_call(return_pc)) failed: interp_only_mode but not in enterSpecial interpreted entry" in fixup_callers_callsite
  • ec7da91: 8240567: MethodTooLargeException thrown while creating a jlink image
  • ... and 2 more: https://git.openjdk.org/jdk/compare/356067d03f964fd0f24a055cfd772e27c8939812...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 7, 2023
@openjdk openjdk bot closed this Jul 7, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 7, 2023
@openjdk
Copy link

openjdk bot commented Jul 7, 2023

@djelinski Pushed as commit 34004e1.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@djelinski djelinski deleted the invalid-format branch September 27, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants