-
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
8282042: [testbug] FileEncodingTest.java depends on default encoding #7525
Conversation
👋 Welcome back backwaterred! A progress list of the required criteria for merging this PR into |
@backwaterred 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
|
The purpose of this test is to check the default encoding for the environments known to be correct. Thus those test values are hardcoded. Replacing it with |
Thanks for your feedback Naoto. I agree it's a little odd to test the way I proposed above, as it introduces uncertainty as you mentioned, as well as other issues like both native.encoding and Charsets.defaultCharset() being wrong, but being wrong in the same way. The main part of testing this way was the quoted line from JEP-400 (of which I recognize you are an author). Maybe I'm being too literal; in my testing the encodings match, even if the names are aliases of the ones I expect. In addition, you have a good point about the purpose of the COMPAT flag being compatibility. I agree that it's not really appropriate to change the values of native.encoding to the canonical ones. I was feeling torn between the proposed option and alternative, and your feedback definitely sways me towards the alternative. I'll change this PR to simply add an exception to the test for AIX. |
fd06a60
to
83b6e4b
Compare
9341ecb
to
56f0145
Compare
The test now passes on AIX, and Linux/Z. So I believe this change can be merged once reviewed. |
/integrate auto |
@backwaterred This pull request will be automatically integrated when it is ready |
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.
Changes look good.
Nit: Please add the issue # to the @bug
tag, and modify the copyright year to 2021, 2022
.
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.
@backwaterred 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 107 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 (@naotoj) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
/label remove auto Automatic integration is not appropriate and should not be used except in time sensitive cases. |
@RogerRiggs
|
Ok. I will avoid using it in the future. I don't have commiter rights, so I was just looking to signal that I am happy for this change to be integrated when it has been reviewed. It seemed to fall under the 'benign changes' category of the If there is other feedback, I am happy to incorporate it 😄 |
/summary Adds expected encoding "ISO-8859-1" for AIX in FileEncodingTest.java |
@backwaterred Setting summary to |
/sponsor |
Going to push as commit 58e1882.
Your commit was automatically rebased without conflicts. |
@naotoj @backwaterred Pushed as commit 58e1882. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The test has been fixed in OpenJDK head and for OpenJ9 jdk18 openjdk/jdk#7525 ibmruntimes/openj9-openjdk-jdk18#22 OpenJ9 jdk18 grinder https://openj9-jenkins.osuosl.org/view/Test/job/Grinder/673 Signed-off-by: Peter Shipton <[email protected]>
The test has been fixed in OpenJDK head and for OpenJ9 jdk18 openjdk/jdk#7525 ibmruntimes/openj9-openjdk-jdk18#22 OpenJ9 jdk18 grinder https://openj9-jenkins.osuosl.org/view/Test/job/Grinder/673 Signed-off-by: Peter Shipton <[email protected]>
FileEncodingTest expects all non-Windows platforms will have
Charset.defaultCharset().name()
set to US-ASCII when file.encoding is set to COMPAT. This assumption does not hold for AIX where it is ISO-8859-1.According to JEP-400, we should expect
Charset.defaultCharset().name()
to equalSystem.getProperty("native.encoding")
whenever the COMPAT flag is set. From JEP-400: "... if file.encoding is set to COMPAT on the command line, then the run-time value of file.encoding will be the same as the run-time value of native.encoding...". So one way to resolve this is to choose the value for each system from the native.encoding property.With these changes however, my test systems continue to fail.
Note that the expected value is populated from native.encoding.
This implies more work to be done. It looks to me that some modification to java_props_md.c may be needed to ensure that the System properties for native.encoding return canonical names.
A tempting alternative is to set the expected value for AIX to "ISO-8859-1" in the test explicitly, as was done for the Windows expected encoding prior to this proposed change. The main advantage to this alternative is that it is quick and easy, but the disadvantages are that it fails to test that COMPAT behaves as specified in JEP-400, and the approach does not scale well if it happens that other systems require other cases. I wonder if this is the reason non-English locals are excluded by the test.
Proceeding with this change and the work implied by the new failures it highlights goes beyond the scope of what I thought was a simple testbug. So I'm opening this up for some comments before proceeding down the rabbit hole of further changes. If there is generally positive support for this direction I'm happy to make the modifications necessary to populate native.encoding with canonical names. As I am new to OpenJDK, I am especially looking to ensure that changing the value returned by native.encoding will not have unintended consequences elsewhere in the project.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7525/head:pull/7525
$ git checkout pull/7525
Update a local copy of the PR:
$ git checkout pull/7525
$ git pull https://git.openjdk.java.net/jdk pull/7525/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7525
View PR using the GUI difftool:
$ git pr show -t 7525
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7525.diff