From: Paul Eggert Date: Tue, 13 Jan 2026 17:35:12 +0000 (-0800) Subject: cat: don’t treat copy_file_range EFBIG as fatal X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf36efedc01cda41863fdad257e1b5ca36c5a81d;p=thirdparty%2Fcoreutils.git cat: don’t treat copy_file_range EFBIG as fatal * src/cat.c (copy_cat): * src/copy-file-data.c (sparse_copy): Don’t treat EFBIG as a reportable error from copy_file_range. If the input is at EOF and the output position is 2**63 - 1, copy_file_range (ifd, NULL, ofd, NULL, 2146435072, 0) incorrectly fails with EFBIG. Problem observed on Ubuntu 25.10 x86-64 with Linux kernel 6.17.0-8-generic #8-Ubuntu. I am too lazy to report this kernel bug or add a coreutils test case. --- diff --git a/src/cat.c b/src/cat.c index e4a7c19830..b3996f40bc 100644 --- a/src/cat.c +++ b/src/cat.c @@ -523,7 +523,7 @@ copy_cat (void) case -1: if (errno == ENOSYS || is_ENOTSUP (errno) || errno == EINVAL || errno == EBADF || errno == EXDEV || errno == ETXTBSY - || errno == EPERM) + || errno == EPERM || errno == EFBIG) return 0; error (0, errno, "%s", quotef (infile)); return -1; diff --git a/src/copy-file-data.c b/src/copy-file-data.c index 0872c1a50c..a48d06b79d 100644 --- a/src/copy-file-data.c +++ b/src/copy-file-data.c @@ -146,6 +146,14 @@ sparse_copy (int src_fd, int dest_fd, char **abuf, idx_t buf_size, } if (n_copied < 0) { + /* Don’t treat EFBIG as a reportable error from copy_file_range. + If the input is at EOF and the output position is 2**63 - 1, + copy_file_range (ifd, NULL, ofd, NULL, 2146435072, 0) + incorrectly fails with EFBIG. Problem observed on Ubuntu 25.10 + x86-64 with Linux kernel 6.17.0-8-generic #8-Ubuntu. */ + if (errno == EFBIG) + break; + debug->offload = COPY_DEBUG_UNSUPPORTED; /* Consider operation unsupported only if no data copied.