> 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 instead of just the > trailing 12 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`. This > test also verifies that operations not related to POSIX, such as > Files.setLastModifiedTime does not affect the 'external file attributes' > value. > > 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 incrementally with one additional commit since the last revision: Extract testing of the Files.setPosixFilePermissions operation and the Files.setLastModifiedTime operation into separate test methods. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/17170/files - new: https://git.openjdk.org/jdk/pull/17170/files/524159f3..e4a505fa Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=17170&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17170&range=01-02 Stats: 53 lines in 1 file changed: 35 ins; 11 del; 7 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