>From aa928d46db6902c06983237bea5ac3bebd3bfaa2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 20 Jun 2021 19:44:46 -0700 Subject: [PATCH] maint: do not set LC_ALL in at maint.mk top level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build-aux/do-release-commit-and-tag, build-aux/gendocs.sh: * build-aux/gnu-web-doc-update, build-aux/gnupload: * build-aux/vc-list-files: Set LC_ALL=C, as these tools are not i18nized and perhaps might not work in other locales (I haven’t checked). * top/maint.mk: Do not set LC_ALL at the top level. (gzip_rsyncable, tag-package, syntax-check-rules, $(sc_z_rules_)) (_sc_search_regexp, sc_avoid_if_before_free) (sc_prohibit_gnu_make_extensions, sc_error_message_warn_fatal) (sc_error_message_uppercase, sc_error_message_period) (sc_require_config_h_first, _sc_header_without_use) (sc_prohibit_always-defined_macros) (sc_prohibit_empty_lines_at_EOF, sc_prohibit_doubled_word) (sc_prohibit_undesirable_word_seq, sc_proper_name_utf8_requires_ICONV) (sc_immutable_NEWS, sc_makefile_at_at_check, sc_po_check) (sc_cross_check_PATH_usage_in_tests, alpha, beta, stable) (refresh-po, update-copyright): Set LC_ALL=C before invoking shell commands that depend on LC_ALL. --- ChangeLog | 22 ++++++++++ build-aux/do-release-commit-and-tag | 2 + build-aux/gendocs.sh | 6 ++- build-aux/gnu-web-doc-update | 2 + build-aux/gnupload | 1 + build-aux/vc-list-files | 2 + top/maint.mk | 66 ++++++++++++++++++----------- 7 files changed, 75 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index eee09cd52..7a4d63640 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2021-06-20 Paul Eggert + + maint: do not set LC_ALL in at maint.mk top level + * build-aux/do-release-commit-and-tag, build-aux/gendocs.sh: + * build-aux/gnu-web-doc-update, build-aux/gnupload: + * build-aux/vc-list-files: Set LC_ALL=C, as these tools + are not i18nized and perhaps might not work in other + locales (I haven’t checked). + * top/maint.mk: Do not set LC_ALL at the top level. + (gzip_rsyncable, tag-package, syntax-check-rules, $(sc_z_rules_)) + (_sc_search_regexp, sc_avoid_if_before_free) + (sc_prohibit_gnu_make_extensions, sc_error_message_warn_fatal) + (sc_error_message_uppercase, sc_error_message_period) + (sc_require_config_h_first, _sc_header_without_use) + (sc_prohibit_always-defined_macros) + (sc_prohibit_empty_lines_at_EOF, sc_prohibit_doubled_word) + (sc_prohibit_undesirable_word_seq, sc_proper_name_utf8_requires_ICONV) + (sc_immutable_NEWS, sc_makefile_at_at_check, sc_po_check) + (sc_cross_check_PATH_usage_in_tests, alpha, beta, stable) + (refresh-po, update-copyright): + Set LC_ALL=C before invoking shell commands that depend on LC_ALL. + 2021-06-20 Bruno Haible unistd: Avoid compilation error in C++ mode on Solaris, HP-UX, mingw. diff --git a/build-aux/do-release-commit-and-tag b/build-aux/do-release-commit-and-tag index 5605f4249..1311397c3 100755 --- a/build-aux/do-release-commit-and-tag +++ b/build-aux/do-release-commit-and-tag @@ -24,6 +24,8 @@ VERSION=2018-03-07.03 # UTC # Written by Jim Meyering +export LC_ALL=C + ME=$(basename "$0") warn() { printf '%s: %s\n' "$ME" "$*" >&2; } die() { warn "$*"; exit 1; } diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh index 1872de9d5..2204f4e40 100755 --- a/build-aux/gendocs.sh +++ b/build-aux/gendocs.sh @@ -34,6 +34,8 @@ scriptversion=2021-01-01.00 # - images are not imported in the source tarball. All the needed # formats (PDF, PNG, etc.) should be included. +export LC_ALL=C + prog=`basename "$0"` srcdir=`pwd` @@ -148,8 +150,8 @@ GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is looked for. With --docbook, the environment variables DOCBOOK2HTML, DOCBOOK2PDF, and DOCBOOK2TXT are also consulted. -By default, makeinfo and texi2dvi are run in the default (English) -locale, since that's the language of most Texinfo manuals. If you +By default, makeinfo and texi2dvi are run in the C locale, +since English is the language of most Texinfo manuals. If you happen to have a non-English manual and non-English web site, see the SETLANG setting in the source. diff --git a/build-aux/gnu-web-doc-update b/build-aux/gnu-web-doc-update index cc553f9a3..cb657a39c 100755 --- a/build-aux/gnu-web-doc-update +++ b/build-aux/gnu-web-doc-update @@ -19,6 +19,8 @@ VERSION=2021-01-09.09; # UTC # You should have received a copy of the GNU General Public License # along with this program. If not, see . +export LC_ALL=C + ME=$(basename "$0") warn() { printf '%s: %s\n' "$ME" "$*" >&2; } die() { warn "$*"; exit 1; } diff --git a/build-aux/gnupload b/build-aux/gnupload index e7822aed7..f70fe330a 100755 --- a/build-aux/gnupload +++ b/build-aux/gnupload @@ -22,6 +22,7 @@ scriptversion=2021-04-11.09; # UTC # The master copy of this file is maintained in the gnulib Git repository. # Please send bug reports and feature requests to bug-gnulib@gnu.org. +export LC_ALL=C set -e GPG=gpg diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files index cf168ea83..89da2f966 100755 --- a/build-aux/vc-list-files +++ b/build-aux/vc-list-files @@ -27,6 +27,8 @@ scriptversion=2018-03-07.03; # UTC # If there's an argument, it must be a single, "."-relative directory name. # cvsu is part of the cvsutils package: https://www.red-bean.com/cvsutils/ +export LC_ALL=C + postprocess= case $1 in --help) cat </dev/null|$(GREP) rsyncable >/dev/null \ + $(shell export LC_ALL=C;gzip --help 2>/dev/null|$(GREP) rsyncable >/dev/null \ && printf %s --rsyncable) GZIP_ENV = '--no-name --best $(gzip_rsyncable)' @@ -111,7 +111,8 @@ ifeq ($(VC),$(GIT)) this-vc-tag = v$(VERSION) this-vc-tag-regexp = v$(VERSION_REGEXP) else - tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') + tag-package = $(shell export LC_ALL=C; \ + echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') tag-this-version = $(subst .,_,$(VERSION)) this-vc-tag = $(tag-package)-$(tag-this-version) this-vc-tag-regexp = $(this-vc-tag) @@ -155,10 +156,6 @@ today = $(shell date +%Y-%m-%d) news-check-lines-spec ?= 1,10 news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)' -# Prevent programs like 'sort' from considering distinct strings to be equal. -# Doing it here saves us from having to set LC_ALL elsewhere in this file. -export LC_ALL = C - ## --------------- ## ## Sanity checks. ## ## --------------- ## @@ -167,7 +164,7 @@ ifneq ($(_gl-Makefile),) _cfg_mk := $(wildcard $(srcdir)/cfg.mk) # Collect the names of rules starting with 'sc_'. -syntax-check-rules := $(sort $(shell env LC_ALL=C $(SED) -n \ +syntax-check-rules := $(sort $(shell LC_ALL=C $(SED) -n \ 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(srcdir)/$(ME) $(_cfg_mk))) .PHONY: $(syntax-check-rules) @@ -192,7 +189,8 @@ $(sc_m_rules_): sc_z_rules_ = $(patsubst %, %.z, $(syntax-check-rules)) .PHONY: $(sc_z_rules_) $(sc_z_rules_): %.z: % - @end=$$(date +%s.%N); \ + @export LC_ALL=C; \ + end=$$(date +%s.%N); \ start=$$(cat .sc-start-$*); \ rm -f .sc-start-$*; \ $(AWK) -v s=$$start -v e=$$end \ @@ -284,6 +282,7 @@ endef define _sc_search_regexp dummy=; : so we do not need a semicolon before each use; \ + export LC_ALL=C; \ \ : Check arguments; \ test -n "$$prohibit" && test -n "$$require" \ @@ -344,7 +343,8 @@ define _sc_search_regexp endef sc_avoid_if_before_free: - @$(VC_LIST_EXCEPT) \ + @export LC_ALL=C; \ + $(VC_LIST_EXCEPT) \ | $(GREP) -v useless-if-before-free \ | xargs \ $(srcdir)/$(_build-aux)/useless-if-before-free \ @@ -440,7 +440,8 @@ sc_prohibit_gnu_make_extensions_awk_ = \ exit status; \ } sc_prohibit_gnu_make_extensions: - @if $(AWK) --version | grep GNU >/dev/null 2>&1; then \ + @export LC_ALL=C; \ + if $(AWK) --version | grep GNU >/dev/null 2>&1; then \ (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') | \ tr ' ' '\n' | \ $(SED) -ne '/Makefile/{s/\.in$$//;p;}' | \ @@ -461,7 +462,8 @@ sc_error_exit_success: # "FATAL:" should be fully upper-cased in error messages # "WARNING:" should be fully upper-cased, or fully lower-cased sc_error_message_warn_fatal: - @$(VC_LIST_EXCEPT) \ + @export LC_ALL=C; \ + $(VC_LIST_EXCEPT) \ | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null \ | $(GREP) -E '"Warning|"Fatal|"fatal' \ && { echo '$(ME): use FATAL, WARNING or warning' 1>&2; \ @@ -470,7 +472,8 @@ sc_error_message_warn_fatal: # Error messages should not start with a capital letter sc_error_message_uppercase: - @$(VC_LIST_EXCEPT) \ + @export LC_ALL=C; \ + $(VC_LIST_EXCEPT) \ | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null \ | $(GREP) -E '"[A-Z]' \ | $(GREP) -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' \ @@ -480,7 +483,8 @@ sc_error_message_uppercase: # Error messages should not end with a period sc_error_message_period: - @$(VC_LIST_EXCEPT) \ + @export LC_ALL=C; \ + $(VC_LIST_EXCEPT) \ | xargs $(GREP) -nEA2 '[^rp]error *\(' /dev/null \ | $(GREP) -E '[^."]\."' \ && { echo '$(ME): found error message ending in period' 1>&2; \ @@ -527,7 +531,8 @@ perl_config_h_first_ = \ # You must include before including any other header file. # This can possibly be via a package-specific header, if given by cfg.mk. sc_require_config_h_first: - @if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then \ + @export LC_ALL=C; \ + if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then \ files=$$($(VC_LIST_EXCEPT) | $(GREP) '\.c$$') && \ perl -n $(perl_config_h_first_) $$files || \ { echo '$(ME): the above files include some other header' \ @@ -545,6 +550,7 @@ sc_prohibit_HAVE_MBRTOWC: # re: a regular expression that matches IFF something provided by $h is used. define _sc_header_without_use dummy=; : so we do not need a semicolon before each use; \ + export LC_ALL=C; \ h_esc=`echo '[<"]'"$$h"'[">]'|$(SED) 's/\./\\\\./g'`; \ if $(VC_LIST_EXCEPT) | $(GREP) '\.c$$' > /dev/null; then \ files=$$($(GREP) -l '^# *include '"$$h_esc" \ @@ -909,7 +915,8 @@ endef # Don't define macros that we already get from gnulib header files. sc_prohibit_always-defined_macros: - @if test -d $(gnulib_dir); then \ + @export LC_ALL=C; \ + if test -d $(gnulib_dir); then \ case $$(echo all: | $(GREP) -l -f - Makefile) in Makefile);; *) \ echo '$(ME): skipping $@: you lack GNU grep' 1>&2; exit 0;; \ esac; \ @@ -1000,7 +1007,8 @@ require_exactly_one_NL_at_EOF_ = \ } \ END { exit defined $$fail } sc_prohibit_empty_lines_at_EOF: - @$(VC_LIST_EXCEPT) \ + @export LC_ALL=C; \ + $(VC_LIST_EXCEPT) \ | xargs perl -le '$(require_exactly_one_NL_at_EOF_)' \ || { echo '$(ME): empty line(s) or no newline at EOF' 1>&2; \ exit 1; } \ @@ -1047,7 +1055,8 @@ prohibit_doubled_word_ = \ ignore_doubled_word_match_RE_ ?= ^$$ sc_prohibit_doubled_word: - @$(VC_LIST_EXCEPT) \ + @export LC_ALL=C; \ + $(VC_LIST_EXCEPT) \ | xargs perl -n -0777 $(prohibit_doubled_word_) \ | $(GREP) -vE '$(ignore_doubled_word_match_RE_)' \ | $(GREP) . \ @@ -1076,7 +1085,8 @@ prohibit_undesirable_word_seq_ = \ ignore_undesirable_word_sequence_RE_ ?= ^$$ sc_prohibit_undesirable_word_seq: - @$(VC_LIST_EXCEPT) \ + @export LC_ALL=C; \ + $(VC_LIST_EXCEPT) \ | xargs perl -n -0777 $(prohibit_undesirable_word_seq_) \ | $(GREP) -vE '$(ignore_undesirable_word_sequence_RE_)' \ | $(GREP) . \ @@ -1113,7 +1123,8 @@ sc_prohibit_test_double_equal: # definition of LDADD from the appropriate Makefile.am and exits 0 # when it contains "ICONV". sc_proper_name_utf8_requires_ICONV: - @progs=$$($(VC_LIST_EXCEPT) \ + @export LC_ALL=C; \ + progs=$$($(VC_LIST_EXCEPT) \ | xargs $(GREP) -l 'proper_name_utf8 ''("'); \ if test "x$$progs" != x; then \ fail=0; \ @@ -1154,7 +1165,8 @@ NEWS_hash = \ # Ensure that we don't accidentally insert an entry into an old NEWS block. sc_immutable_NEWS: - @if test -f $(srcdir)/NEWS; then \ + @export LC_ALL=C; \ + if test -f $(srcdir)/NEWS; then \ test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \ { echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \ fi @@ -1180,7 +1192,8 @@ update-NEWS-hash: NEWS # setting this to ' && !/PRAGMA_SYSTEM_HEADER/'. _makefile_at_at_check_exceptions ?= sc_makefile_at_at_check: - @perl -ne '/\@\w+\@/' \ + @export LC_ALL=C; \ + perl -ne '/\@\w+\@/' \ -e ' && !/(\w+)\s+=.*\@\1\@$$/' \ -e ''$(_makefile_at_at_check_exceptions) \ -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}' \ @@ -1233,7 +1246,8 @@ po_file ?= $(srcdir)/po/POTFILES.in generated_files ?= $(srcdir)/lib/*.[ch] _gl_translatable_string_re ?= \b(N?_|gettext *)\([^)"]*("|$$) sc_po_check: - @if test -f $(po_file); then \ + @export LC_ALL=C; \ + if test -f $(po_file); then \ $(GREP) -E -v '^(#|$$)' $(po_file) \ | $(GREP) -v '^src/false\.c$$' | sort > $@-1; \ { $(VC_LIST_EXCEPT); echo $(generated_files); } \ @@ -1303,7 +1317,8 @@ _hv_regex_weak ?= ^ *\. .*/init\.sh" # Fix syntax-highlighters " _hv_regex_strong ?= ^ *\. "\$${srcdir=\.}/init\.sh" sc_cross_check_PATH_usage_in_tests: - @if test -f $(_hv_file); then \ + @export LC_ALL=C; \ + if test -f $(_hv_file); then \ $(GREP) -l 'VERSION mismatch' $(_hv_file) >/dev/null \ || { echo "$@: skipped: no such file: $(_hv_file)" 1>&2; \ exit 0; }; \ @@ -1510,7 +1525,8 @@ check: $(gl_public_submodule_commit) .PHONY: alpha beta stable release ALL_RECURSIVE_TARGETS += alpha beta stable alpha beta stable: $(local-check) writable-files $(submodule-checks) - $(AM_V_GEN)test $@ = stable \ + $(AM_V_GEN)export LC_ALL=C; \ + test $@ = stable \ && { echo $(VERSION) | $(GREP) -E '^[0-9]+(\.[0-9]+)+$$' \ || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\ || : @@ -1624,6 +1640,7 @@ PO_DOMAIN ?= $(PACKAGE) POURL = https://translationproject.org/latest/$(PO_DOMAIN)/ PODIR ?= po refresh-po: + export LC_ALL=C; \ rm -f $(PODIR)/*.po && \ echo "$(ME): getting translations into po (please ignore the robots.txt ERROR 404)..." && \ wget --no-verbose --directory-prefix $(PODIR) --no-directories --recursive --level 1 --accept .po --accept .po.1 $(POURL) && \ @@ -1652,6 +1669,7 @@ update-copyright-env ?= # in the file .x-update-copyright. .PHONY: update-copyright update-copyright: + export LC_ALL=C; \ $(AM_V_GEN)$(GREP) -l -w Copyright \ $$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \ | $(update-copyright-env) xargs $(srcdir)/$(_build-aux)/$@ -- 2.30.2