Fix empty strerror text in error messages on musl#111620
Open
thevar1able wants to merge 3 commits into
Open
Conversation
`errnoToString` selected the GNU variant of `strerror_r` whenever
_GNU_SOURCE was defined, formatting its return value as the message.
musl provides only the POSIX variant (returning `int`) even when
_GNU_SOURCE is defined, so every error message rendered the return
code instead of the text: `Cannot open file ...: , errno: 2,
strerror: 0`. This failed `test_dictionaries_update_and_reload` in the
`amd_llvm_coverage` integration jobs, which greps for `No such file`.
Dispatch on the actual return type of `strerror_r` via overloads
instead of feature-test macros, the same trick as `Poco::Error`.
Verified on a static musl binary ("No such file or directory") and on
glibc (unchanged, including the "Unknown error N" fallback).
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109239&sha=8ed85c44cd7e4afbef1f826ab59b26d3e540828e&name_0=PR
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Workflow [PR], commit [95dea82] AI ReviewSummaryThis PR changes PR Metadata
Final Verdict
|
thevar1able
marked this pull request as ready for review
July 23, 2026 14:33
evillique
approved these changes
Jul 23, 2026
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.
Fix empty
strerrortext in error messages on musl.errnoToStringselected the GNU variant ofstrerror_rwhenever_GNU_SOURCEwas defined and formatted its return value as the message. musl provides only the POSIX variant (returningint) even when_GNU_SOURCEis defined, so every error message rendered the return code instead of the text:Cannot open file ...: , errno: 2, strerror: 0.Dispatch on the actual return type of
strerror_rvia overloads instead of feature-test macros (the same trick asPoco::Error). Verified on a static musl binary (No such file or directory) and on glibc (unchanged, including theUnknown error Nfallback).This failed
test_dictionaries_update_and_reloadin theamd_llvm_coverageintegration jobs, which greps forNo such file.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109239&sha=8ed85c44cd7e4afbef1f826ab59b26d3e540828e&name_0=PR
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed error messages on musl-based builds rendering an empty/numeric
strerrorvalue instead of the human-readable text (e.g.strerror: 0instead ofNo such file or directory), caused byerrnoToStringmis-detecting thestrerror_rvariant.