Commit 4868dfd5 authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Klaus Aehlig

check-man-warnings: use C.UTF-8 and set LC_ALL

check-man-warnings currently partially forces the en_US.UTF-8 locale by
setting LANG. This implicitly assumes that the locale exists, which
might not be the case when building e.g. in chroot environments. If the
locale does not exist, then check-man-warnings fails with the following
message:

 col: Invalid or incomplete multibyte or wide character
 man: command exited with status 1: col -b -p -x

Some distributions (at least Debian and derivatives) ship an embedded
C.UTF-8 locale with full unicode support. We prefer using C.UTF-8 if it
is available and fall back to en_US.UTF-8 otherwise. We also set LC_ALL
to the same locale, because if they remain unset (i.e. "C"), the same
behavior happens.
Signed-off-by: default avatarApollon Oikonomopoulos <apoikos@gmail.com>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent f29dde95
......@@ -20,7 +20,13 @@
set -e
! LANG=en_US.UTF-8 MANWIDTH=80 \
if locale -a | grep -qF 'C.UTF-8'; then
loc="C.UTF-8"
else
loc="en_US.UTF-8"
fi
! LANG="$loc" LC_ALL="$loc" MANWIDTH=80 \
man --warnings --encoding=utf8 --local-file "$1" 2>&1 >/dev/null | \
grep -v -e "cannot adjust line" -e "can't break line" | \
grep .
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment