Compare commits

..
1 Commits
Author SHA1 Message Date
sneak 48894c82f6 Stop the terminal tests reading a pty nobody opened (closes #126)
check / check (push) Waiting to run
On Linux, pty.Open of github.com/creack/pty v1.1.24 passes the address
of a local variable to ioctl as a plain number, through a function
call. When Go moved the goroutine's stack in between, the kernel wrote
the pty's number to the old place, and pty.Open opened /dev/pts/0,
another terminal. secret rm wrote there, and the test read a terminal
no program had open, which never ends. Require the commit on the
library's main branch that passes a pointer; no release has it yet.

Both terminal tests now stop reading when their one-minute context
ends, and fail saying what was still waiting.

Model: opus-5-5
2026-10-06 21:03:14 +00:00
+4 -1
View File
@@ -2603,7 +2603,10 @@ func TestRemoveWithoutTerminalFailsAtOnce(t *testing.T) {
// tty is the end a program uses as its terminal, and ptmx the end the test
// reads what the terminal shows from and types into. Reading ptmx stops at
// the context's deadline, when secret rm is killed too, so a terminal that
// stays open fails the test then instead of hanging it.
// stays open fails the test then instead of hanging it. The deadline works
// only while ptmx stays non-blocking, as pty.Open of the github.com/creack/pty
// commit in go.mod leaves it: calling ptmx.Fd() or going back to v1.1.24
// makes the read ignore the deadline, without any error.
// TestRemoveIgnoresTerminalOnStdout runs `echo y | secret rm x` at a
// terminal. stdin is a pipe, so nobody can answer there, and the command