Warn about and skip non-regular and .zfs operands, keeping their records (closes #9)
check / check (push) Successful in 1m39s

A symlink, socket, FIFO or device-node operand, or a directory operand
named .zfs, was ignored without a word and stayed in the scanned
operands, so the update phase deleted every record stored beneath it.
Such an operand now gets a one-line warning naming the path and what it
is, counts as skipped in the summary, and is dropped before the
database index is loaded, so the records beneath it are left alone.
The exit status stays 0. An operand that turns into one of these
between that check and the walk is warned about and skipped by the
walk instead. README "scan mode" and "Rules for the walk" say so.

Model: opus-5-5
This commit is contained in:
2026-10-03 12:18:28 +00:00
parent c9bf22d483
commit 3fcf4993e2
5 changed files with 206 additions and 40 deletions
+15 -3
View File
@@ -251,6 +251,14 @@ duplicates another or lies under another is dropped before walking,
so every file is reached exactly once and produces one database
record.
An operand that is a symlink (never followed, not even as an operand),
socket, FIFO, or device node, or a directory named `.zfs`, is not
scanned. `scan` prints a one-line warning naming the path and what it
is, counts it as skipped, and drops it from the scanned operands before
reading the database, so the records stored beneath it are left as
they are. This is not an error: a scan whose every operand is dropped
walks nothing and exits 0.
`scan` synchronizes the database with the filesystem state under the
scanned operands:
@@ -356,9 +364,12 @@ during the hash phase:
Rules for the walk:
- Only regular files. Skip directories, symlinks (do not follow,
including symlink operands), sockets, FIFOs, and device nodes.
including symlink operands), sockets, FIFOs, and device nodes. An
operand that is a symlink, socket, FIFO, or device node is dropped
as described in "`scan` mode" above.
- Never descend into a directory named `.zfs` (ZFS snapshot pseudo-dirs;
walking them would list every file once per snapshot).
walking them would list every file once per snapshot), not even
when it is an operand; such an operand is dropped the same way.
- Filesystem boundaries are crossed by default. With `-x`
(long form `--one-file-system`, following the GNU `du`/`rsync`
convention), never descend into a directory on a different
@@ -369,7 +380,8 @@ Rules for the walk:
path, and continue. Per-file errors never abort the run; the final
summary reports how many were skipped. As specified above, a
skipped path that has a database record from an earlier scan loses
that record, unless it failed only in the content phase; an
that record, unless it failed only in the content phase or is an
operand dropped before the database was read; an
unreadable directory subtree likewise loses its records (accepted:
the database mirrors what the latest scan could actually verify).