Repository navigation
tscreen: prevent terminal mutation after Fini - #1110
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesPost-finalization Shutdown Semantics
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1110 +/- ##
==========================================
+ Coverage 88.48% 89.05% +0.57%
==========================================
Files 47 47
Lines 5530 5593 +63
==========================================
+ Hits 4893 4981 +88
+ Misses 481 462 -19
+ Partials 156 150 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tscreen.go`:
- Around line 1288-1293: The code has a TOCTOU: Resume() and Beep() read t.fini
under t.Lock()/Unlock() and then perform terminal mutations after unlocking,
allowing a concurrent Fini() to flip state; fix by performing the
check-and-action while holding the same mutex (i.e., keep t.Lock() held while
verifying t.fini and doing the terminal mutation) or re-check t.fini after
reacquiring the lock before mutating state/output; update the implementations of
Resume, Beep (and the analogous block at the other location) to ensure the
terminal mutation is executed only while the mutex protects t.fini to prevent
races with Fini().
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5f26fb0a-77ca-4370-a603-d40525b50460
📒 Files selected for processing (2)
tscreen.gotscreen_test.go
03d76ef to
92b900f
Compare
Summary
Fini()guards become effectiveFini()Validation
go test ./...go test -race ./...Fixes #1091
Summary by CodeRabbit
Bug Fixes
Tests