diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-14 22:29:16 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-14 22:29:16 +0300 |
| commit | cbfedd8f51d605ae8851b767ac21c00b877c33b7 (patch) | |
| tree | 7aa9549eb5d2ac628c06d18b636ba0775c41ecb8 /src/lib | |
| parent | 5555b8e996dc42d319c4ef7115307d10a25de7f3 (diff) | |
pm0 pin leaderboard sort collation for reproducible output
Review follow-up: _stats_keys_by_count_desc sorted the count tie-break
under the caller's locale, so the generated stats page could differ
byte-for-byte across locales/machines. Pin the sort with LC_ALL=C to keep
the static output reproducible, consistent with the project's seeded /
deterministic generation behavior.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/stats.source.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/stats.source.sh b/src/lib/stats.source.sh index f4f2e1f..72b2d26 100644 --- a/src/lib/stats.source.sh +++ b/src/lib/stats.source.sh @@ -658,13 +658,15 @@ _stats_render_camera_section() { # Print an array's keys ordered by descending count (ties broken by key) so the # busiest bucket leads. Used for the leaderboard and other count-ranked sections. +# LC_ALL=C pins the tie-break collation so the generated page is byte-identical +# across locales/machines (reproducible static output). _stats_keys_by_count_desc() { local -n counts_ref="$1"; shift local key for key in "${!counts_ref[@]}"; do printf '%d\t%s\n' "${counts_ref[$key]}" "$key" - done | sort -t $'\t' -k1,1nr -k2,2 | cut -f2- + done | LC_ALL=C sort -t $'\t' -k1,1nr -k2,2 | cut -f2- } # Render a histogram section using an explicit bucket order (e.g. apertures from |
