RFR: 8322565 (zipfs) Files.setPosixPermissions should preserve 'external file attributes' bits

Lance Andersen lancea at openjdk.org
Mon Jan 8 17:41:21 UTC 2024


On Wed, 20 Dec 2023 18:51:08 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:

> 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)

@RealCLanger, can you add this to your list to review given your efforts to add support for Posix permission support?

Eirik, I will try and make some time this week or early next for this one

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

PR Comment: https://git.openjdk.org/jdk/pull/17170#issuecomment-1881541762


More information about the core-libs-dev mailing list