RFR: 8322565 (zipfs) Files.setPosixPermissions should preserve 'external file attributes' bits [v2]
Eirik Bjørsnøs
eirbjo at openjdk.org
Tue Jan 9 10:22:40 UTC 2024
> This PR suggests that `Files.setPosixPermissions`as implemented by `ZipFileSystem` should preserve the leading seven bits of the 'external file attributes' field. These bits contain the 'file type', 'setuid', 'setgid', and 'sticky' bits. These are unrelated to permissions and should not be modified by this operation.
>
> The fix is to update `Entry.readCEN` to read all 16 bits and to update `ZipFileSystem.setPermissions` to preserve the leading 7 bits when updating the trailing 9 permission-related bits of the `Entry.posixPerms` field.
>
> The PR adds a new test `TestPosix.preserveRemainingBits()` which verifies that the leading 7 bits are not affected by `Files.setPosixPermissions`.
>
> Note that this PR does not aim to preserve the leading seven bits for the case when `Files.setPosixPermissions` is called with a `null` permission set. (The implementation currently interprets this as a signal that the 'external file attributes' should not be populated and the 'version made by' OS will be MSDOS instead of Unix)
Eirik Bjørsnøs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
- Verify that ZipFileSystem preserves 'external file attribute' bits when performing operations unrelated to POSIX, such as Files.setLastModifiedTime.
- Merge branch 'master' into zipfs-preserve-external-file-attrs
- Preserve non-permission 'external file attributes' bits when setting posix permissions
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/17170/files
- new: https://git.openjdk.org/jdk/pull/17170/files/7f7771ee..524159f3
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=17170&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=17170&range=00-01
Stats: 3917 lines in 274 files changed: 2371 ins; 637 del; 909 mod
Patch: https://git.openjdk.org/jdk/pull/17170.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/17170/head:pull/17170
PR: https://git.openjdk.org/jdk/pull/17170
More information about the core-libs-dev
mailing list