Repository navigation
[FIX,TOPP] MSstatsConverter: return ILLEGAL_PARAMETERS instead of aborting (SIGABRT) on an unidentifiable input - #9901
Conversation
…rting on an unidentifiable input fatalErrorIf_ took its exit code as an `int` and threw it, while main_ catches `const ExitCodes&`. C++ exception matching does not convert an int to an enum, and TOPPBase has no catch-all, so the throw escaped main() and the process died: $ MSstatsConverter -in unidentifiable.dat -in_design design.tsv -out out.csv Warning: Could not determine format of input file 'unidentifiable.dat'! MSstatsConverter.cpp(198): FATAL: Input type is not consensusXML! terminate called after throwing an instance of 'int' Aborted (core dumped) # exit 134 Changing the parameter to ExitCodes makes the thrown object match the existing handler; the tool now returns ILLEGAL_PARAMETERS (6). Verified: exit 134 -> exit 6. This is not a regression. It has been on develop since the tool was merged in #3485 (ab6cf7e, 2018-05-30), introduced two months earlier by 04e4be8, which changed `catch(int)` to `catch(const ExitCodes&)` while making the helper take and throw an int -- the pre-merge feature-branch version, with `catch(int)` matching `throw 1`, was correct and is the only version that ever worked. It went unnoticed because the path is narrow, not because it was unreachable: TOPPBase has warned rather than refused on an undeterminable input type since ~2008, but FileHandler::getType sniffs content as well as extension, so a recognized-but-wrong file (.mzML, .tsv) is rejected cleanly before main_ runs, and a misnamed but valid consensusXML is identified by content and processed normally. Only a file unidentifiable by BOTH extension and content reaches fatalErrorIf_. Regression test: TOPP_MSstatsConverter_unknown_input_type asserts the EXACT exit code via a new check_exit_code.cmake helper. ctest's WILL_FAIL cannot express this -- it treats a crash and a clean error alike, so it would have passed on the bug -- and PASS_REGULAR_EXPRESSION ignores the exit code entirely (the FATAL line is printed in both cases). Confirmed to fail on purpose: with the int restored the test reports "Expected exit code 6, got 'Subprocess aborted'". TriqlerConverter had the identical copy-paste defect; it is removed in #9898. A repo-wide sweep found no other TOPP tool throwing a numeric type without a matching handler (MSFraggerAdapter throws ints but catches them). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01S7QNzj4dhRnX5htcHZFmDm
8d00d11 to
a97d20e
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
📝 WalkthroughWalkthrough
ChangesMSstatsConverter error handling
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Audited PRs merged since the last CHANGELOG update (#9881): most of them (#9879, #9880, #9882, #9884, #9886, #9892, #9896, #9898, #9900, #9901, #9888) already carried their own CHANGELOG entries. Only the Docker library-stage fix (#9891) was missing one. Claude-Session: https://claude.ai/code/session_01Jgrv6mFL3oawgLdYs1efPH Co-authored-by: Claude <[email protected]>
Summary
MSstatsConverteraborts with SIGABRT instead of returning an error when handed an input file whose type OpenMS cannot determine.fatalErrorIf_took its exit code as anintand threw it, whilemain_catchesconst ExitCodes&. C++ exception matching does not convert anintto an enum, andTOPPBasehas nocatch(...), so the throw escapedmain().Fix: one type change — the helper takes
ExitCodes, so the thrown object matches the existing handler. Verified end to end: exit 134 → exit 6 (ILLEGAL_PARAMETERS).This is not a regression
It has been on
developsince the tool was merged in #3485 (ab6cf7ed75d9, 2018-05-30). The defect was introduced two months earlier by04e4be810495, which did:The pre-merge feature-branch version —
catch(int)matchingthrow 1— was correct, and is the only version that ever worked. It never reacheddevelop.Why it went unnoticed for eight years
The path is narrow, not unreachable.
TOPPBasehas warned rather than refused on an undeterminable input type since ~2008, butFileHandler::getTypesniffs content as well as extension:.consensusXML.mzML/.tsv(recognized, wrong)Invalid parameter, exit 6, beforemain_runs.datOnly the last row reaches
fatalErrorIf_, and no test supplied such a file.Regression test
TOPP_MSstatsConverter_unknown_input_typeasserts the exact exit code, via a newcheck_exit_code.cmakehelper.This mattered: neither existing ctest mechanism can express the assertion.
WILL_FAILonly distinguishes zero from non-zero, so it treats a crash and a clean error alike — it would have passed on the bug.PASS_REGULAR_EXPRESSIONignores the exit code entirely, and theFATAL:line is printed in both cases.Confirmed to fail on purpose — restoring the
intgives:All 9
MSstatsConverterTOPP tests pass with the fix.Scope
TriqlerConverterhad the identical copy-paste defect; it is removed in #9898. A repo-wide sweep found no other TOPP tool throwing a numeric type without a matching handler (MSFraggerAdapterthrows ints but catches them).The new
check_exit_code.cmakeis reusable for any test where the specific exit code is the assertion.🤖 Generated with Claude Code
https://claude.ai/code/session_01S7QNzj4dhRnX5htcHZFmDm
Summary by CodeRabbit
Bug Fixes
ILLEGAL_PARAMETERSwhen it cannot determine the input file type, instead of crashing.Tests