Skip to content

Commit

Permalink
tests: initial caught before we signal ready in resized.sh
Browse files Browse the repository at this point in the history
Incredibly obvious in hindsight, but it's quite possible to race a WINCH
event vs. initialization of caught and end up with a mismatch in expected
signal catches.

This was super-reliably hit in my OpenBSD 7.5 VM.

Signed-off-by: Kyle Evans <[email protected]>
  • Loading branch information
kevans91 committed Sep 26, 2024
1 parent 4226451 commit bd5d113
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build
.*.swp
*.o
*.bak
*.orig
*.core
*.debug
*.full
Expand Down
3 changes: 1 addition & 2 deletions tests/resized.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/bin/sh

loop=1
caught=0

trap 'echo resized; caught=$((caught + 1))' WINCH
trap 'loop=0' INT

# Release the hounds now that the signal handler is setup.
echo "ready"

caught=0

while [ "$loop" -ne 0 ]; do
sleep 1
done
Expand Down

0 comments on commit bd5d113

Please sign in to comment.