secret get fails when it cannot write the value #166

Merged
clawbot merged 1 commits from fix/155-get-write-error into next 2026-10-15 01:32:15 +02:00
Collaborator

secret get, with or without --version, now returns a failed write of the value as its error, so it prints Error: failed to write secret value: ... and exits 1. Before, the result of the write was discarded, and a redirect to /dev/full exited 0 with nothing written. Fixes #155.

The new test sets the command's output to a file that is already closed and requires the error; it failed before the change. The README's secret get section says a failed write, such as to a full disk, exits 1, and names the two cases that do not: when the reader of a pipe has already exited, the broken-pipe signal ends secret with no message and status 141; when the shell closed stdout before secret started, it exits 0.

Disclosures:

  • Deviation from the Definition of done: a stdout the shell closes before secret starts still exits 0. The Go runtime opens /dev/null in its place before any of secret runs, and the write there succeeds. Reading recorded at #155 (comment).
  • Judgement call: secret list ignores its write errors the same way and is left as it is, since the issue scopes the fix to get.

Model: opus-5-5

`secret get`, with or without `--version`, now returns a failed write of the value as its error, so it prints `Error: failed to write secret value: ...` and exits 1. Before, the result of the write was discarded, and a redirect to `/dev/full` exited 0 with nothing written. Fixes https://git.eeqj.de/sneak/secret/issues/155. The new test sets the command's output to a file that is already closed and requires the error; it failed before the change. The README's `secret get` section says a failed write, such as to a full disk, exits 1, and names the two cases that do not: when the reader of a pipe has already exited, the broken-pipe signal ends `secret` with no message and status 141; when the shell closed stdout before `secret` started, it exits 0. Disclosures: - Deviation from the Definition of done: a stdout the shell closes before `secret` starts still exits 0. The Go runtime opens `/dev/null` in its place before any of `secret` runs, and the write there succeeds. Reading recorded at https://git.eeqj.de/sneak/secret/issues/155#issuecomment-140539. - Judgement call: `secret list` ignores its write errors the same way and is left as it is, since the issue scopes the fix to `get`. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 21:21:34 +02:00
clawbot self-assigned this 2026-10-14 21:21:34 +02:00
clawbot force-pushed fix/155-get-write-error from 2d31c0398f to 09335adcb5 2026-10-14 22:11:05 +02:00 Compare
clawbot force-pushed fix/155-get-write-error from 09335adcb5 to 81ffe12c84 2026-10-14 22:33:40 +02:00 Compare
Author
Collaborator
  • README.md lines 145-146: the new sentence says that whenever the value cannot be written, secret get prints the error and exits 1. Two cases do not do that: when the reading end of a pipe has already closed (as in secret get s | true), secret is killed by the broken-pipe signal (SIGPIPE) with no message and exit status 141; and when the shell closed stdout before secret started, it exits 0, as the PR itself discloses. Acceptable: a sentence that is true in every case, for example one that says a failed write, such as to a full disk, prints the error and exits 1, and names those two exceptions.

Model: opus-5-5

- `README.md` lines 145-146: the new sentence says that whenever the value cannot be written, `secret get` prints the error and exits 1. Two cases do not do that: when the reading end of a pipe has already closed (as in `secret get s | true`), `secret` is killed by the broken-pipe signal (SIGPIPE) with no message and exit status 141; and when the shell closed stdout before `secret` started, it exits 0, as the PR itself discloses. Acceptable: a sentence that is true in every case, for example one that says a failed write, such as to a full disk, prints the error and exits 1, and names those two exceptions. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-14 22:51:59 +02:00
clawbot force-pushed fix/155-get-write-error from 81ffe12c84 to d967f894eb 2026-10-14 23:28:27 +02:00 Compare
Author
Collaborator
  • README.md secret get section: now says a failed write, such as to a full disk, prints the error and exits 1, and names both exceptions: a pipe whose reader has already exited (secret get s | true, SIGPIPE, no message, status 141) and a stdout closed before secret started (>&-, exit 0).

Model: opus-5-5

- `README.md` `secret get` section: now says a failed write, such as to a full disk, prints the error and exits 1, and names both exceptions: a pipe whose reader has already exited (`secret get s | true`, SIGPIPE, no message, status 141) and a stdout closed before `secret` started (`>&-`, exit 0). Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-14 23:28:43 +02:00
clawbot force-pushed fix/155-get-write-error from d967f894eb to c81c438c93 2026-10-14 23:32:43 +02:00 Compare
clawbot added 1 commit 2026-10-15 00:38:20 +02:00
GetSecret and GetSecretWithVersion discarded the result of writing the
value to stdout, so a full disk or a failing stdout left the caller with
an empty or cut-short file and exit status 0. The write error is now
returned, so the command prints it and exits 1.

Deviation: a stdout the shell closed before `secret` started still exits
0, because the Go runtime opens /dev/null in its place and the write
there succeeds.

Model: opus-5-5
clawbot force-pushed fix/155-get-write-error from c81c438c93 to 5247819de2 2026-10-15 00:38:20 +02:00 Compare
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit b8842b6184 into next 2026-10-15 01:32:15 +02:00
clawbot deleted branch fix/155-get-write-error 2026-10-15 01:32:16 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/secret#166