TestWalkOneFilesystemSameFS (scan_test.go:280-298) only proves that -x skips nothing when every path is on one filesystem. That is the negative case. The branch that actually implements the flag — scan.go:745-747, if dev, ok := deviceOfInfo(info); ok && dev != parent.rootDev — has never been executed by a test, and neither has the !parent.rootDevOK bypass at scan.go:731-733.
-x is a documented flag (README §scan mode, GNU du/rsync convention) whose whole purpose is to not descend across a mount point. Getting it wrong on a ZFS server with many datasets means either scanning far more than asked or silently missing trees. Tests requiring a real second filesystem are not portable, but the branch is directly reachable through subdirJob.
Definition of done
A unit test calls subdirJob directly with a fabricated parent dirJob{rootDev: someOtherDevice, rootDevOK: true} and oneFS = true, and asserts the subdirectory is rejected.
A companion case with rootDevOK: false asserts the boundary check is bypassed and the subdirectory is accepted.
A case where e.Info() returns an error asserts the warning is emitted and the path skipped.
A matching case asserts the default (no -x) crosses the boundary.
make check green.
`TestWalkOneFilesystemSameFS` (`scan_test.go:280-298`) only proves that `-x` skips nothing when every path is on one filesystem. That is the negative case. The branch that actually implements the flag — `scan.go:745-747`, `if dev, ok := deviceOfInfo(info); ok && dev != parent.rootDev` — has never been executed by a test, and neither has the `!parent.rootDevOK` bypass at `scan.go:731-733`.
`-x` is a documented flag (README §scan mode, GNU `du`/`rsync` convention) whose whole purpose is to not descend across a mount point. Getting it wrong on a ZFS server with many datasets means either scanning far more than asked or silently missing trees. Tests requiring a real second filesystem are not portable, but the branch is directly reachable through `subdirJob`.
## Definition of done
1. A unit test calls `subdirJob` directly with a fabricated parent `dirJob{rootDev: someOtherDevice, rootDevOK: true}` and `oneFS = true`, and asserts the subdirectory is rejected.
2. A companion case with `rootDevOK: false` asserts the boundary check is bypassed and the subdirectory is accepted.
3. A case where `e.Info()` returns an error asserts the warning is emitted and the path skipped.
4. A matching case asserts the default (no `-x`) crosses the boundary.
5. `make check` green.
clawbot
added this to the 1.0.0 milestone 2026-08-09 03:46:20 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
TestWalkOneFilesystemSameFS(scan_test.go:280-298) only proves that-xskips nothing when every path is on one filesystem. That is the negative case. The branch that actually implements the flag —scan.go:745-747,if dev, ok := deviceOfInfo(info); ok && dev != parent.rootDev— has never been executed by a test, and neither has the!parent.rootDevOKbypass atscan.go:731-733.-xis a documented flag (README §scan mode, GNUdu/rsyncconvention) whose whole purpose is to not descend across a mount point. Getting it wrong on a ZFS server with many datasets means either scanning far more than asked or silently missing trees. Tests requiring a real second filesystem are not portable, but the branch is directly reachable throughsubdirJob.Definition of done
subdirJobdirectly with a fabricated parentdirJob{rootDev: someOtherDevice, rootDevOK: true}andoneFS = true, and asserts the subdirectory is rejected.rootDevOK: falseasserts the boundary check is bypassed and the subdirectory is accepted.e.Info()returns an error asserts the warning is emitted and the path skipped.-x) crosses the boundary.make checkgreen.