Return a nonzero exit status for detected FASTQ parsing errors - #718
Open
thierrygosselin wants to merge 2 commits into
Open
Return a nonzero exit status for detected FASTQ parsing errors#718thierrygosselin wants to merge 2 commits into
thierrygosselin wants to merge 2 commits into
Conversation
Use error_exit instead of returning NULL when a FASTQ record has an invalid separator or unequal sequence and quality lengths. Returning NULL made these detected errors indistinguishable from normal EOF, allowing incomplete processing to finish with exit status 0. Preserve existing record diagnostics and include the input filename in the fatal error message. This is separate from filesystem read-error handling proposed in PR OpenGene#533.
Test invalid or missing separators and short, long, or missing quality strings in plain and gzipped FASTQ files. Place malformed records both at the beginning and after 40,000 valid reads. Verify that valid input, including files without a final newline, continues to work. All 24 cases pass with the fix. Unmodified Conda fastp 1.3.6 incorrectly returns success for all 20 malformed-input cases.
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
When the FASTQ parser detects an invalid separator or unequal sequence and quality lengths, it currently returns
NULL. Callers interpret this as normal EOF, allowing incomplete processing to finish with exit status 0.This PR replaces those two error returns with
error_exit().Changes
This is separate from #533, which addresses filesystem read errors. It does not depend on #716 or #717.
Regression tests
Added tests for plain and gzipped FASTQ containing:
Run with:
On macOS ARM64, all 24 cases pass with the patch. Unmodified Conda fastp 1.3.6 incorrectly returns success for all 20 malformed-input cases; the four valid-input cases pass.
Scope
This changes the exit behaviour of existing parser checks, not the full FASTQ validation policy. Filesystem I/O failures and other malformed-record patterns are outside this patch. Linux execution has not been tested.