photocraft/crates/format
David Mann 589941a536
Save: refuse to replace a read-only file (#6600) (#6643)
Saving writes a temporary file and renames it over the destination. A
rename only needs the folder to be writable, so on Linux and macOS a
read-only (chmod 444) file was silently replaced, while on Windows the
rename failed with a vague "locked or read-only" access error.

atomic_write now asks the AtomicFs whether the existing destination is
read-only (new `is_readonly`, false by default for other implementors)
and refuses before anything is written: "cannot save <file>: the file
is read-only; the original file was not changed". New files and
writable files save as before. Photoshop refuses the same way; the
user saves a copy with Save As.

Tests: a fake AtomicFs reporting read-only gets the error with nothing
written or renamed; a real file marked read-only keeps its bytes and
mode and gets the clear message on every platform.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 11:55:43 -06:00
..
fuzz Fuzz: ignore the same build leftovers in every fuzz crate (#3585) 2026-10-12 10:19:06 -04:00
src Save: refuse to replace a read-only file (#6600) (#6643) 2026-10-17 11:55:43 -06:00
tests fix(doc): variable definitions follow layer id remapping on copy and load (#5023) 2026-10-14 15:02:43 -07:00
Cargo.toml Dependencies: require ruzstd 0.9.1 for RUSTSEC-2026-0344 (#4952) (#5225) 2026-10-15 13:37:56 -06:00