bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* two ill effects of maint.mk
@ 2021-06-10 15:41 Bruno Haible
  2021-06-10 16:09 ` Paul Eggert
  2021-06-20 22:15 ` Bruno Haible
  0 siblings, 2 replies; 10+ messages in thread
From: Bruno Haible @ 2021-06-10 15:41 UTC (permalink / raw)
  To: bug-gnulib

The Gnulib module 'maintainer-makefile' has two bad effects on the packages
that import it. When GNU make is used (i.e. practically all GNU systems):

1) It executes the compilation of files (in lib/, src/, etc.) in the C locale.
Thus, even if the user who builds the program has a preferred language (other
than English) and GCC is built with enabled NLS, the 'maintainer-makefile'
module forces English diagnostics onto the user.

2) It executes the unit tests ("make check-recursive", invoked by "make check")
in the C locale. Thus, although most users nowadays execute programs in an
UTF-8 locale (namely, the one set by their distro or desktop environment),
the test suite only ever gets run in the C locale.

This significantly reduces the value of the test suite. For example, GNU m4
has a unit test for every built-in function, and m4 1.4.19 introduced a
regression in all locales which use a comma as decimal separator (this
includes French and German locales). THE TEST SUITE did not catch it when
run by the maintainer. It's only by building the package on DragonFly BSD
that I noticed the regression (more than a week after the release, since
obviously few GNU contributors use a non-GNU make).

The bad effects affect
  * the developers who work from a git checkout + all users of the tarball
    for packages that include GNUmakefile and maint.mk in their tarballs,
    e.g. GNU findutils, GNU guile, GNU gzip, GNU libidn, GNU m4, GNU patch,
    GNU poke.
  * the developers who work from a git checkout only, for the other packages
    that use this module, e.g. GNU emacs, GNU gettext.

In the second case, the testers of a pretest tarballs have a chance to discover
the test failures that were hidden from the maintainers. In the first case,
it's even worse, as only the use of non-GNU make can uncover the bugs.

The line that causes these bad effects is in maint.mk:
  export LC_ALL = C

Probably this line made sense when maint.mk was still called Makefile.maint
and was independent. But since 2006 (or earlier) it is being included via
GNUmakefile.

Bruno



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: two ill effects of maint.mk
  2021-06-10 15:41 two ill effects of maint.mk Bruno Haible
@ 2021-06-10 16:09 ` Paul Eggert
  2021-06-10 17:12   ` Bruno Haible
  2021-06-20 22:15 ` Bruno Haible
  1 sibling, 1 reply; 10+ messages in thread
From: Paul Eggert @ 2021-06-10 16:09 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

On 6/10/21 8:41 AM, Bruno Haible wrote:
> The bad effects affect
>    * the developers who work from a git checkout + all users of the tarball
>      for packages that include GNUmakefile and maint.mk in their tarballs,
>      e.g. GNU findutils, GNU guile, GNU gzip, GNU libidn, GNU m4, GNU patch,
>      GNU poke.
>    * the developers who work from a git checkout only, for the other packages
>      that use this module, e.g. GNU emacs, GNU gettext.

As I vaguely recall, that "export LC_ALL = C" was added so that builds 
were reproducible, which is a plus. Perhaps we could try to get the best 
of both worlds, by changing it to set LC_ALL to an English UTF-8 locale 
if available, and the C locale if not. Failing that, I suppose it'd be 
OK to simply remove the line and put up with less-reproducible builds.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: two ill effects of maint.mk
  2021-06-10 16:09 ` Paul Eggert
@ 2021-06-10 17:12   ` Bruno Haible
  2021-06-10 17:14     ` Bruno Haible
  2021-06-10 17:21     ` Paul Eggert
  0 siblings, 2 replies; 10+ messages in thread
From: Bruno Haible @ 2021-06-10 17:12 UTC (permalink / raw)
  To: Paul Eggert; +Cc: bug-gnulib

Paul Eggert wrote:
> As I vaguely recall, that "export LC_ALL = C" was added so that builds 
> were reproducible, which is a plus.

People who want reproducible builds can run

  LC_ALL make && LC_ALL make check

if they like to. This is no reason to significantly reduce the test suite's
effectiveness for *all* users.

> Perhaps we could try to get the best 
> of both worlds, by changing it to set LC_ALL to an English UTF-8 locale 
> if available, and the C locale if not.

This still would prevent the GNU m4 test suite from producing a test failure
for the aforementioned m4-1.4.19 regression (because the English locale
has less variation regarding the decimal separator than the whole set
of possible locales).

Bruno



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: two ill effects of maint.mk
  2021-06-10 17:12   ` Bruno Haible
@ 2021-06-10 17:14     ` Bruno Haible
  2021-06-10 17:21     ` Paul Eggert
  1 sibling, 0 replies; 10+ messages in thread
From: Bruno Haible @ 2021-06-10 17:14 UTC (permalink / raw)
  To: Paul Eggert; +Cc: bug-gnulib

>   LC_ALL make && LC_ALL make check

I meant:  LC_ALL=C make && LC_ALL=C make check



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: two ill effects of maint.mk
  2021-06-10 17:12   ` Bruno Haible
  2021-06-10 17:14     ` Bruno Haible
@ 2021-06-10 17:21     ` Paul Eggert
  2021-06-10 17:34       ` Bruno Haible
  1 sibling, 1 reply; 10+ messages in thread
From: Paul Eggert @ 2021-06-10 17:21 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

On 6/10/21 10:12 AM, Bruno Haible wrote:
>> Perhaps we could try to get the best
>> of both worlds, by changing it to set LC_ALL to an English UTF-8 locale
>> if available, and the C locale if not.
> This still would prevent the GNU m4 test suite from producing a test failure
> for the aforementioned m4-1.4.19 regression (because the English locale
> has less variation regarding the decimal separator than the whole set
> of possible locales).

True.

How about this idea instead? Have the GNUmakefile code run the 'locale' 
command and include its output in the 'make' output. That way, the 
'make' transcript would indicate this particular detail of the test 
environment.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: two ill effects of maint.mk
  2021-06-10 17:21     ` Paul Eggert
@ 2021-06-10 17:34       ` Bruno Haible
  2021-06-10 17:38         ` Paul Eggert
  0 siblings, 1 reply; 10+ messages in thread
From: Bruno Haible @ 2021-06-10 17:34 UTC (permalink / raw)
  To: Paul Eggert; +Cc: bug-gnulib

Paul Eggert wrote:
> How about this idea instead? Have the GNUmakefile code run the 'locale' 
> command and include its output in the 'make' output. That way, the 
> 'make' transcript would indicate this particular detail of the test 
> environment.

It would make sense to have this info in the generated test-suite.log,
because people who report test failures frequently send this file
as part of their bug report.

Other than that, e.g. for "make [all]" and "make install", this added
info is useless.

So, I think your suggestion should be implemented in Automake's
test suite drivers, not in maint.mk.

Bruno



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: two ill effects of maint.mk
  2021-06-10 17:34       ` Bruno Haible
@ 2021-06-10 17:38         ` Paul Eggert
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Eggert @ 2021-06-10 17:38 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

On 6/10/21 10:34 AM, Bruno Haible wrote:
> I think your suggestion should be implemented in Automake's
> test suite drivers, not in maint.mk.

Not everybody who uses Gnulib uses Automake. But I take your point that 
the 'locale' output is better localized to 'make check', which is 
something that could be done in a later patch.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: two ill effects of maint.mk
  2021-06-10 15:41 two ill effects of maint.mk Bruno Haible
  2021-06-10 16:09 ` Paul Eggert
@ 2021-06-20 22:15 ` Bruno Haible
  2021-06-21  2:47   ` Paul Eggert
  1 sibling, 1 reply; 10+ messages in thread
From: Bruno Haible @ 2021-06-20 22:15 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Simon Josefsson, Bernhard Voelker, Akim Demaille

> The line that causes these bad effects is in maint.mk:
>   export LC_ALL = C
> 
> Probably this line made sense when maint.mk was still called Makefile.maint
> and was independent. But since 2006 (or earlier) it is being included via
> GNUmakefile.

Can someone please deal with this? Simon? Akim? Berny? Not always me :-)

Bruno



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: two ill effects of maint.mk
  2021-06-20 22:15 ` Bruno Haible
@ 2021-06-21  2:47   ` Paul Eggert
  2021-06-21  8:52     ` Bruno Haible
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Eggert @ 2021-06-21  2:47 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib; +Cc: Simon Josefsson, Bernhard Voelker, Akim Demaille

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

On 6/20/21 3:15 PM, Bruno Haible wrote:
> Can someone please deal with this? Simon? Akim? Berny? Not always me :-)

Something like the attached patch perhaps? (I haven't tested or 
installed it.)

[-- Attachment #2: 0001-maint-do-not-set-LC_ALL-in-at-maint.mk-top-level.patch --]
[-- Type: text/x-patch, Size: 15897 bytes --]

From aa928d46db6902c06983237bea5ac3bebd3bfaa2 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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  <eggert@cs.ucla.edu>
+
+	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  <bruno@clisp.org>
 
 	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 <https://www.gnu.org/licenses/>.
 
+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 <<EOF
diff --git a/top/maint.mk b/top/maint.mk
index ae3a8170a..eac9eb374 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -53,7 +53,7 @@ member-check =								\
 # Do not save the original name or timestamp in the .tar.gz file.
 # Use --rsyncable if available.
 gzip_rsyncable := \
-  $(shell gzip --help 2>/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 <config.h> 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: two ill effects of maint.mk
  2021-06-21  2:47   ` Paul Eggert
@ 2021-06-21  8:52     ` Bruno Haible
  0 siblings, 0 replies; 10+ messages in thread
From: Bruno Haible @ 2021-06-21  8:52 UTC (permalink / raw)
  To: Paul Eggert; +Cc: bug-gnulib

Hi Paul,

> > Can someone please deal with this? Simon? Akim? Berny? Not always me :-)
> 
> Something like the attached patch perhaps? (I haven't tested or 
> installed it.)

Thanks for working on this. Yes, this will revert the ill effects on
"make" and "make check".

> --- 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`
 
To make it work in other shells than bash-compatible shells, I think
it's better to write

  LC_ALL=C; export LC_ALL

> --- 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 <https://www.gnu.org/licenses/>.
>  
> +export LC_ALL=C
> +
>  ME=$(basename "$0")
>  warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
>  die() { warn "$*"; exit 1; }

Likewise.

> --- 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 <<EOF

Likewise.

Similarly in many places of maint.mk.

> @@ -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)

Since 'echo' is not locale dependent, it's easier to write this as

  tag-package = $(shell echo "$(PACKAGE)" | LC_ALL=C tr '[:lower:]' '[:upper:]')

> @@ -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)/$@

The $(AM_V_GEN) is the thing that turns off verbosity. Therefore the
added statement should go after it, not before it.

> 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

gnupload works fine in non-English locales. (I use it occasionally in German
locale.) Therefore this part can be omitted.

Bruno



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-21  8:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 15:41 two ill effects of maint.mk Bruno Haible
2021-06-10 16:09 ` Paul Eggert
2021-06-10 17:12   ` Bruno Haible
2021-06-10 17:14     ` Bruno Haible
2021-06-10 17:21     ` Paul Eggert
2021-06-10 17:34       ` Bruno Haible
2021-06-10 17:38         ` Paul Eggert
2021-06-20 22:15 ` Bruno Haible
2021-06-21  2:47   ` Paul Eggert
2021-06-21  8:52     ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).