[Bug 299361] /bin/stat -h output is not parsable, is not scalable, lacks locking, has no option for listing data sections

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 13 Oct 2026 12:25:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299361

            Bug ID: 299361
           Summary: /bin/stat -h output is not parsable, is not scalable,
                    lacks locking, has no option for listing data sections
           Product: Base System
           Version: 16.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: jasmin.dave.math@gmail.com

/bin/stat -h output is not parsable, is not scalable, lacks locking, has no
option for listing data sections

Among many issues with the stat -h output is this:
- stat -h produces an endless stream of values in a single line, but standard
/bin/sh and other tools have line length limitations. Writing scripts which can
actually parse this are HARD to write, or trigger hidden limitations in tools
once the number of holes in a sparse file gets longer
- stat -h always starts at file position zero, which renders it unusable in
real world multi-PB sparse files. There should be an option to pass
startpos,endpos to limit the search, allowing scripts to work on only parts of
the file
- stat -h lacks an option to lock the file to prevent modifications by other
tools while it is looking for holes
- stat -h lacks an option to list the positions of data sections

-- 
You are receiving this mail because:
You are the assignee for the bug.