Non-regular and .zfs operands are silently ignored, and their records are deleted #9
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
seedRoot'sdefault:branch (scan.go:581-583) returnsnilfor an operand that is a symlink, socket, FIFO or device node — no warning, no skip counter.scan.go:562-564does the same for a directory operand literally named.zfs.Two problems follow.
First, silence.
sfdupes scan /srv/datawhere/srv/datais a symlink to the real tree printsscan: 0 files seen (0 added, 0 updated, 0 removed, 0 unchanged), 0 skippedand exits 0. README §Rules for the walk requires that any skipped path "print a one-line warning to stderr, skip the path, and continue" — the skip is correct, the silence is not. Symlinked operands are an ordinary mistake to make.Second, and worse: the operand stays in
roots, soloadIndex(scan.go:193-215) treats every existing database record beneath that path as in-scope, andupdatePhasedeletes all of them because nothing verified them this run. A single mistyped symlink operand therefore wipes the records for that whole subtree.Definition of done
.zfsdoes the same.1 skippedsummary, exit 0, and that pre-existing records beneath the symlink target survive; a.zfsoperand asserts the same.make checkgreen.