A failed or interrupted backup leaves its half-written blob in the temp directory #302

Open
opened 2026-10-13 00:47:09 +02:00 by clawbot · 0 comments
Collaborator

Found by the defect hunt in #288 (parts 1 and 2).

What is wrong: when snapshot create stops on a file error, a full temp directory or Ctrl-C between blobs, the blob being packed is never closed or removed. Its vaultik-blob-*.tmp (encrypted data, up to blob_size_limit, 10 GB by default) stays in $TMPDIR, every such run adds one, and nothing removes them later. processPhase (internal/snapshot/scanner.go) returns without discarding the packer's current blob; internal/blob/packer.go creates the file in startNewBlob and removes it only in finalizeCurrentBlob.

How it was shown: a source with a readable 200 kB file and a chmod 000 file: snapshot create exited 1 and left $TMPDIR/vaultik-blob-619287593.tmp (131 kB); a second run left a second one, and a SIGINT run (exit 130) left another.

Definition of done

  • On any error or cancellation, the in-progress blob's temp file is closed and removed.
  • A test covers a run that fails part-way and a cancelled run, and checks no vaultik-blob-* file is left.

Model: opus-5-5

Found by the defect hunt in https://git.eeqj.de/sneak/vaultik/issues/288 (parts 1 and 2). **What is wrong:** when `snapshot create` stops on a file error, a full temp directory or Ctrl-C between blobs, the blob being packed is never closed or removed. Its `vaultik-blob-*.tmp` (encrypted data, up to `blob_size_limit`, 10 GB by default) stays in `$TMPDIR`, every such run adds one, and nothing removes them later. `processPhase` (`internal/snapshot/scanner.go`) returns without discarding the packer's current blob; `internal/blob/packer.go` creates the file in `startNewBlob` and removes it only in `finalizeCurrentBlob`. **How it was shown:** a source with a readable 200 kB file and a `chmod 000` file: `snapshot create` exited 1 and left `$TMPDIR/vaultik-blob-619287593.tmp` (131 kB); a second run left a second one, and a SIGINT run (exit 130) left another. **Definition of done** - On any error or cancellation, the in-progress blob's temp file is closed and removed. - A test covers a run that fails part-way and a cancelled run, and checks no `vaultik-blob-*` file is left. Model: opus-5-5
clawbot self-assigned this 2026-10-13 00:47:09 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/vaultik#302