File coreutils-modify_sparse_test.patch of Package coreutils

commit 7c03fe2c9f498bad7e40d29f2eb4573d23e102d0
Author: Pádraig Brady <P@draigBrady.com>
Date:   Fri Apr 11 23:44:13 2014 +0100

    tests: fix false dd conv=sparse failure on newer XFS
    
    * tests/dd/sparse.sh: When testing that a hole is created,
    use an existing sparse destination file, so that we're
    not write extending the file size, and thus avoiding
    speculative preallocation which can result in smaller
    holes than requested.
    Workaround suggested by Brian Foster

---
 THANKS.in          |    1 +
 tests/dd/sparse.sh |    9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

Index: coreutils-8.22/THANKS.in
===================================================================
--- coreutils-8.22.orig/THANKS.in	2014-09-16 14:00:30.630945353 +0200
+++ coreutils-8.22/THANKS.in	2014-09-16 14:00:30.703944440 +0200
@@ -94,6 +94,7 @@ Bjorn Helgaas                       helg
 Bob McCracken                       kerouac@ravenet.com
 Branden Robinson                    branden@necrotic.deadbeast.net
 Brendan O'Dea                       bod@compusol.com.au
+Brian Foster                        bfoster@redhat.com
 Brian Kimball                       bfk@footbag.org
 Brian M. Carlson                    sandals@crustytoothpaste.ath.cx
 Brian Silverman                     bsilverman@conceptxdesign.com
Index: coreutils-8.22/tests/dd/sparse.sh
===================================================================
--- coreutils-8.22.orig/tests/dd/sparse.sh	2013-12-04 15:48:30.000000000 +0100
+++ coreutils-8.22/tests/dd/sparse.sh	2014-09-16 14:00:30.703944440 +0200
@@ -61,8 +61,15 @@ if test $(kb_alloc file.in) -gt 3000; th
   dd if=file.in of=file.out bs=2M conv=sparse
   test 2500 -lt $(kb_alloc file.out) || fail=1
 
+  # Note we recreate a sparse file first to avoid
+  # speculative preallocation seen in XFS, where a write() that
+  # extends a file can preallocate some extra space that
+  # a subsequent seek will not convert to a hole.
+  rm -f file.out
+  truncate --size=3M file.out
+
   # Ensure that this 1MiB string of NULs *is* converted to a hole.
-  dd if=file.in of=file.out bs=1M conv=sparse
+  dd if=file.in of=file.out bs=1M conv=sparse,notrunc
   test $(kb_alloc file.out) -lt 2500 || fail=1
 
 fi
openSUSE Build Service is sponsored by