On Wed, 24 Jan 2024 14:34:03 GMT, Eirik Bjørsnøs <[email protected]> wrote:
> Please review this PR to fix to a regression in ZipFileSystem, introduced by
> JDK-8322565 in PR #17170.
>
> When `Files.setPosixFilePermissions` is called on an existing MSDOS entry,
> then `Entry.posixPerms` field will be -1 (all 1s in binary). The logic
> introduced by JDK-8322565 did not account for this and incorrectly sets the
> leading seven bits to all ones instead of all zeros.
>
> The fix is to introduce a branch for `Entry.posixPerms` being -1 and deal
> with that case separately.
>
> The PR adds a test case to `TestPosix` which reproduces the regression. While
> visiting this test, I also fixed an incorrect spelling of
> `setPosixFilePermissions` (also introduced by #17170).
Looks OK overall. One minor suggestion
test/jdk/jdk/nio/zipfs/TestPosix.java line 757:
> 755: try (FileSystem fs = FileSystems.newFileSystem(ZIP_FILE,
> ENV_POSIX)) {
> 756: Path path = fs.getPath("hello.txt");
> 757: Files.setPosixFilePermissions(path, EnumSet.of(OWNER_READ));
It might be helpful to show the before/after output of the CEN fields here just
for extra clarity
-------------
Marked as reviewed by lancea (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/17556#pullrequestreview-1860241911
PR Review Comment: https://git.openjdk.org/jdk/pull/17556#discussion_r1476630176