The scanner read ownership by asserting info.Sys() to an interface with Uid() and Gid() methods. On Linux and macOS the value is a *syscall.Stat_t, whose Uid and Gid are fields, so the assertion never matched and every file, directory and symlink was stored as 0:0. A restore as root then chowned everything to root. The three places in internal/snapshot/scanner.go that read ownership now assert to *syscall.Stat_t and read its fields. The README already says uid and gid are recorded and restored; with this change that is true.
TestScannerRecordsOwnership backs up a real file, directory and symlink in a temp directory and compares the recorded uid and gid with os.Getuid() and os.Getgid().
What the diff does not show:
The first backup after this change re-chunks every file not owned by root once, because its stored 0:0 no longer matches the disk.
When the tests run as root, as in the Docker build, the new test compares 0 with 0 and cannot catch this defect. Without the fix it fails on a non-root make test.
The scanner now names syscall.Stat_t, which Windows lacks. The release targets are Linux and macOS, and internal/snapshot/progress.go already uses syscall.SIGUSR1.
Partially verified: the darwin build compiles (make release-snapshot); the test has not run on macOS.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/vaultik/issues/216.
The scanner read ownership by asserting `info.Sys()` to an interface with `Uid()` and `Gid()` methods. On Linux and macOS the value is a `*syscall.Stat_t`, whose `Uid` and `Gid` are fields, so the assertion never matched and every file, directory and symlink was stored as `0:0`. A restore as root then chowned everything to root. The three places in `internal/snapshot/scanner.go` that read ownership now assert to `*syscall.Stat_t` and read its fields. The README already says uid and gid are recorded and restored; with this change that is true.
`TestScannerRecordsOwnership` backs up a real file, directory and symlink in a temp directory and compares the recorded uid and gid with `os.Getuid()` and `os.Getgid()`.
What the diff does not show:
- The first backup after this change re-chunks every file not owned by root once, because its stored `0:0` no longer matches the disk.
- When the tests run as root, as in the Docker build, the new test compares 0 with 0 and cannot catch this defect. Without the fix it fails on a non-root `make test`.
- The scanner now names `syscall.Stat_t`, which Windows lacks. The release targets are Linux and macOS, and `internal/snapshot/progress.go` already uses `syscall.SIGUSR1`.
Partially verified: the darwin build compiles (`make release-snapshot`); the test has not run on macOS.
Model: opus-5-5
The scanner read uid and gid by asserting the stat result to an
interface with Uid() and Gid() methods. *syscall.Stat_t has Uid and Gid
fields, not methods, so the assertion never matched and every file,
directory and symlink was stored as 0:0; a restore as root then gave
everything to root. The scanner now reads the fields of
*syscall.Stat_t.
The first backup after this change re-reads every file not owned by
root, because its stored uid and gid no longer match the disk.
When the tests run as root, as in the Docker build, the new test
compares 0 with 0 and cannot catch the defect; a non-root run does.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #216.
The scanner read ownership by asserting
info.Sys()to an interface withUid()andGid()methods. On Linux and macOS the value is a*syscall.Stat_t, whoseUidandGidare fields, so the assertion never matched and every file, directory and symlink was stored as0:0. A restore as root then chowned everything to root. The three places ininternal/snapshot/scanner.gothat read ownership now assert to*syscall.Stat_tand read its fields. The README already says uid and gid are recorded and restored; with this change that is true.TestScannerRecordsOwnershipbacks up a real file, directory and symlink in a temp directory and compares the recorded uid and gid withos.Getuid()andos.Getgid().What the diff does not show:
0:0no longer matches the disk.make test.syscall.Stat_t, which Windows lacks. The release targets are Linux and macOS, andinternal/snapshot/progress.goalready usessyscall.SIGUSR1.Partially verified: the darwin build compiles (
make release-snapshot); the test has not run on macOS.Model: opus-5-5
Review passed.
Model: opus-5-5