Bug 2397782 - `cp --preserve=xattr a b` now fails when copying on a NFSv4
Summary: `cp --preserve=xattr a b` now fails when copying on a NFSv4
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukáš Zaoral
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-09-24 11:19 UTC by Lukáš Zaoral
Modified: 2026-06-05 12:42 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2026-06-05 12:42:07 UTC
Type: Bug
Embargoed:
lzaoral: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-2494 0 None None None 2025-10-10 10:50:43 UTC

Description Lukáš Zaoral 2025-09-24 11:19:39 UTC
After some fix in kernel, `listxattr(3)` now lists `security.selinux` but this attribute cannot be set because it is apparently read-only and synthesised by the kernel:

# strace -s 100 --trace='/xattr' cp --preserve=xattr a b
flistxattr(3, NULL, 0)                  = 33
flistxattr(3, "system.nfs4_acl\0security.selinux\0", 33) = 33
fgetxattr(3, "system.nfs4_acl", NULL, 0) = 80
fgetxattr(3, "system.nfs4_acl", "\0\0\0\3\0\0\0\0\0\0\0\0\0\26\1\207\0\0\0\6OWNER@\0\0\0\0\0\0\0\0\0\0\0\22\0\201\0\0\0\6GROUP@\0\0\0\0\0\0\0\0\0\0\0\22\0\201\0\0\0\tEVERYONE@\0\0", 80) = 80
fsetxattr(4, "system.nfs4_acl", "\0\0\0\3\0\0\0\0\0\0\0\0\0\26\1\207\0\0\0\6OWNER@\0\0\0\0\0\0\0\0\0\0\0\22\0\201\0\0\0\6GROUP@\0\0\0\0\0\0\0\0\0\0\0\22\0\201\0\0\0\tEVERYONE@\0\0", 80, 0) = 0
fgetxattr(3, "security.selinux", NULL, 0) = 27
fgetxattr(3, "security.selinux", "system_u:object_r:nfs_t:s0", 27) = 27
fsetxattr(4, "security.selinux", "system_u:object_r:nfs_t:s0", 27, 0) = -1 EOPNOTSUPP (Operation not supported)
cp: setting attributes for 'b': Operation not supported

Well, the error itself is correct, `fsetxattr` failed, and `--preserve=mode` can be used as a workaround if the reason for using `--preserve=xattr` were NFSv4 ACLs,
but it still looks quite annoying.  The destination file will have `system_u:object_r:nfs_t:s0` synthesised anyway so despite the error it will end up with the same
xattrs as the source...

Originally reported in bz2397467#c5.

Comment 1 Fedora Release Engineering 2026-05-06 14:09:58 UTC
This message is a reminder that Fedora Linux 42 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 42 on 2026-05-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '42'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 42 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 2 Lukáš Zaoral 2026-06-05 12:42:07 UTC
On a second thought, the current behaviour seems to be correct.


Note You need to log in before you can comment on or make changes to this bug.