scan: skip OS default excludes, and record nothing on filesystems that are not persistent (closes #124)
check / check (push) Canceled after 0s

scan never records anything on a filesystem that is not persistent
(tmpfs, proc, sysfs and the other kernel or memory-backed types). As it
starts it notes the device ID of each such mount point, from
/proc/self/mountinfo on Linux and the mounted-filesystem list on macOS,
and checks every operand, directory and file the walk meets against
them; no flag turns this off. Below an operand the walk also skips the
default excludes, a path list per system (Linux, macOS, and Windows,
which is not used yet), and --no-default-excludes turns off only those.
A default exclude that is itself an operand gets no skip line. The tests
stop at once, saying why, when TMPDIR is not on a persistent filesystem.

Judgement call: an unreadable mount list fails the scan, and no flag gets round it.
Judgement call: a file on such a filesystem below an operand gets the same line as a directory.
Judgement call: an operand on such a filesystem that another operand's walk also reaches is named twice.
Unverified: the macOS mount list is built for macOS but never run; bind mounts need root to test.

Model: opus-5-5
This commit is contained in:
2026-10-17 00:31:52 +00:00
parent 68f6bde5ee
commit 18aa3a383d
11 changed files with 1187 additions and 135 deletions
+16
View File
@@ -29,6 +29,22 @@
# Completed Steps
- `scan` never records anything that is not on a persistent filesystem (`tmpfs`,
`proc`, `sysfs` and the other kernel or memory-backed types), matched by the
device ID of each such mount point, listed as the scan starts from
`/proc/self/mountinfo` on Linux and the mounted-filesystem list on macOS,
however the walk reaches it; no flag turns that off. Below an operand, its
walk does not enter the default excludes either, so `sfdupes scan /` skips the
kernel's view of the running system and the temporary directories: on Linux
`/proc`, `/sys`, `/dev`, `/run`, `/tmp` and `/var/tmp`, on macOS `/dev`,
`/private/tmp`, `/private/var/tmp`, `/private/var/vm`, `/System/Volumes/VM`
and `/System/Volumes/Data`, and a Windows list, not used yet. An operand at or
inside a default exclude is still walked. The scan prints a line for each path
it leaves out, without counting it as skipped, and the records there count as
outside the scanned operands, as for `-x`. `--no-default-excludes` turns off
the default excludes only, and `scan --help` lists them (2026-10-17,
https://git.eeqj.de/sneak/sfdupes/issues/124)
- the rate a progress display shows covers the items completed over the last 5
seconds, or since the line before when stderr is not a terminal, so it falls
to 0 while nothing completes, and a burst after a wait no longer reads as a