Subject: bug#63856: >=coreutils-9.2 cp: preserving permissions: Operation not supported when copying from no_root_squash nfs export

From: Peter Robertson <[email-masked]>
Date: Fri, 2 Jun 2023 17:29:34 +0000

I have an nfs export: /mnt/Backup Hostname(no_root_squash,ro,mp)
It exports this drive, LABEL=Backup    /mnt/Backup
        btrfs   noatime,compress-force=zstd:99

I have a locally mounted drive, /mnt/Mirror (LABEL=Mirror
/mnt/Mirror             btrfs   compress-force=zstd:99,noatime,nofail)

I mount the nfs share: mount Hostname:/mnt/Backup /mnt/Backup.

I cp a file from one to the other, cp -av
/mnt/Backup/snaps/elden/90/info.xml
/mnt/Mirror/snaps/elden/90/info.xml.

Under coreutils-9.1 I get no error. Under coreutils-9.2 I get cp:
preserving permissions for ‘/mnt/Mirror/snaps/elden/90/info.xml’:
Operation not supported

In both cases the resulting copy looks like this:

# ls -l /mnt/*/snaps/elden/90/info.xml
-rw------- 1 root root 184 Apr 17 10:52 /mnt/Backup/snaps/elden/90/info.xml
-rw------- 1 root root 184 Apr 17 10:52 /mnt/Mirror/snaps/elden/90/info.xml

I git bisected with gentoo's live ebuild coreutils-9999
# first bad commit: [28a85116feef1f9a6f31c5ab8cfe50d7aa8d6fc4] build:
update gnulib submodule to latest

# cp --version
cp (GNU coreutils) 9.2
Packaged by Gentoo (9.2-r2 (p0))
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.

Reproducible: Always