Preserve POSIX ACLs when replacing archives - #561
Conversation
|
Reading your changes lead us to redesign how permission copying is implemented: If we are going to replace an existing file, we create the temporary file with permissions 0600 and copy the permissions when replacing the file. Could you please adapt your PR to that? There is a TODO comment where the ACL copy function should be called. Also, don't restrict it to Linux, other system also implement this API. And check for the functions you call, not the existence of the header file. If you need to check for multiple functions, define a USE_ACL at the top of the file if all requirements are met, and use that throughout the rest of the file (to avoid duplicating the logic). |
5ef3f43 to
cae933b
Compare
|
Thanks. I rebased onto the new permission-copy flow and adapted the PR. It now uses the portable |
|
Thanks. However, since acl_get_file is in a separate library on Linux, and we would like to avoid extra dependencies for libzip, I would prefer if you reverted to the previous API. |
|
Understood. I restored the dependency-free |
When libzip replaces an existing archive, the replacement inode can lose an extended POSIX access ACL even though its mode bits are restored. Mode bits are not always an equivalent fallback: for an extended ACL, the group-class bits represent the ACL mask, so dropping the ACL can change which principals receive those permissions.
This revision is rebased onto the new temporary-file permission flow from
31eefd7. It fills the ACL-copy TODO incopy_permissions()and keeps the replacement at0600until commit-time permissions are applied.The change:
system.posix_acl_accessxattr interface;getxattr()andsetxattr()functions that are called and enables the code behind oneUSE_ACLguard;The regression creates an archive with a named-user access ACL and verifies preservation through both an ordinary archive update and a direct named-source replacement.
Validation:
clang-format --dry-run --Werrorandgit diff --check: passed.