Skip to content

8342270: Test sun/security/pkcs11/Provider/RequiredMechCheck.java needs write access to src tree #21665

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

Closed
wants to merge 4 commits into from

Conversation

fguallini
Copy link
Member

@fguallini fguallini commented Oct 23, 2024

The test sun/security/pkcs11/Provider/RequiredMechCheck.java extends sun/security/pkcs11/PKCS11Test.java, which sets up a PKCS11Provider configured with NSS config files located in the source tree directory (sun/security/pkcs11/nss) for the dependent tests to run properly. This test currently fails if that pkcs11/nss directory is made read-only because these config files are updated during the test execution. Files located in the source tree should not be modified when running tests.
This PR updates the PKCS11Test to copy the NSS config files to the Jtreg scratch directory and configures the provider to use those files instead.


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-8342270: Test sun/security/pkcs11/Provider/RequiredMechCheck.java needs write access to src tree (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21665

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 23, 2024

👋 Welcome back fguallini! 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 Oct 23, 2024

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

8342270: Test sun/security/pkcs11/Provider/RequiredMechCheck.java needs write access to src tree

Reviewed-by: rhalade, erikj

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

  • 6811a11: 8341408: Implement JEP 488: Primitive Types in Patterns, instanceof, and switch (Second Preview)
  • 72a45dd: 8341834: C2 compilation fails with "bad AD file" due to Replicate
  • 57c3bb6: 8343068: C2: CastX2P Ideal transformation not always applied
  • 83f3d42: 8339303: C2: dead node after failing to match cloned address expression
  • ead0116: 8331341: secondary_super_cache does not scale well: C1 and interpreter
  • 06d8216: 8318442: java/net/httpclient/ManyRequests2.java fails intermittently on Linux
  • bdd6816: 8343502: RISC-V: SIGBUS in updateBytesCRC32 after JDK-8339738
  • 4431852: 8342943: Replace predicate walking and cloning code for main/post loops with a predicate visitor
  • 1b0281d: 8333427: langtools/tools/javac/newlines/NewLineTest.java is failing on Japanese Windows
  • 471f112: 8342577: Clean up JVMTI breakpoint support
  • ... and 195 more: https://git.openjdk.org/jdk/compare/893266c48f26e089d0449d2c161b04430741970c...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 (@erikj79, @rhalade) 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
Copy link

openjdk bot commented Oct 23, 2024

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

  • security

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 security security-dev@openjdk.org label Oct 23, 2024
@fguallini fguallini marked this pull request as ready for review October 23, 2024 16:52
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 23, 2024
@mlbridge
Copy link

mlbridge bot commented Oct 23, 2024

Webrevs

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 23, 2024
@@ -247,6 +247,30 @@ public static String getBase() throws Exception {
return PKCS11_BASE;
}

private static void copyFiles(Path source, String destination)
Copy link
Member

Choose a reason for hiding this comment

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

Check jdk.test.lib if there is a method you can use to copy files. If not then this method should be added to library.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to use the existing Utils.copyFile, it was also needed to add the dependency in a shell test that uses PKCS11Test.java

@@ -497,13 +521,17 @@ public static String getNssConfig() throws Exception {
}

String base = getBase();
String nss = "nss";
Path nssDirSource = Path.of(base).resolve(nss);
String nssDirDestination = Path.of(".").resolve(nss).toString();
Copy link
Member

Choose a reason for hiding this comment

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

Using current directory here may be incorrect. Can this be changed to Path.of(System.getProperty("test.classes"), ".")

Copy link
Member Author

@fguallini fguallini Oct 24, 2024

Choose a reason for hiding this comment

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

The "test.classes" directory only contains the compiled classes according to jtreg doc.
Whereas, the current directory is the Jtreg scratch directory, which is the right place for the tests temporary files. Also, Jtreg will automatically clean this directory when the test begins.
The scratch directory does seem like the best place to store these temporary configuration files.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 24, 2024
@fguallini fguallini requested a review from rhalade November 4, 2024 10:27
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 4, 2024
@fguallini
Copy link
Member Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 6, 2024
@openjdk
Copy link

openjdk bot commented Nov 6, 2024

@fguallini
Your change (at version 1b1eae9) is now ready to be sponsored by a Committer.

@rhalade
Copy link
Member

rhalade commented Nov 6, 2024

/sponsor

@openjdk
Copy link

openjdk bot commented Nov 6, 2024

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

  • 78b378a: 8342540: InterfaceCalls micro-benchmark gives misleading results
  • c0e6c3b: 8343214: Fix encoding errors in APX New Data Destination Instructions Support
  • 0be7118: 8279016: JFR Leak Profiler is broken with Shenandoah
  • 6811a11: 8341408: Implement JEP 488: Primitive Types in Patterns, instanceof, and switch (Second Preview)
  • 72a45dd: 8341834: C2 compilation fails with "bad AD file" due to Replicate
  • 57c3bb6: 8343068: C2: CastX2P Ideal transformation not always applied
  • 83f3d42: 8339303: C2: dead node after failing to match cloned address expression
  • ead0116: 8331341: secondary_super_cache does not scale well: C1 and interpreter
  • 06d8216: 8318442: java/net/httpclient/ManyRequests2.java fails intermittently on Linux
  • bdd6816: 8343502: RISC-V: SIGBUS in updateBytesCRC32 after JDK-8339738
  • ... and 198 more: https://git.openjdk.org/jdk/compare/893266c48f26e089d0449d2c161b04430741970c...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 6, 2024
@openjdk openjdk bot closed this Nov 6, 2024
@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 Nov 6, 2024
@openjdk
Copy link

openjdk bot commented Nov 6, 2024

@rhalade @fguallini Pushed as commit 342fe42.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants