From cbfedd8f51d605ae8851b767ac21c00b877c33b7 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 14 Jun 2026 22:29:16 +0300 Subject: 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 --- src/lib/stats.source.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lib') 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 -- cgit v1.2.3