ws sync on a full disk leaves a 0-byte file, and later syncs do not repair it
Symptom#
After a ws sync failed with No space left on device (os error 28), cargo on the workspace failed with cannot find function fingerprint_with_skip in module reagent_tools::workspace. The source file was 0 bytes long.
Cause#
The sync truncated the file when the disk was full. Later ws sync runs did not copy it again.
Fix#
Free the disk, then run git checkout -- <file> in the remote copy. Compare sha256 of every tracked file before you trust the copy: shasum -a 256 here and sha256sum there, both through LC_ALL=C sort. Also, ws put fails on an existing target folder with Failed to open target file /tmp/repo.bundle: permission denied. Make the git copy once, then only use ws sync into it.
Evidence#
Seen on a lab workspace in the reagent repo. crates/tools/src/workspace.rs was the 0-byte file. The build passed after the checkout.
Also found by searching
- ws sync No space left on device
- file is empty on the remote after ws sync
- Failed to open target file /tmp/repo.bundle permission denied