Ctrl-D at the mnemonic prompt is ignored; only a mnemonic or a signal ends the prompt #78

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

At the terminal prompt (mnemonic: ), pressing Ctrl-D (end of input) does nothing: the tool goes on waiting, however often it is pressed. The only ways out are typing a mnemonic or a signal (Ctrl-C). The README says the prompt reads "with echo turned off" and says what signals do; a user who wants to back out of the prompt expects Ctrl-D to end it, as it does for ssh or sudo.

Where: internal/mnemonic/mnemonic.go:96, term.ReadPassword. The library reads the terminal one byte at a time with a raw read that returns 0 bytes on Ctrl-D, and treats 0 bytes as "nothing yet" and reads again.

How to see: on a terminal, with no mnemonic source set,

./keyfunc age pub

then press Ctrl-D at the prompt, twice: nothing happens. Ctrl-C ends it with status 130.

Definition of done: end of input at the prompt ends the tool with a message on standard error, status 1 and the terminal's echo restored, and the README's "Giving it the mnemonic" says so. A test that runs the tool as a subprocess on a pseudo-terminal (as internal/cli/age_test.go already runs it as a subprocess) and sends end of input at the prompt.

Severity: minor. Nothing is derived or lost; the user is stuck until Ctrl-C.

Model: fable-5-1

At the terminal prompt (`mnemonic: `), pressing Ctrl-D (end of input) does nothing: the tool goes on waiting, however often it is pressed. The only ways out are typing a mnemonic or a signal (Ctrl-C). The README says the prompt reads "with echo turned off" and says what signals do; a user who wants to back out of the prompt expects Ctrl-D to end it, as it does for `ssh` or `sudo`. Where: `internal/mnemonic/mnemonic.go:96`, `term.ReadPassword`. The library reads the terminal one byte at a time with a raw read that returns 0 bytes on Ctrl-D, and treats 0 bytes as "nothing yet" and reads again. How to see: on a terminal, with no mnemonic source set, ./keyfunc age pub then press Ctrl-D at the prompt, twice: nothing happens. Ctrl-C ends it with status 130. **Definition of done**: end of input at the prompt ends the tool with a message on standard error, status 1 and the terminal's echo restored, and the README's "Giving it the mnemonic" says so. A test that runs the tool as a subprocess on a pseudo-terminal (as `internal/cli/age_test.go` already runs it as a subprocess) and sends end of input at the prompt. Severity: minor. Nothing is derived or lost; the user is stuck until Ctrl-C. Model: fable-5-1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/keyfunc#78