You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@yetus.apache.org by aw...@apache.org on 2016/04/17 19:14:54 UTC
[06/23] yetus git commit: YETUS-359. shellcheck needs UTF-8 protection
YETUS-359. shellcheck needs UTF-8 protection
Signed-off-by: Sean Busbey <bu...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/dc63c866
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/dc63c866
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/dc63c866
Branch: refs/heads/YETUS-156
Commit: dc63c866b7a36d99307eee67b9d6c04e1d7aa10b
Parents: 14cae37
Author: Allen Wittenauer <aw...@apache.org>
Authored: Wed Apr 13 08:06:19 2016 -0700
Committer: Allen Wittenauer <aw...@apache.org>
Committed: Sun Apr 17 10:12:25 2016 -0700
----------------------------------------------------------------------
precommit/test-patch.d/shellcheck.sh | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/yetus/blob/dc63c866/precommit/test-patch.d/shellcheck.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/shellcheck.sh b/precommit/test-patch.d/shellcheck.sh
index f3d8fbd..e9a7e15 100755
--- a/precommit/test-patch.d/shellcheck.sh
+++ b/precommit/test-patch.d/shellcheck.sh
@@ -40,10 +40,38 @@ function shellcheck_filefilter
function shellcheck_precheck
{
+ declare langs
+
if ! verify_command "shellcheck" "${SHELLCHECK}"; then
add_vote_table 0 shellcheck "Shellcheck was not available."
delete_test shellcheck
fi
+
+ if [[ -z "${LANG}" ]]; then
+ langs=$(locale -a)
+ if [[ ${langs} =~ C.UTF-8 ]]; then
+ yetus_error "WARNING: shellcheck needs UTF-8 locale support. Forcing C.UTF-8."
+ export LANG=C.UTF-8
+ export LC_ALL=C.UTF-8
+ elif [[ ${langs} =~ en_US.UTF-8 ]]; then
+ yetus_error "WARNING: shellcheck needs UTF-8 locale support. Forcing en_US.UTF-8."
+ export LANG=en_US.UTF-8
+ export LC_ALL=en_US.UTF-8
+ else
+ for i in ${langs}; do
+ if [[ "${i}" =~ UTF-8 ]]; then
+ yetus_error "WARNING: shellcheck needs UTF-8 locale support. Forcing ${i}."
+ export LANG="${i}"
+ export LC_ALL="${i}"
+ break
+ fi
+ done
+ fi
+ fi
+
+ if [[ ! "${LANG}" =~ UTF-8 ]]; then
+ yetus_error "WARNING: shellcheck may fail without UTF-8 locale setting."
+ fi
}
function shellcheck_private_findbash