Skip to content

Fix mpileup -a bug#2229

Merged
vasudeva8 merged 1 commit into
samtools:developfrom
jkbonfield:fix_2227
Jun 26, 2025
Merged

Fix mpileup -a bug#2229
vasudeva8 merged 1 commit into
samtools:developfrom
jkbonfield:fix_2227

Conversation

@jkbonfield

Copy link
Copy Markdown
Contributor

Caching the 2 references, and assuming if the first doesn't match then we must be using the second, turns out to be incorrect.

It turns out our pileup code needs two (this ref and when using -a the last reference to finish up the sequence), plus bam_mplp64_auto uses two (current refence and potentially next reference if we're on the last record of that reference), and these two aren't necessarily the same pair. So our revised number of in-flight references is now 3, with better checking.

Updated the test data to trigger the bug (under address sanitizer), to verify the fix works before the code changes were added.

Fixes #2227

Caching the 2 references, and assuming if the first doesn't match then
we must be using the second, turns out to be incorrect.

It turns out our pileup code needs two (this ref and when using -a the
last reference to finish up the sequence), plus bam_mplp64_auto uses
two (current refence and potentially next reference if we're on the
last record of that reference), and these two aren't necessarily the
same pair.  So our revised number of in-flight references is now 3,
with better checking.

Updated the test data to trigger the bug (under address sanitizer), to
verify the fix works before the code changes were added.

Fixes samtools#2227
@vasudeva8 vasudeva8 merged commit 3036eb9 into samtools:develop Jun 26, 2025
6 checks passed
daviesrob pushed a commit to daviesrob/samtools that referenced this pull request Jul 10, 2025
Caching the 2 references, and assuming if the first doesn't match then
we must be using the second, turns out to be incorrect.

It turns out our pileup code needs two (this ref and when using -a the
last reference to finish up the sequence), plus bam_mplp64_auto uses
two (current refence and potentially next reference if we're on the
last record of that reference), and these two aren't necessarily the
same pair.  So our revised number of in-flight references is now 3,
with better checking.

Updated the test data to trigger the bug (under address sanitizer), to
verify the fix works before the code changes were added.

Fixes samtools#2227
daviesrob pushed a commit to daviesrob/samtools that referenced this pull request Mar 18, 2026
Caching the 2 references, and assuming if the first doesn't match then
we must be using the second, turns out to be incorrect.

It turns out our pileup code needs two (this ref and when using -a the
last reference to finish up the sequence), plus bam_mplp64_auto uses
two (current refence and potentially next reference if we're on the
last record of that reference), and these two aren't necessarily the
same pair.  So our revised number of in-flight references is now 3,
with better checking.

Updated the test data to trigger the bug (under address sanitizer), to
verify the fix works before the code changes were added.

Fixes samtools#2227
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apparent bug with mpileup -aa

2 participants