# SEEK_DATA / SEEK_HOLE: EOF and cursor contract

This bundle records four deliberately prepared regular files, not a workload
sample, performance benchmark, allocation census or crash experiment.
The native probe uses only new private files and removes them when finished.
It never opens a raw device or changes a pre-existing input file.

## Reproduce

Run on Linux with Python 3 and util-linux findmnt:

```sh
python3 -B probe.py --parent /path/to/scratch --output fresh-observation.json
python3 -B -m unittest discover -s . -p test_probe.py
python3 -B -O -m unittest discover -s . -p test_probe.py
```

The output must not already exist. Preparation, scanning and readback errors fail
the capture. Endpoint queries retain either an offset or an error code; the
receipt tests reject unexpected EOF results. Unsupported scan operations are not
recoded as end-of-file. The unit suite has
a separate native smoke test that reports an explicit skip on unsupported
filesystems. The retained receipt is checked even if that smoke test is skipped.

Preparation: an empty file; a 16,384-byte ftruncate-only file; 16,384 explicitly
written zero bytes; and a 16,384-byte file containing 4,096 X bytes at offset
4,096. Checked fsync precedes the queries. Seek maps and endpoint results are
captured before full pread readback, since reading may affect later classification.
Files are private with no concurrent writer. Readback is checked against the
complete preparation oracle, not merely against another checksum.

Results at EOF and beyond, reported logical ranges, 512-byte st_blocks counts,
and shared-cursor observations are retained in observation.json. Neither
st_blocks nor seek classification measures underlying thin-pool usage.

The cursor check seeks through dup(), checks the original descriptor, compares
a separate open(), then verifies that pread() leaves the shared cursor unchanged.
The separate open is inside the private fixture; reopening an arbitrary mutable
pathname would need an additional identity check.

Tests accept conservative all-data maps, reject stalled/out-of-bounds walks,
distinguish ENXIO from other errors, and exercise short-read accumulation.
The scan helper requires a stable source. It does not detect all concurrent
changes and is not a production backup implementation. Per-operation consistency
does not turn a multi-call walk into a snapshot.

## Evidence

- https://man7.org/linux/man-pages/man2/lseek.2.html
- https://man7.org/linux/man-pages/man2/dup.2.html
- https://man7.org/linux/man-pages/man2/pread.2.html
- https://github.com/torvalds/linux/blob/v6.8/fs/read_write.c
- https://github.com/torvalds/linux/blob/v6.8/fs/iomap/seek.c
- https://github.com/torvalds/linux/blob/v6.8/fs/ext4/file.c

Sources checked 2026-11-29. Linux v6.8 sources explicitly reject a starting
offset greater than or equal to EOF for both operations. A hole query beginning
below EOF may instead return EOF. The no-snapshot warning is an inference from
per-operation locking and independently mutable contents, not a concurrency
experiment. Current POSIX normative text was not used for this Linux-scoped note.
No third-party source code is copied in this bundle.
