core-lightning/tools/check-setup_locale.sh
William Casarin f8fa4213f1 tools: use /usr/bin/env bash instead of /bin/bash
These commands fail on systems that do not have bash under /bin

Signed-off-by: William Casarin <jb55@jb55.com>
2018-07-24 00:25:43 +00:00

17 lines
542 B
Bash
Executable File

#!/usr/bin/env bash
EXIT_CODE=0
for FILE in $(git grep -lE 'int main\(' | grep -vE '^ccan/'); do
if ! grep -q 'setup_locale();' "${FILE}"; then
echo "main(...) in ${FILE} does not call setup_locale() (see common/utils.h)"
EXIT_CODE=1
fi
done
if [[ ${EXIT_CODE} != 0 ]]; then
echo
echo "setup_locale() forces the use of the POSIX C locale. By using the"
echo "POSIX C locale we avoid a class of localization related parsing bugs"
echo "that can be very tricky to isolate and fix."
fi
exit ${EXIT_CODE}