]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Linux: Fix tst-copy_file_range-large test on recent kernels [BZ #33498]
authorCollin Funk <collin.funk1@gmail.com>
Sun, 28 Sep 2025 00:28:47 +0000 (17:28 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Sun, 28 Sep 2025 01:18:04 +0000 (18:18 -0700)
Instead of a negative return value the fixed FUSE copy_file_range will
silently truncate the size to UINT_MAX & PAGE_MASK [1]. Allow that value
to be returned as well.

[1] https://github.com/torvalds/linux/commit/1e08938c3694f707bb165535df352ac97a8c75c9

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
sysdeps/unix/sysv/linux/tst-copy_file_range-large.c

index 14fdf82953afee37a947ff2a350aba7c4d9ac107..9eafb8c425fe87187f8722aa7441cf7f085fc93a 100644 (file)
@@ -170,7 +170,13 @@ test_size (struct support_fuse *f, off64_t size)
       FAIL_UNSUPPORTED ("copy_file_range not supported");
     }
 
-  TEST_COMPARE (copied, size);
+  /* To avoid the negative return value in Linux versions 6.18 the size is
+     silently clamped to UINT_MAX & PAGE_MASK.  Accept that return value
+     too.  See:
+     <https://github.com/torvalds/linux/commit/1e08938c3694f707bb165535df352ac97a8c75c9>.
+  */
+  if (copied != size)
+    TEST_COMPARE (copied, UINT_MAX & ~(getpagesize () - 1));
 
   xclose (dest_fd);
   xclose (source_fd);