Commit 8a356b77717a2e4f735ec06e326880ca1f61aadb

Paul Eggert 2025-05-09T18:02:29

qcopy-acl: port better to NFSv4 on GNU/Linux Problem reported by Ian Dall in <https://bugs.gnu.org/78328> and by Thomas Clark in <https://bugzilla.redhat.com/2363149>. * lib/file-has-acl.c (smack_new_label_from_file) [!HAVE_SMACK]: New dummy function. (has_xattr, get_aclinfo): New arg FD. All callers changed. Remove some unnecessary MAYBE_UNUSEDs. (acl_get_fd_np): Fall back on acl_get_fd if this function is needed but not available. (acl_get_fdfile): New function, if needed. (file_has_aclinfo): Reimplement in terms of ... (fdfile_has_aclinfo): ... this new function, which also has an FD argument. * lib/qcopy-acl.c [USE_XATTR]: Include dirent.h, for DT_DIR etc. (qcopy_acl): If attr_copy_file or attr_copy_fd fail with EOPNOTSUPP, don’t fail if the source has a trivial ACL (this is the part that fixes the bug; the rest is optimization). * modules/qcopy-acl (Depends-on): Depend on dirent-h and file-has-acl if $use_xattr. Also, depend on acl-permissions unconditionally, since qcopy-acl.c includes acl.h unconditionally.