-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8344275: tools/jpackage/windows/Win8301247Test.java fails on localized Windows platform #22142
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 kurashige23! A progress list of the required criteria for merging this PR into |
|
@kurashige23 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 29 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 (@alexeysemenyukoracle, @sashamatveev) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
@kurashige23 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
|
| } | ||
|
|
||
| String[] headers = Stream.of(output.getFirst().split("\\s+", 2)).map( | ||
| String[] headers = Stream.of(output.get(1).split("\\s+", 2)).map( |
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.
Why look up the headers in the second line of the output?
Oh, this is because the first line of the output is "Active code page: 65001" coming from chcp 65001.
I'd run suppress the output of "chcp" command: chcp 65001 >nul 2>&1. This will make its usage transparent for the clients of the "Executor" class.
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'd run suppress the output of "chcp" command: chcp 65001 >nul 2>&1. This will make its usage transparent for the clients of the "Executor" class.
That's true. I added > nul2 > & 1 to suppress output of "chcp" command.
| return this; | ||
| } | ||
|
|
||
| public Executor setWinEnableUTF8(boolean value) { |
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 function aims to make a to-be-executed command produce output in English. To achieve this goal implementation will call chcp 65001. The implementation may change, but the name of the function should remain the same. That said I suggest giving it a name that reflects its purpose and not the implementation. Something like: setWinRunWithEnglishOutput()
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 implementation may change, but the name of the function should remain the same.
That certainly makes sense. I changed setWinEnableUTF8 to setWinRunWithEnglishOutput as you suggested.
| // run chcp to change the code page to UTF-8 on Windows | ||
| command.add("cmd.exe"); | ||
| command.add("/c"); | ||
| command.add("chcp 65001 && " + printCommandLine(executablePath().toString(), args)); |
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.
printCommandLine() function does a lousy job of escaping whitespaces in arguments. Its output is for logging purposes only.
I experimented with the use of "chcp" in the "Executor" class and figured that it is not necessary to put the entire command line in a single argument. Please take a look at 7975a8e. It suppresses the output of "chcp" command, so client code may remain unchanged. Need to add the missing setWinEnableUTF8() and good to go.
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.
Sorry for the incorrect use of printCommandLine().
As I checked, I could certainly execute "chcp" without putting the entire command line in a single argument. I fixed referring to 7975a8e. Thanks.
|
I'm not sure "65001" is the right choice if the request is to get the output in English. Would "437" or "850" be more appropriate arguments for the "chcp" command? |
…23/jdk into fix_Win8301247Test_bug
|
|
| var cmdline = Stream.of(prefixCommandLineArgs(), List.of(exec), args).flatMap( | ||
| List::stream).toList(); | ||
|
|
||
| return String.format(format, printCommandLine(cmdline), cmdline.size() + 1); |
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.
cmdline.size() + 1 seems to be wrong. It should be cmdline.size().
+ 1 was needed previously when was applied to the args.size() that didn't count the executable. Sorry, I oversaw this thing in my 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.
Thanks, I understood why + 1 is not needed. I removed + 1.
|
|
||
| private List<String> prefixCommandLineArgs() { | ||
| if (winEnglishOutput) { | ||
| return List.of("cmd.exe", "/c", "chcp", "437", ">nul", "2>&1", "&&"); |
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 assume chcp 437 works as expected. The summary still references chcp 65001 command.
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.
Yes, I confirmed that it works as expected.
The summary still references chcp 65001 command.
Thanks, I fixed summary.
After receiving your comment, I ran the chcp command on Windows Server 2019 (English locale) and the active code page was 437. |
|
After making these fixes, I ran tools/jpackage tests importing |
|
Thank you for working on this patch! |
|
@kurashige23 this pull request can not be integrated into git checkout fix_Win8301247Test_bug
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
|
@kurashige23 Changes in this repository do not require maintainer approval. |
|
Sorry, I fixed conflict. Please review again. |
sashamatveev
left a comment
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.
|
Thank you for your review. /integrate |
|
@kurashige23 |
|
@alexeysemenyukoracle could you please sponsor this? |
|
/sponsor |
|
Going to push as commit 48e3b65.
Your commit was automatically rebased without conflicts. |
|
@alexeysemenyukoracle @kurashige23 Pushed as commit 48e3b65. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
To resolve tools/jpackage/windows/Win8301247Test.java failure, I made "wmic" executed with "chcp 437". This ensures that the English message "No Instance(s) Available." is output on localized windows platforms.
I have referred to the following for how to use chcp:
・chcp | Microsoft Learn at https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/chcp
・Code Page Identifiers - Win32 apps | Microsoft Learn at https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
After fix, I ran tools/jpackage tests importing jdk.jpackage.test.Executor or jdk.jpackage.test.WindowsHelper.killAppLauncherProcess on Windows Server 2019 (Japanese and English locales). I confirmed that they pass.
Thanks
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22142/head:pull/22142$ git checkout pull/22142Update a local copy of the PR:
$ git checkout pull/22142$ git pull https://git.openjdk.org/jdk.git pull/22142/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22142View PR using the GUI difftool:
$ git pr show -t 22142Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22142.diff
Using Webrev
Link to Webrev Comment