The Linux Trash, and why expired files on macOS and Linux are not buried automatically
Linux gained freedesktop Trash support and both macOS and Linux gained folder policies on 23 November—yet expired files in a watched folder refused to bury automatically. Here is why Windows can exclude concurrent writers with a single handle while Linux read leases and macOS flock both fail under real testing.
Acceptance log excerpt from 23 November: byte-exact Linux trash-restore above; concurrent-writer refusal and real kernel tests of Linux read leases and macOS locks below.On this page
Beyond its own private graveyard, Obituary supports an optional system Trash mode (graveyard.mode = recycle) and folder policies (obit watch) that give newly arriving files in folders like ~/Downloads an automatic lifespan.
On 23 November we landed Linux Trash support and unlocked folder policies on macOS and Linux. Yet when we ran a real expiry test on WSL native ext4 with a quiet, closed file inside an approved folder policy, Obituary deliberately left the file untouched:
text
Action:retry; excluding concurrent writers is unavailable; watch entry retained
That refusal guards an operating-system boundary: before burying an automatic folder-policy file, Obituary must know no other process is still writing to it. Windows enforces that with an exclusive share mode; Linux and macOS failed every kernel mechanism we tested.
Linux Trash: strict freedesktop compliance, never degrading to copy or delete
Linux now supports graveyard.mode = recycle, placing buried items into the OS Trash so desktop tools can restore them cleanly while preserving Obituary's crash safety:
Files land in files/ and metadata in info/*.trashinfo (0700, URL-escaped original paths, local deletion timestamps).
Mount IDs distinguish separate bind mounts sharing one device ID; secondary volumes prefer .Trash/<uid> and fall back to private .Trash-<uid>.
Items stage and verify outsidefiles/ (which desktop cleaners can empty at any time), then publish and roll back strictly via same-volume, parent-pinned, non-overwriting renames.
Failures never copy across filesystems and never degrade into permanent deletion.
Independent verification with trash-cli 0.26.9.29 inside isolated XDG_DATA_HOME confirmed byte-identical restoration for names containing spaces, #, and %, for secondary unshare -Urnmtmpfs volumes (relative paths in .trashinfo), and for bind mounts after fixing invalid cross-device link. Three safety tests—including a compiling mutant that disables rollback—guard duplicate retention, redirected-trash rejection, and publish-failure rollback. Once emptied from system Trash, items are permanently gone and cannot be reached by obit resurrect.
Acceptance log excerpt from 23 November: byte-exact Linux trash-restore above; concurrent-writer refusal and real kernel tests of Linux read leases and macOS locks below.
Testing /usr/bin/trash and plain mv on isolated macOS 15.8.2 and 26.7.2 accounts moved files into .Trash safely, yet headless runner accounts have no Finder GUI session. Seeing a file inside .Trash does not prove Finder's "Put Back" works, so we refused to fake it and kept macOS graveyard-only.
POSIX folder policies—and why automatic burial stopped at the kernel line
Folder policies reuse fsnotify (non-recursive) plus the 5-minute full reconcile—zero FSEvents, zero CGO, zero new dependencies. Acceptance also caught a real entrypoint bug: earlier tests had used Downloads/inbox instead of ~/Downloads, and registering ~/Downloads failed with it is or contains a protected folder. Reusing WatchAllowed unlocked folder policies on ~/Downloads while keeping Guard.Check(downloads, true) safely denied against accidental burial.
On Windows, Obituary opens a watched file with a write-denying share mode and renames through that handle. Trying to satisfy the same contract on Linux and macOS hit hard kernel walls:
Linux read leases (F_SETLEASE + F_RDLCK): holding the lease descriptor under WSL's default lease-break-time=45 let another process write successfully after 46.7 seconds, resetting F_GETLEASE to F_UNLCK. Modifying global sysctl settings was out of the question.
macOS locks: on macOS 15.8.2 and 26.7.2 ordinary accounts, holding flock did not stop other processes from writing, and Darwin F_SETLEASE returned EPERM.
Rather than silently moving a file another program might still be writing to, internal/winfs/watch_unix.go deliberately refuses and leaves the file intact (manual obit bury stays unaffected). That real-world disproof led straight to our explicit POSIX policy plan—either waiting out a 10-minute quiet window with open-descriptor checks or prompting per file—keeping OS limits transparent instead of faking Windows guarantees.