detached cdc6474

test: retry raw socket reads interrupted by EINTR

commit
cdc6474b9ccffe66a243f538aa4d01c084ba6700
author
brice · · 2026-09-26 16:40 UTC
parent
a4a3f87
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +15 -2
M internal/adapters/wayland/clipboard_test.go +9 -1
@@ -1,6 +1,7 @@
11 package wayland
22
33 import (
4+ "errors"
45 "testing"
56 "time"
67
@@ -180,7 +181,14 @@ func TestClipboardFollowsFocus(t *testing.T) {
180181 }
181182 }
182183 buf := make([]byte, 16)
183- n, _ := unix.Read(fds[0], buf)
184+ // Go runtime signals (preemption) can interrupt the raw read: retry.
185+ n, err := unix.Read(fds[0], buf)
186+ for errors.Is(err, unix.EINTR) {
187+ n, err = unix.Read(fds[0], buf)
188+ }
189+ if err != nil {
190+ t.Fatal(err)
191+ }
184192 if string(buf[:n]) != "pasted" {
185193 t.Fatalf("pasted %q", buf[:n])
186194 }
@@ -1,6 +1,7 @@
1 package wayland1 package wayland
2 2
3 import (3 import (
4+ "errors"
4 "testing"5 "testing"
5 "time"6 "time"
6 7
@@ -180,7 +181,14 @@ func TestClipboardFollowsFocus(t *testing.T) {
180 }181 }
181 }182 }
182 buf := make([]byte, 16)183 buf := make([]byte, 16)
183- n, _ := unix.Read(fds[0], buf)184+ // Go runtime signals (preemption) can interrupt the raw read: retry.
185+ n, err := unix.Read(fds[0], buf)
186+ for errors.Is(err, unix.EINTR) {
187+ n, err = unix.Read(fds[0], buf)
188+ }
189+ if err != nil {
190+ t.Fatal(err)
191+ }
184 if string(buf[:n]) != "pasted" {192 if string(buf[:n]) != "pasted" {
185 t.Fatalf("pasted %q", buf[:n])193 t.Fatalf("pasted %q", buf[:n])
186 }194 }
M internal/adapters/xwayland/xwayland_test.go +6 -1
@@ -80,7 +80,12 @@ func TestRunDropsClientsOfFailedSatellite(t *testing.T) {
8080 if err := unix.SetsockoptTimeval(fd, unix.SOL_SOCKET, unix.SO_RCVTIMEO, &unix.Timeval{Sec: 3}); err != nil {
8181 t.Fatal(err)
8282 }
83- if n, err := unix.Read(fd, make([]byte, 1)); n != 0 || err != nil {
83+ // Go runtime signals (preemption) can interrupt the raw read: retry.
84+ n, err := unix.Read(fd, make([]byte, 1))
85+ for errors.Is(err, unix.EINTR) {
86+ n, err = unix.Read(fd, make([]byte, 1))
87+ }
88+ if n != 0 || err != nil {
8489 t.Fatalf("read %d %v, want EOF", n, err)
8590 }
8691 cancel()
@@ -80,7 +80,12 @@ func TestRunDropsClientsOfFailedSatellite(t *testing.T) {
80 if err := unix.SetsockoptTimeval(fd, unix.SOL_SOCKET, unix.SO_RCVTIMEO, &unix.Timeval{Sec: 3}); err != nil {80 if err := unix.SetsockoptTimeval(fd, unix.SOL_SOCKET, unix.SO_RCVTIMEO, &unix.Timeval{Sec: 3}); err != nil {
81 t.Fatal(err)81 t.Fatal(err)
82 }82 }
83- if n, err := unix.Read(fd, make([]byte, 1)); n != 0 || err != nil {83+ // Go runtime signals (preemption) can interrupt the raw read: retry.
84+ n, err := unix.Read(fd, make([]byte, 1))
85+ for errors.Is(err, unix.EINTR) {
86+ n, err = unix.Read(fd, make([]byte, 1))
87+ }
88+ if n != 0 || err != nil {
84 t.Fatalf("read %d %v, want EOF", n, err)89 t.Fatalf("read %d %v, want EOF", n, err)
85 }90 }
86 cancel()91 cancel()

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 25

Tags 10

↑↓ moveenter openesc close