From d18b7698c78bac2bb7af552784f0d309dc398b24 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 12 Sep 2012 09:34:44 +0000 Subject: [PATCH] build: check the source code with LANG=C to avoid locale-related parse discrepancies. --- build/check-source.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build/check-source.sh b/build/check-source.sh index 3b0104c8..402e6f4b 100755 --- a/build/check-source.sh +++ b/build/check-source.sh @@ -118,12 +118,12 @@ for file in $FILES; do fi # Check for trailing spaces - nspaces="$(sed 's/.*[^ \t]//' "$file" | tr -cd '\t ' | wc -c)" + nspaces="$(LANG=C sed 's/.*[^ \t]//' "$file" | tr -cd '\t ' | wc -c)" total_spaces="$(($total_spaces + $nspaces))" if [ "$nspaces" -gt 0 ]; then clean=false if [ "$fix" = true ]; then - sed -i 's/[[:space:]][[:space:]]*$//g' "$file" + LANG=C sed -i 's/[[:space:]][[:space:]]*$//g' "$file" info "$file has $nspaces trailing spaces" else error "$file has $nspaces trailing spaces" @@ -136,7 +136,7 @@ for file in $FILES; do if [ "$ntabs" -gt 0 ]; then clean=false if [ "$fix" = true ]; then - sed -i 's/\t/ /g' "$file" + LANG=C sed -i 's/\t/ /g' "$file" info "$file has $ntabs tabs" else error "$file has $ntabs tabs" @@ -172,6 +172,7 @@ EOF if [ "$total_tabs" -gt 0 ]; then info " - fixed $total_tabs tabs" fi + info "re-run with -c to commit fixes" else # OR: warn about how to fix errors info "re-run with -w to fix errors"