RFR: 8308678: (fs) UnixPath::toRealPath needs additional permissions when running with SM (macOS)

Lance Andersen lancea at openjdk.org
Thu May 25 19:33:58 UTC 2023


On Thu, 25 May 2023 17:08:39 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> When not resolving links and the case retention algorithm cannot be run due to a security manager being in place with no read permissions for the tree to be traversed, then fall back to the result obtained without case correction.

test/jdk/java/nio/file/Path/MacToRealPathWithSM.java line 29:

> 27:  * @summary Verify UnixPath::toRealPath falls back if no perms on macOS
> 28:  * @run main/othervm -Djava.security.manager=allow MacToRealPathWithSM MacToRealPath.policy
> 29:  */

Any thought given to specifying the policy on the command line and running the test with and without the SecurityManager enabled?

test/jdk/java/nio/file/Path/MacToRealPathWithSM.java line 43:

> 41:         System.out.println("testSrc: " + testSrc);
> 42:         System.out.println("tmpDir: " + tmpDir);
> 43: 

Maybe use a printf here ?

test/jdk/java/nio/file/Path/MacToRealPathWithSM.java line 63:

> 61:         System.out.printf("real path no follow: %s%n",
> 62:                           path.toRealPath(LinkOption.NOFOLLOW_LINKS));
> 63:     }

Same comment regarding printf

Are you expecting an Exception to be thrown if there is an issue given there is no validation?  Either way, I would clarify with additional comments for future maintainers

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14157#discussion_r1205925953
PR Review Comment: https://git.openjdk.org/jdk/pull/14157#discussion_r1205926820
PR Review Comment: https://git.openjdk.org/jdk/pull/14157#discussion_r1205929551


More information about the nio-dev mailing list