Fix locale-safe RAPL idle-power parsing - #2
Open
Rex-Eisaxt wants to merge 1 commit into
Open
Conversation
Under a comma-decimal LC_NUMERIC, bash's printf %f in freeze-idle-rapl.sh truncated bc's dot-decimal output and re-emitted it with a comma, which the Python parser then crashed on. Pin LC_NUMERIC=C in the script so numeric formatting is deterministic regardless of host locale, and make parse_rapl_idle_log accept both decimal points and decimal commas while rejecting mixed/repeated separators, negative values, and other malformed input with a clear error instead of silently defaulting to None or 0.0. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Fix locale-dependent parsing of RAPL idle-power measurements.
Under locales using a decimal comma, Bash
printfcould misinterpret decimal-point input and truncate the fractional component of the measured value. This produced inaccurate RAPL idle-power metadata.Changes
LC_NUMERIC=Clocally infreeze-idle-rapl.shso its numeric calculations and formatting are deterministic.Package Totalvalue.N/A → Nonebehavior for unavailable CPU, integrated-GPU, and DRAM domains.Validation
pytest tests/unit/test_rapl_util.py -v: 26 passedbash -n metrion/discovery/system_scanner/bare_metal/linux/freeze-idle-rapl.sh: passedThe eight failures and three errors are unchanged from the existing baseline; this change introduced no additional failures.