Repository navigation
fix: handle unwritable $HOME in UpdateCheck gracefully - #9075
timosachsenberg merged 6 commits into
Conversation
UpdateCheck::run() calls fs::create_directories() with the throwing overload to create $HOME/.config/OpenMS. In container environments where $HOME=/ (not writable), this crashes all TOPP tools with: terminate called after throwing an instance of 'std::filesystem::filesystem_error': cannot create directories: Permission denied [//.config/OpenMS] Use the std::error_code overload (consistent with File.cpp lines 241, 316) and skip the update check gracefully when the config directory cannot be created. Fixes OpenMS#9074 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughUpdateCheck::run now uses the non-throwing std::filesystem::create_directories overload and returns early with a logged warning if directory creation fails. The Docker Changes
Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openms/source/SYSTEM/UpdateCheck.cpp (1)
90-92: Use\ninstead ofstd::endlin the new warning log.Line 92 introduces
std::endl; please switch to'\n'to match project C++ performance/style rules.Proposed patch
- OPENMS_LOG_WARN << "Warning: Could not create config directory '" - << config_path << "': " << ec.message() - << ". Skipping update check." << std::endl; + OPENMS_LOG_WARN << "Warning: Could not create config directory '" + << config_path << "': " << ec.message() + << ". Skipping update check.\n";As per coding guidelines: "Avoid
std::endl; prefer\nfor performance in C++".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/SYSTEM/UpdateCheck.cpp` around lines 90 - 92, Replace the use of std::endl in the warning logging statement so it uses '\n' instead; specifically update the OPENMS_LOG_WARN call that prints config_path and ec.message() to terminate with '\n' instead of std::endl to follow project C++ style/performance rules.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/openms/source/SYSTEM/UpdateCheck.cpp`:
- Around line 90-92: Replace the use of std::endl in the warning logging
statement so it uses '\n' instead; specifically update the OPENMS_LOG_WARN call
that prints config_path and ec.message() to terminate with '\n' instead of
std::endl to follow project C++ style/performance rules.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8f048cca-6b58-44ca-b6a3-f54dd3b2b271
📒 Files selected for processing (1)
src/openms/source/SYSTEM/UpdateCheck.cpp
…Check Two complementary fixes for the crash when $HOME is not writable: 1. dockerfiles/Dockerfile: Set ENV HOME=/tmp in the tools-thirdparty stage so containers always have a writable home directory for config files (.config/OpenMS/*.ver). 2. src/openms/source/SYSTEM/UpdateCheck.cpp: Use the non-throwing std::error_code overload of create_directories (consistent with File.cpp) and skip the update check gracefully when the config directory cannot be created. This provides defense-in-depth for environments where $HOME is overridden to a non-writable path. Fixes OpenMS#9074 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Follow the pattern from quantms-rescoring: create a dedicated writable directory and set HOME to it, rather than using /tmp. This ensures .config/OpenMS and other home-relative paths work correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Julianus noted the HOME setting should be in the tools stage (not just tools-thirdparty) since the tools image is also published separately. Docker ENV directives propagate through FROM inheritance, so setting it in tools covers tools, tools-thirdparty, and test stages. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add two missing changelog entries for the OpenMS 3.6.0 under-development section: - General: Fix UpdateCheck crash when $HOME is not writable in containers (#9075) - TOPP tools / MSstatsConverter: new -remove_shared_peptides parameter (#9068) Co-authored-by: Copilot <[email protected]>
Add two missing changelog entries for the OpenMS 3.6.0 under-development section: - General: Fix UpdateCheck crash when $HOME is not writable in containers (#9075) - TOPP tools / MSstatsConverter: new -remove_shared_peptides parameter (#9068) Co-authored-by: GitHub Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Timo Sachsenberg <[email protected]>
… external CMakeLists to LF - Remove external tracker/issue references (#9460 §1, #9452, #9204, #9075, Lxx) from added test comments; comments now describe the durable behavior under test. - Normalize src/tests/external/CMakeLists.txt to LF (matches .gitattributes eol=lf), which also clears the trailing-whitespace (CR) that git diff --check flagged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…only config, downstream Qt contract (#9460) (#9603) * [TEST] Infrastructure (§1): non-ASCII paths, exit-code mapping, read-only config, downstream Qt contract (#9460) Close the remaining §1 [AUTO] gaps of the OpenMS 3.6.0 pre-release testing plan (#9460). Tests only. - PathUtils_test: Windows-only UNC + ANSI-codepage to_path() cases under #ifdef _WIN32 (L35). - TOPP FileConverter: read AND write through a non-ASCII (UTF-8) path, materialized at test time via `cmake -E copy` (the permanent #9452 regression) (L37). - File_test: pin the "siblings only, no PATH fallback" contract of findSiblingTOPPExecutable (its TODO / #9204) plus a negative findExecutable case (L40). - THIRDPARTY: assert a present-but-failing external program returns EXTERNAL_PROGRAM_ERROR (9), distinct from the EXTERNAL_PROGRAM_NOTFOUND (14) of a missing binary (L41). - UpdateCheck_test (new): an unwritable config dir logs a warning and returns gracefully -- no network request, no crash (the $HOME-not-writable fix #9075) (L45). - external/: a second downstream target that finds Qt6 itself and links Qt6::Core, proving OpenMS exports no transitive Qt6 (L56). Co-Authored-By: Claude Opus 4.8 <[email protected]> * [TEST] Make CometAdapter failing-executable test portable * [TEST] Address review: drop tracker IDs from test comments, normalize external CMakeLists to LF - Remove external tracker/issue references (#9460 §1, #9452, #9204, #9075, Lxx) from added test comments; comments now describe the durable behavior under test. - Normalize src/tests/external/CMakeLists.txt to LF (matches .gitattributes eol=lf), which also clears the trailing-whitespace (CR) that git diff --check flagged. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
Summary
Fix crash in
UpdateCheck::run()when$HOME/.config/OpenMScannot be created (e.g., in containers where$HOME=/).Problem
All TOPP tools crash with exit code 134 when running in container environments where
$HOMEpoints to a non-writable directory:This is caused by
UpdateCheck.cppline 86 using the throwing overload ofstd::filesystem::create_directories()with no error handling.Fix
Use the
std::error_codeoverload (consistent withFile.cpplines 241, 316) and skip the update check gracefully when the config directory cannot be created.The update check is optional functionality — a failure to write the version file should never crash the tool.
Impact
This fix unblocks CI pipelines for downstream tools (e.g., quantms, bigbio/quantms#691) that run OpenMS in containerized environments.
Fixes #9074
Test plan
$HOMEis writable)$HOME=/(currently crashes)🤖 Generated with Claude Code
Summary by CodeRabbit