-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8283082: sun.security.x509.X509CertImpl.delete("x509.info.validity") nulls out info field #9306
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
…nulls out info field
|
👋 Welcome back jhuttana! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
|
||
| if (id.equalsIgnoreCase(INFO)) { | ||
| if (attr.getSuffix() != null) { | ||
| if (!(attr.getSuffix() != null)) { |
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.
You can simply update the != to ==.
Also, please add a regression test. Since this is about testing an internal method, you are free to add @modules java.base/sun.security.x509 to access it.
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 test can be much simpler than the program included in the bug report. Something like this:
- Create an empty
X509CertImpl - Add "x509.info"
- Add "x509.info.issuer"
- Remove "x509.info.issuer"
- Add "x509.info.issuer" again
Without the fix, step 4 removes the whole info and step 5 would fail.
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.
Thank you for taking a look at the PR.
Sure I will address these comments.
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 test can be much simpler than the program included in the bug report. Something like this:
1. Create an empty `X509CertImpl` 2. Add "x509.info" 3. Add "x509.info.issuer" 4. Remove "x509.info.issuer" 5. Add "x509.info.issuer" againWithout the fix, step 4 removes the whole info and step 5 would fail.
I am not a getting a clear idea about how to add issuer and delete etc.
Could you please point me to some example?
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.
import sun.security.x509.X500Name;
import sun.security.x509.X509CertImpl;
import sun.security.x509.X509CertInfo;
public class A {
public static void main(String[] args) throws Exception {
var c = new X509CertImpl();
c.set("x509.info", new X509CertInfo());
c.set("x509.info.issuer", new X500Name("CN=one"));
c.delete("x509.info.issuer");
c.set("x509.info.issuer", new X500Name("CN=two"));
}
}
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.
Thank you for providing this!
|
|
||
| if (id.equalsIgnoreCase(INFO)) { | ||
| if (attr.getSuffix() != null) { | ||
| if ((attr.getSuffix() == null)) { |
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.
You can remove the parentheses that were added last time.
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.
Sure I will do that :)
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.
@wangweij I have added the test case under: test/jdk/sun/security/x509/X509CertImpl/JDK8283082.java
As this is the first I am adding regression test so I am not sure whether the naming convention for the test case is right or not.
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 for adding the test. It looks fine. The name is good.
Please add a copyright header and a @test block comment. You can find a nearby existing test file and see what they look like. Since the new test references internal classes, a @modules java.base/sun.security.x509 is necessary. Please run the test with the jtreg command to ensure everything is correct. Before your fix, the test should fail; and after it, it should succeed.
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 for adding the test. It looks fine. The name is good.
Please add a copyright header and a
@testblock comment. You can find a nearby existing test file and see what they look like. Since the new test references internal classes, a@modules java.base/sun.security.x509is necessary. Please run the test with thejtregcommand to ensure everything is correct. Before your fix, the test should fail; and after it, it should succeed.
Ok Sure :) Thanks for suggesting this.
|
I tried to look at what is cause for the failure and not able to locate the detail !! |
|
You can expand the "Run Tests" task and see the failed one (it's very long). It's a linux-x86 test and it mentions "thread". I've heard that thread-related tests could fail on linux-x86 because loom support was only added to linux-x64. Unless you heard from someone else that it's a real issue, I think you can ignore it. |
Sure I will check and confirm that. Thank you! |
- Verified the newly added test case before and after the patch.
|
I made the suggested changes to the test case and verified before and after the patch with jtreg. Before Patch: After Patch: So, this confirms that our test case is exercising the changes and producing the right results. |
|
Great, this looks good. Please use 2022 in the copyright year of the test. You might also want to use your own company's name since this is a new test. See https://github.com/openjdk/jdk/blob/1ee80e03adfae5f428519f7c134e78a0f277a0a5/test/jdk/sun/security/pkcs11/Cipher/EncryptionPadding.java for an example or ask a colleague on what the correct words should be. |
Sure. Thank you. |
wangweij
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.
Everything looks fine to me. Thanks.
|
@jhuttana 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 231 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 (@wangweij) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
/integrate |
|
@jhuttana An unexpected error occurred during integration. No push attempt will be made. The error has been logged and will be investigated. It is possible that this error is caused by a transient issue; feel free to retry the operation. |
|
/integrate |
|
@jhuttana An unexpected error occurred during integration. No push attempt will be made. The error has been logged and will be investigated. It is possible that this error is caused by a transient issue; feel free to retry the operation. |
|
@wangweij Thanks for approving the PR. |
|
I haven't seen this error before. Try again. |
Oh okay :) Sure I will try again |
|
/integrate |
|
@jhuttana An unexpected error occurred during integration. No push attempt will be made. The error has been logged and will be investigated. It is possible that this error is caused by a transient issue; feel free to retry the operation. |
|
/integrate |
|
/sponsor |
|
@wangweij Finally it worked somehow :) |
|
/sponsor |
|
Going to push as commit 31f7fc0.
Your commit was automatically rebased without conflicts. |
Could you please review the changes?
This is to address the issue: https://bugs.openjdk.org/browse/JDK-8283082?jql=labels%20%3D%20starter-bug
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9306/head:pull/9306$ git checkout pull/9306Update a local copy of the PR:
$ git checkout pull/9306$ git pull https://git.openjdk.org/jdk pull/9306/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9306View PR using the GUI difftool:
$ git pr show -t 9306Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9306.diff