Blob Blame History Raw
diff -urNp coreutils-8.22-orig/tests/dd/sparse.sh coreutils-8.22/tests/dd/sparse.sh
--- coreutils-8.22-orig/tests/dd/sparse.sh	2013-12-04 06:48:30.000000000 -0800
+++ coreutils-8.22/tests/dd/sparse.sh	2014-04-12 17:48:22.301975386 -0700
@@ -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