coreutils: reintroduce patch disabling SEEK_HOLE in cp for darwin x86_64

partial revert of a891659902512a66d7faf4c424c8c360de304720

+48
+5
pkgs/tools/misc/coreutils/default.nix
··· 39 39 sha256 = "sha256-YaH0ENeLp+fzelpPUObRMgrKMzdUhKMlXt3xejhYBCM="; 40 40 }; 41 41 42 + patches = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ 43 + # Workaround for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51433 44 + ./disable-seek-hole.patch 45 + ]; 46 + 42 47 postPatch = '' 43 48 # The test tends to fail on btrfs, f2fs and maybe other unusual filesystems. 44 49 sed '2i echo Skipping dd sparse test && exit 77' -i ./tests/dd/sparse.sh
+43
pkgs/tools/misc/coreutils/disable-seek-hole.patch
··· 1 + diff --git a/src/copy.c b/src/copy.c 2 + index cb9018f93..2a4ccc061 100644 3 + --- a/src/copy.c 4 + +++ b/src/copy.c 5 + @@ -502,7 +502,7 @@ write_zeros (int fd, off_t n_bytes) 6 + return true; 7 + } 8 + 9 + -#ifdef SEEK_HOLE 10 + +#if 0 11 + /* Perform an efficient extent copy, if possible. This avoids 12 + the overhead of detecting holes in hole-introducing/preserving 13 + copy, and thus makes copying sparse files much more efficient. 14 + @@ -1095,7 +1095,7 @@ infer_scantype (int fd, struct stat const *sb, 15 + && ST_NBLOCKS (*sb) < sb->st_size / ST_NBLOCKSIZE)) 16 + return PLAIN_SCANTYPE; 17 + 18 + -#ifdef SEEK_HOLE 19 + +#if 0 20 + scan_inference->ext_start = lseek (fd, 0, SEEK_DATA); 21 + if (0 <= scan_inference->ext_start) 22 + return LSEEK_SCANTYPE; 23 + @@ -1377,7 +1377,7 @@ copy_reg (char const *src_name, char const *dst_name, 24 + off_t n_read; 25 + bool wrote_hole_at_eof = false; 26 + if (! ( 27 + -#ifdef SEEK_HOLE 28 + +#if 0 29 + scantype == LSEEK_SCANTYPE 30 + ? lseek_copy (source_desc, dest_desc, buf, buf_size, hole_size, 31 + scan_inference.ext_start, src_open_sb.st_size, 32 + diff --git a/tests/seek-data-capable b/tests/seek-data-capable 33 + index cc6372214..6e7a9ec1e 100644 34 + --- a/tests/seek-data-capable 35 + +++ b/tests/seek-data-capable 36 + @@ -1,5 +1,7 @@ 37 + import sys, os, errno, platform 38 + 39 + +sys.exit(1) 40 + + 41 + # Pass an _empty_ file 42 + if len(sys.argv) != 2: 43 + sys.exit(1)