mirror of
https://github.com/tobi/disktree.git
synced 2026-11-28 08:00:53 +00:00
Permanent deletion opened its target by full path, following any symlink on the way down. A directory swapped for a link after the scan (a shared /tmp, say) redirected the removal: `/tmp/d/x` marked, `d` made a link to `~`, and `~/x` went. The way down is now opened one component at a time with O_NOFOLLOW (O_PATH on Linux), and the target removed with unlinkat relative to its parent. The scanned root is canonical, so a marked path never legitimately has a link on it. The plan is judged against a mount table read on a background thread, empty until the first read lands and up to two seconds old after. The removal worker now reads it fresh and checks each target for a mount point on it or inside it before touching anything. Permanent deletion stopped at a mount boundary already; the trash did not. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>