Repository navigation
Read EPOCHREALTIME the same way under a comma-decimal locale - #15213
Merged
Merged
Conversation
Bash writes it with the locale's decimal separator, so stripping a dot left a comma behind in the benchmark clocks, and awk read the disk speed test's timestamps as whole seconds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
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.
What changed
Bash writes
$EPOCHREALTIMEwith the locale's decimal separator. Under da_DK, de_DE or fr_FR it reads1791832819,402790, not1791832819.402790. Three commands assumed a dot:omarchy-dev-benchmark-cliandomarchy-dev-benchmark-theme-switcherbuilt microseconds with${EPOCHREALTIME/./}. That left the comma in, so the$(( ))arithmetic on it went wrong: the comma operator, or an invalid-octal error when the fraction starts with 0 and contains an 8 or 9. Both now use${EPOCHREALTIME//[!0-9]/}, asomarchy-system-sleep-lockalready does.omarchy-disk-speedtesthanded$EPOCHREALTIMEto awk, which only takes a dot as the decimal point. Each timestamp therefore became a whole second and skewed the steady-state rate. It now swaps the comma for a dot first.Found while reviewing #15192, which had the same bug and fixes it there.
Tests
New
test/shell.d/epochrealtime-locale-test.shbuilds a da_DK locale withlocaledefin a temp dir, confirms bash writes a comma there, and runs both benchmarks'now_usunder it. It skips whenlocaledefcan't build the locale. I mutation-checked it: quattro'snow_usprints1791833200,519263and fails. The disk speed test needs a block device and a minute of I/O, so it has no test here.🤖 Generated with Claude Code