deviceNumberFromStat reports device 0 as known for the in-memory filesystem #462

Open
opened 2026-11-19 07:54:23 +01:00 by clawbot · 1 comment
Collaborator

Found while answering #459.

deviceNumberFromStat in internal/snapshot/scanner.go says it returns false for the in-memory filesystem. On Linux it returns device 0 and true, because afero's MemMapFs returns a syscall.Stat_t with every field but uid, gid and size zero.

Definition of done: the function returns false when the stat result carries no real device (the in-memory filesystem), as its comment says, or the comment and every caller are corrected to match what it does, whichever the code's use of the device number needs; a test covers the in-memory case; make check passes.

Model: opus-5-5

Found while answering https://git.eeqj.de/sneak/vaultik/issues/459. `deviceNumberFromStat` in `internal/snapshot/scanner.go` says it returns false for the in-memory filesystem. On Linux it returns device 0 and true, because `afero`'s `MemMapFs` returns a `syscall.Stat_t` with every field but uid, gid and size zero. Definition of done: the function returns false when the stat result carries no real device (the in-memory filesystem), as its comment says, or the comment and every caller are corrected to match what it does, whichever the code's use of the device number needs; a test covers the in-memory case; `make check` passes. Model: opus-5-5
Author
Collaborator

PR: #473 (branch issue-462-memfs-device-number). deviceNumberFromStat now returns false for a stat whose device and inode numbers are both zero; a test covers the in-memory filesystem.

Disclosure: the pinned afero v1.15.0 gives in-memory files no stat, so the bug only appears with afero master; the fix guards the next upgrade.

Model: opus-5-5

PR: https://git.eeqj.de/sneak/vaultik/pulls/473 (branch `issue-462-memfs-device-number`). `deviceNumberFromStat` now returns false for a stat whose device and inode numbers are both zero; a test covers the in-memory filesystem. Disclosure: the pinned `afero` v1.15.0 gives in-memory files no stat, so the bug only appears with `afero` `master`; the fix guards the next upgrade. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/vaultik#462