cp,mv,install: fix chown on Linux CIFS

* src/copy.c (chown_failure_ok): Also treat EACCES as OK.
This commit is contained in:
Paul Eggert committed 2023-09-01 15:10:45 -07:00
1 parent de4a5220f2
commit 5f97136160
2 files changed
+13 -2

No files matched your search

+4
View File
@@ -4,6 +4,10 @@ GNU coreutils NEWS -*- outline -*-
** Bug fixes
cp, mv, install no longer issue spurious "failed to preserve ownership"
diagnostics when copying to GNU/Linux CIFS filesystems. They do
this by working around a Linux CIFS bug.
numfmt options like --suffix no longer have an arbitrary 127-byte limit.
[bug introduced with numfmt in coreutils-8.21]
+9 -2
View File
@@ -3449,9 +3449,16 @@ chown_failure_ok (struct cp_options const *x)
{
/* If non-root uses -p, it's ok if we can't preserve ownership.
But root probably wants to know, e.g. if NFS disallows it,
or if the target system doesn't support file ownership. */
or if the target system doesn't support file ownership.
return ((errno == EPERM || errno == EINVAL) && !x->chown_privileges);
Treat EACCES like EPERM and EINVAL to work around a bug in Linux
CIFS <https://bugs.gnu.org/65599>. Although this means coreutils
will ignore EACCES errors that it should report, problems should
occur only when some other process is racing with coreutils and
coreutils is not immune to races anyway. */
return ((errno == EPERM || errno == EINVAL || errno == EACCES)
&& !x->chown_privileges);
}
/* Similarly, return true if it's OK for chmod and similar operations