From 3969aeac0ba2e8b47bab0fdba704b793034afe36 Mon Sep 17 00:00:00 2001 From: Zhou Qiankang Date: Thu, 2 Jul 2026 23:45:32 +0800 Subject: [PATCH] testsuite: relax sparse file SEEK_DATA check On filesystems with large allocation units like tmpfs with hugepages, SEEK_DATA can report an offset before the actual first non-zero byte. The test already verifies file contents and checks st_blocks to confirm the file is stored sparsely, so only require that the first data region is not past the expected content. Signed-off-by: Zhou Qiankang --- src/borg/testsuite/archiver/extract_cmd_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/borg/testsuite/archiver/extract_cmd_test.py b/src/borg/testsuite/archiver/extract_cmd_test.py index 7a19d46b5..976368133 100644 --- a/src/borg/testsuite/archiver/extract_cmd_test.py +++ b/src/borg/testsuite/archiver/extract_cmd_test.py @@ -198,7 +198,9 @@ def test_sparse_file(archivers, request): try: if fd.seek(0, os.SEEK_HOLE) != 0: sparse = False - if fd.seek(0, os.SEEK_DATA) != hole_size: + # FS allocation granularity may report DATA before the actual first + # non-zero byte, so only check it is not after the expected content. + if fd.seek(0, os.SEEK_DATA) > hole_size: sparse = False except OSError: # OS/FS does not really support SEEK_HOLE/SEEK_DATA