]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
copy: copy_file_range: handle ENOENT for CIFS
authorPádraig Brady <P@draigBrady.com>
Sat, 7 Jan 2023 16:10:01 +0000 (16:10 +0000)
committerPádraig Brady <P@draigBrady.com>
Sun, 8 Jan 2023 13:34:52 +0000 (13:34 +0000)
* src/copy.c (sparse_copy): Fallback to standard copy upon ENOENT,
which was seen intermittently across CIFS file systems.
* NEWS: Mention the bug fix, though qualify it as an "issue"
rather than a bug, as coreutils is likely only highlighting
a CIFS bug in this case.
Fixes https://bugs.gnu.org/60455

NEWS
src/copy.c

diff --git a/NEWS b/NEWS
index 3105df3f88be2b6a32234dac38d57edaed86df06..9594179b48b08b263ce06de05af410b491b04bd6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,10 @@ GNU coreutils NEWS                                    -*- outline -*-
   which may have resulted in data corruption.
   [bug introduced in coreutils-7.5 and enabled by default in coreutils-9.0]
 
+  cp, mv, and install now handle ENOENT failures across CIFS file systems,
+  falling back from copy_file_range to a better supported standard copy.
+  [issue introduced in coreutils-9.0]
+
   'mv --backup=simple f d/' no longer mistakenly backs up d/f to f~.
   [bug introduced in coreutils-9.1]
 
index 519c43b005394fed015ebfd65e51176142c94237..98f2ba45a2723576bd8c81f5eb2b5b6e801c15a1 100644 (file)
@@ -290,6 +290,11 @@ sparse_copy (int src_fd, int dest_fd, char **abuf, size_t buf_size,
             if (errno == EPERM && *total_n_read == 0)
               break;
 
+            /* ENOENT was seen sometimes across CIFS shares, resulting in
+               no data being copied, but subsequent standard copies succeed.  */
+            if (errno == ENOENT && *total_n_read == 0)
+              break;
+
             if (errno == EINTR)
               n_copied = 0;
             else