Expand description
Putting an edited payload back into the container. Concept 7. Repack to a temporary container beside the original and swap it over: never modify in place, because an interruption mid-write corrupts the only copy.
slpc::Destination::in_place is the swap, and reimplementing it would be
a regression. It resolves the path first, so a container reached through a
symbolic link is replaced rather than the link; it takes the replacement’s
permissions from the file being replaced rather than from the umask; and its
commit carries the platform’s mark — Mark of the Web, com.apple.quarantine
— onto the replacement before the rename, failing the commit if it cannot,
so a marked container is never replaced by an unmarked one.
The naive version looks correct and fails quietly. A plain std::fs::rename
is MoveFileEx, which carries over neither the target’s ACLs nor its
alternate data streams, and Mark of the Web is an alternate data stream. The
repack-and-rename anyone would write first strips the container’s trust zone
on the first save, with no error and no visible symptom.
The container is read back before it replaces anything. slipcase repack does this too, and this has more reason to: it runs unattended and
repeatedly, so a fault that would cost one person one container there costs
every save here.
The metadata member is not touched. SPEC 5 defines no checksum or fixity
key and 2.2 assigns no meaning to any key beyond slipcase_version and
payload.file, so a changed payload falsifies nothing a conformant container
says about itself. A producer may have recorded its own size or digest under
a private key permitted by 2.5, and since the specification gives those keys
no meaning this cannot know which, what it covers, or how it is encoded.
Guessing is worse than leaving it: a wrong digest is a false claim, where a
stale one is at least a claim whose provenance is the producer’s.
Enums§
- Error
- Why an edit did not reach the container.
Functions§
- write_
back - Put the session’s payload back into its container, and count it.