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

8293595: tstrings::any() is missing an overload #10231

Closed
wants to merge 2 commits into from

Conversation

TheShermanTanker
Copy link
Contributor

@TheShermanTanker TheShermanTanker commented Sep 9, 2022

tstrings::any() has an overload for std::wstring (if required) but is missing the corresponding operator overload for std::string, leaving only the templated one as a fallback, which will expand into a std::wostringstream << std::string operation. This isn't particularly safe on Windows, considering that JDK-8292008 and JDK-8247283 have been recently merged, and can sporadically cause build failures. This change simply adds the missing overload with the appropriate format handling that jpackage expects from std::string. Also contains minor name changes to fit the rest of the parameter names in the other overloads.


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

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10231/head:pull/10231
$ git checkout pull/10231

Update a local copy of the PR:
$ git checkout pull/10231
$ git pull https://git.openjdk.org/jdk pull/10231/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10231

View PR using the GUI difftool:
$ git pr show -t 10231

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10231.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 9, 2022

👋 Welcome back jwaters! 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 Sep 9, 2022

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

  • core-libs

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 core-libs core-libs-dev@openjdk.org label Sep 9, 2022
@TheShermanTanker TheShermanTanker changed the title tstrings::any() is missing an overload 8293595 Sep 9, 2022
@openjdk openjdk bot changed the title 8293595 8293595: tstrings::any() is missing an overload Sep 9, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 9, 2022
@TheShermanTanker
Copy link
Contributor Author

/label

@openjdk
Copy link

openjdk bot commented Sep 9, 2022

@TheShermanTanker Usage: /label <add|remove> [label[, label, ...]] or /label [<+|->label[, <+|->label, ...]] where label is an additional classification that should be applied to this PR. These labels are valid:

  • serviceability
  • hotspot
  • hotspot-compiler
  • ide-support
  • kulla
  • i18n
  • shenandoah
  • jdk
  • javadoc
  • security
  • hotspot-runtime
  • jmx
  • build
  • nio
  • client
  • core-libs
  • compiler
  • net
  • hotspot-gc
  • hotspot-jfr

@mlbridge
Copy link

mlbridge bot commented Sep 9, 2022

Webrevs

@TheShermanTanker
Copy link
Contributor Author

/label hotspot

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Sep 17, 2022
@openjdk
Copy link

openjdk bot commented Sep 17, 2022

@TheShermanTanker
The hotspot label was successfully added.

@TheShermanTanker
Copy link
Contributor Author

Adding generic hotspot label since I don't know where this falls under, but it's likely not core-libs

data << fromUtf8(msg);
return *this;
}

Choose a reason for hiding this comment

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

I guess you also need

    any& operator << (LPSTR v) {
        data << (v ? fromUtf8(v) : "NULL");
        return *this;
    }

    any& operator << (LPCSTR v) {
        data << (v ? fromUtf8(v) : "NULL");
        return *this;
    }

to make a complete set of overloads

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I deliberately left those 2 out since the comments accompanying them seem to suggest that they're Windows specific overloads that are there for different reasons (As opposed to the one this PR is aimed at, which takes in a regular std::wstring), moreover not providing overloads for them don't seem to be causing issues either. I'm unsure if adding them too would be correct, I'll wait for more reviews before doing so

Choose a reason for hiding this comment

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

I'm the author of these comments and basically the entire source file.

You are right, it will work without the additional overloads. However the null pointers will be ignored (tested with G++ 7.4.0), but this is minor, probably implementation-specific and can be ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Strange, on my end gcc doesn't mind NULL being passed (though this may be due to a different gcc version being used), guess it's probably implementation specific like you mentioned

Choose a reason for hiding this comment

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

Correct, it allows NULL to be passed. G++ 7.4.0 ignores it and doesn't append anything to the buffer, while msvc back when this code was created appended a "null" string to the buffer.

data << fromUtf8(msg);
return *this;
}

Choose a reason for hiding this comment

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

I'm the author of these comments and basically the entire source file.

You are right, it will work without the additional overloads. However the null pointers will be ignored (tested with G++ 7.4.0), but this is minor, probably implementation-specific and can be ignored.

@openjdk
Copy link

openjdk bot commented Sep 19, 2022

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

8293595: tstrings::any() is missing an overload

Reviewed-by: asemenyuk, almatvee

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 100 new commits pushed to the master branch:

  • 4020ed5: 8293210: G1: Remove redundant check in G1FreeHumongousRegionClosure
  • 8ff2c26: 8293942: [JVMCI] data section entries must be 4-byte aligned on AArch64
  • 6e23b43: 8293502: (fc) FileChannel::transfer methods fail to copy /proc files on Linux
  • 1f9ff41: 8292297: Fix up loading of override java.security properties file
  • 64b96e5: 8293811: Provide a reason for PassFailJFrame.forceFail
  • f91762f: 8293965: Code signing warnings after JDK-8293550
  • 8082c24: 8054572: [macosx] JComboBox paints the border incorrectly
  • b920d29: 8271328: User is able to choose the color after disabling the color chooser.
  • 5725a93: 8293879: Remove unnecessary castings in jdk.hotspot.agent
  • ab7f58a: 6286501: JTabbedPane throws NPE from its stateChanged listener in particular case
  • ... and 90 more: https://git.openjdk.org/jdk/compare/7169ee5c73c130aacce73cbd3f88377ec07c8311...master

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 (@alexeysemenyukoracle, @sashamatveev) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 19, 2022
@TheShermanTanker
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 19, 2022
@openjdk
Copy link

openjdk bot commented Sep 19, 2022

@TheShermanTanker
Your change (at version 83fd3c8) is now ready to be sponsored by a Committer.

@alexeysemenyukoracle
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 20, 2022

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 20, 2022
@openjdk openjdk bot closed this Sep 20, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Sep 20, 2022
@openjdk
Copy link

openjdk bot commented Sep 20, 2022

@alexeysemenyukoracle @TheShermanTanker Pushed as commit bb422f5.

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

@TheShermanTanker TheShermanTanker deleted the patch-1 branch September 20, 2022 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
3 participants