From 08a36cdd2fc13694ee9392d4b112b003662040a1 Mon Sep 17 00:00:00 2001 From: Jim Huang Date: Wed, 19 Mar 2025 12:26:53 +0800 Subject: [PATCH] Enforce consistent dictionary sorting Use byte-wise sorting to maintain consistent ordering across platforms. Previously, locale-dependent sorting on macOS caused mixed-case entries like "AddressSanitizer" to appear out of order relative to lowercase entries like "acct", due to differences in locale collation rules. Change-Id: I7ec89957da8ec42ef0e570fd94a02d2aee24e637 --- scripts/aspell-pws | 15 --------------- scripts/pre-commit.hook | 4 ++-- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/scripts/aspell-pws b/scripts/aspell-pws index 584cdc552..4ce46d011 100644 --- a/scripts/aspell-pws +++ b/scripts/aspell-pws @@ -168,7 +168,6 @@ kexec lchown ld leetcode -LeetCode lf lhs lib @@ -181,12 +180,10 @@ lld lldb llu llx -llX longjmp lseek lu lx -lX macOS madvise malloc @@ -230,7 +227,6 @@ pEo perf pEs pf -pF pg pGg pGp @@ -239,25 +235,16 @@ phC phD phN piSb -pISb piSc -pISc piSf -pISf piSh -pISh piSl -pISl piSn -pISn piSpc -pISpc pK pm -pM pMF pmR -pMR pNF posix pr @@ -270,11 +257,9 @@ preprocessor printf proc ps -pS pSR ptrace pUl -pUL putc putchar putenv diff --git a/scripts/pre-commit.hook b/scripts/pre-commit.hook index 244f93fab..fa2170766 100755 --- a/scripts/pre-commit.hook +++ b/scripts/pre-commit.hook @@ -223,11 +223,11 @@ if [ "${#SHELL_FILES[@]}" -gt 0 ]; then fi ASPELL_DICT_FILE='scripts/aspell-pws' -if ! tail -n +2 $ASPELL_DICT_FILE | sort -cdu; then +if ! LC_ALL=C tail -n +2 $ASPELL_DICT_FILE | sort -f -cdu; then throw '%s\n%s\n%s' \ 'Aspell dictionary is unsorted or contains duplicated entries.' \ 'Make sure that by using:' \ - " tail -n +2 $ASPELL_DICT_FILE | sort -du" + " tail -n +2 $ASPELL_DICT_FILE | sort -f -du" fi # Show insertion and deletion counts.