Write encrypt and decrypt output only once they succeed (closes #143)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
`secret encrypt` and `secret decrypt` emptied the file named by `--output` before reading any input, so a failure left it empty, and a file given as both `--input` and `--output` was emptied before it was read. They now write into a temporary file of mode 0600 next to it and rename that over it only on success, using the new `secret.WriteFileAtomicFunc`, which `secret.WriteFileAtomic` now calls. A device or pipe given as `--output`, such as `/dev/null`, is written to directly instead of being replaced by a file. Judgement call: the device and pipe case goes beyond the plan. Judgement call: a symbolic link given as `--output` is replaced, not followed. Model: opus-5-5
This commit is contained in:
@@ -18,6 +18,15 @@ https://git.eeqj.de/sneak/secret/milestone/12
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-10-14: A failed `secret encrypt` or `secret decrypt` leaves the file
|
||||
named by `--output` as it was, and the same file can be given as `--input` and
|
||||
`--output` (https://git.eeqj.de/sneak/secret/issues/143). Both emptied the
|
||||
output file before reading any input, so a wrong key left it empty, and a file
|
||||
given as both was emptied before it was read. They now write the result into a
|
||||
temporary file next to it and rename that over it once they have succeeded,
|
||||
with the new `secret.WriteFileAtomicFunc`, which `secret.WriteFileAtomic` now
|
||||
calls; the output file has mode 0600. A device or a pipe given as `--output`,
|
||||
such as `/dev/null`, is still written to directly.
|
||||
- 2026-10-12: A mnemonic typed with extra spaces, tabs or line breaks gives the
|
||||
same long-term key as its words separated by single spaces
|
||||
(https://git.eeqj.de/sneak/secret/issues/135). The key was derived from the
|
||||
|
||||
Reference in New Issue
Block a user