Fix segfault when coverage runs with annotations disabled#2552
Merged
joelhawksley merged 1 commit intoViewComponent:mainfrom Feb 12, 2026
Merged
Fix segfault when coverage runs with annotations disabled#2552joelhawksley merged 1 commit intoViewComponent:mainfrom
joelhawksley merged 1 commit intoViewComponent:mainfrom
Conversation
756e791 to
12ee3a1
Compare
The fix in v4.3.0 only avoided negative lineno when BOTH coverage was running AND annotations were enabled. This still caused segfaults when coverage was running but annotations were disabled (the common case in CI environments). The fix: always use lineno=0 when coverage is running, regardless of annotation settings. The annotation line stripping is still conditional on annotations being enabled (since there's nothing to strip otherwise). Before (v4.3.0): coverage + annotations → lineno=0 ✓ coverage + no annotations → lineno=-1 → SEGFAULT After: coverage + annotations → lineno=0, strip line ✓ coverage + no annotations → lineno=0 ✓ Added regression test for the annotations-disabled case. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
12ee3a1 to
ea51de7
Compare
joelhawksley
approved these changes
Feb 12, 2026
Member
|
Thanks for the quick fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sorry about this - the fix I submitted in #2541 didn't fully solve the problem. It turns out there's still a segfault when coverage is running but template annotations are disabled.
What went wrong
When I tested locally, annotations were enabled by default, so everything worked. I didn't realise that in most CI environments (including ours!), annotations are typically disabled. This meant the fix only covered one scenario.
The condition I wrote was too restrictive:
This only avoided the negative
linenowhen both conditions were true. When annotations are disabled (common in CI), it still usedlineno = -1, which causes the segfault.The fix
Always use
lineno = 0when coverage is running, regardless of annotation settings:The annotation line stripping still only happens when annotations are enabled (since there's nothing to strip otherwise), but we avoid the dangerous negative lineno either way.
Added test
I've added a test specifically for the annotations-disabled case. Unfortunately the segfault only reproduces on Linux, not macOS, so I couldn't verify locally - but it would have caught this if it had been in the original PR.
Again, apologies for not getting this right the first time.