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

Check for gzopen() failure and print error messages #1013

Merged
merged 1 commit into from Feb 21, 2019

Conversation

jmarshall
Copy link
Member

Ensure that all instances of gzopen() have appropriate error checking. In a couple of cases, lift the gzopen to above some allocations so that the error path doesn't need to undo the allocations. Down in misc/*.c the infrastructure is lacking and we don't go to great lengths to e.g. return a non-zero status.

Fixes another few instances of #51.

Noticed in bedcov by @rotifergirl (see https://twitter.com/Julie_B92/status/1097867250642628608).

Hat tip Julie Blommaert, who noticed bedcov's infinite loop when
given a non-existent BED file.
@daviesrob daviesrob merged commit 61e880b into samtools:develop Feb 21, 2019
@daviesrob
Copy link
Member

Thanks. More work needed here, but it's a start.

Bedcov getting into an infinite loop suggests something lacking in kseq too.

@jmarshall jmarshall deleted the gzopen-failed branch February 21, 2019 14:04
@jmarshall
Copy link
Member Author

Yes, kseq and kstream basically have no error checking — IMHO the way to deal with this is to exterminate places where they're used. See also samtools/htslib@71c03b8's commit message.

I'm sure bedcov.c has better ways to read BED files nowadays, but this was the small quick fix…

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.

None yet

2 participants