cygutils 1.4.17-2: lssparse -H does not print hole at offset 0 if more data exists
Christian Franke
Christian.Franke@t-online.de
Wed Apr 2 14:01:43 GMT 2025
Testcase for a minor issue:
$ > sparse_file
$ chattr +S sparse_file
$ dd if=/dev/zero bs=1M count=1 conv=sparse,notrunc of=sparse_file
...
$ lssparse sparse_file # OK
$ lssparse -H sparse_file # OK
Hole range[0]: offset=0x0, length=0x100000
$ printf X >> sparse_file
$ lssparse sparse_file # OK
Data range[1]: offset=0x100000, length=0x1
$ lssparse -H sparse_file # Missing 'Hole range[0]'
Data range[1]: offset=0x100000, length=0x1
The condition at lssparse.c:161 is never true:
141 for (i=1 ;;) {
...
161 if (print_holes && (i == 0) && (data_start > 0)) {
Possible patch attached. Important: Not tested with other corner cases.
--
Regards,
Christian
-------------- next part --------------
--- lssparse.c.orig 2025年04月01日 10:48:54.000000000 +0200
+++ lssparse.c 2025年04月02日 15:45:54.179794300 +0200
@@ -138,7 +138,7 @@
* $ /cygdrive/c/Windows/system32/fsutil sparse queryrange ... #
* output
*/
- for (i=1 ;;) {
+ for (i=0 ;;) {
data_start = lseek(fd, offset, SEEK_DATA);
if (data_start == -1)
break;
More information about the Cygwin
mailing list