]> git.ipfire.org Git - thirdparty/coreutils.git/commit
cp: --sparse=always was missing some holes
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 6 Aug 2025 23:25:01 +0000 (16:25 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Aug 2025 03:20:04 +0000 (20:20 -0700)
commit2f2adb294eb24e0754c2341fb3a699088956a673
tree12e79b85c6e95679e2462bf26e8672c9b3f6ce84
parentc9a30d67814f4b7daac7cdd33b69822ce5313d48
cp: --sparse=always was missing some holes

The sparse code assumed that st_blksize was the minimum hole size.
However, st_blksize is an optimum I/O buffer size, not the file
system fundamental block size.  Use ST_NBLOCKSIZE instead;
although it may underestimate the true block size that just slows
‘cp’ down a bit, without introducing bugs.
* src/copy.c (sparse_copy): Arg scan_holes replaces
the old hole_size arg.  All callers changed.
(lseek_copy): Remove hole_size arg; no longer needed.
Caller changed.
NEWS
src/copy.c