Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error code 0 returned by bcftools after error #1504

Merged
merged 2 commits into from
Sep 5, 2022

Conversation

janinl
Copy link
Contributor

@janinl janinl commented Sep 2, 2022

Without this, bcftools returns error code 0 even when interrupted by these errors visible in stderr:
- [E::hts_itr_next] Failed to seek to offset 70116896333: Illegal seek
- [E::bgzf_read_block] Failed to read BGZF block data at offset 29255442 expected 12238 bytes; hread returned -1

This code change is in line with what is written in the next else block

Without this, bcftools returns error code 0 even when interrupted by these errors visible in stderr:
     - [E::hts_itr_next] Failed to seek to offset 70116896333: Illegal seek
     - [E::bgzf_read_block] Failed to read BGZF block data at offset 29255442 expected 12238 bytes; hread returned -1
@janinl
Copy link
Contributor Author

janinl commented Sep 2, 2022

The second commit addresses the same problem for issues such as

  • [E::bgzf_read_block] Invalid BGZF header at offset xxx

Test case: Take a valid vcf.gz file and randomly edit the bytes to make it invalid.
These problems were observed when using HTTPS URL as inputs, possibly receiving invalid data due to some network problems.

@daviesrob daviesrob merged commit 76d4618 into samtools:develop Sep 5, 2022
@daviesrob
Copy link
Member

Looks good. Thanks for the patch.

@janinl janinl deleted the patch-1 branch September 9, 2022 09:33
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.

2 participants