Subject: bug#26514: make check - t/gettext-macros.sh hangs

From: Bruno Haible <[email-masked]>
Date: Sat, 15 Apr 2017 10:26:48 +0200

Hi,

On a Ubuntu 16.04 system (which happens to have the package 'gettext'
installed but the package 'autopoint' not installed) "make check"
of Automake 1.15 hangs:

$ ./configure
$ make
$ make check 2>&1 | tee log3
...
gcj6: skipped test: GNU Java compiler unavailable
SKIP: t/gcj6.sh

"ps" shows the following processes running for 45 minutes:

  make test-suite.log TEST_LOGS=t/get-sysconf.log ...
 -> /bin/bash -c p='t/gettext-macros.sh'; ...
 -> /bin/bash ./lib/test-driver --test-name t/gettext-macros.sh --log-file t/gettext-macros.log --trs-file t/gettext-macros.trs --color-tests no --enable-hard-errors yes --expect-failure no -- /bin/bash ./t/gettext-macros.sh
 -> /bin/bash ./t/gettext-macros.sh
 -> /bin/sh /usr/bin/gettextize --force

'autopoint' is not found (since package 'autopoint' is not installed),
and 'gettextize' is found in /usr/bin/ (as part of package 'gettext').

The fix is obviously to NEVER attempt to run gettextize from a test script,
because gettextize is an *interactive* tool [1]. The test intended to cope with
GNU gettext versions that predate the introduction of 'autopoint'. But these
versions are older than July 2002; we can ignore them by now.

2017-04-15  Bruno Haible  <[email-masked]>

	* t/gettext-macros.sh: Never invoke gettextize.

--- t/gettext-macros.sh.bak	2014-12-31 14:26:32.000000000 +0100
+++ t/gettext-macros.sh	2017-04-15 01:23:19.751007887 +0200
@@ -28,28 +28,19 @@
 echo "# Automatically generated by $me." > get.sh
 echo : >> get.sh
 
-# The 'gettextize' and 'autopoint' scripts will look into Makefile.am.
+# The 'autopoint' script will look into Makefile.am.
 echo ACLOCAL_AMFLAGS = -I m4 > Makefile.am
 
-# Prefer autopoint to gettextize, since the more modern versions of the
-# latter might unconditionally require user interaction to complete;
-# yes, this means confirmation from /dev/tty (!) -- see:
+# Prefer autopoint to gettextize, since the latter unconditionally
+# requires user interaction to complete; yes, this means confirmation
+# from /dev/tty (!) -- see:
 #  <http://lists.gnu.org/archive/html/bug-gettext/2011-12/msg00000.html>
-# Since this "forced interaction" behaviour of gettextize wasn't present
-# before the introduction of autopoint, we should be able to safely
-# fall back to calling gettextize non-interactively if autopoint is not
-# present.
-if autopoint --version; then
-  am_gettextize_command=autopoint
-else
-  am_gettextize_command=gettextize
-fi
 
-# We will need to specify the correct autopoint (or gettextize) version
-# in the AM_GNU_GETTEXT_VERSION call in configure.ac if we want autopoint
-# (or gettextize) to setup the correct infrastructure -- in particular,
-# for what concerns us, to bring in all the required .m4 files.
-autopoint_version=$(extract_program_version $am_gettextize_command) \
+# We will need to specify the correct autopoint version in the
+# AM_GNU_GETTEXT_VERSION call in configure.ac if we want autopoint to
+# setup the correct infrastructure -- in particular, for what concerns
+# us, to bring in all the required .m4 files.
+autopoint_version=$(extract_program_version autopoint) \
   && test -n "$autopoint_version" \
   || autopoint_version=0.10.35
 
@@ -61,11 +52,11 @@
 AM_GNU_GETTEXT_VERSION([$autopoint_version])
 END
 
-if $am_gettextize_command --force && test -f m4/gettext.m4; then
+if autopoint --force && test -f m4/gettext.m4; then
   echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh
   echo "export ACLOCAL_PATH" >> get.sh
 else
-  # Older versions of gettext might not have a gettextize program
+  # Older versions of gettext might not have an autopoint program
   # available, but this doesn't mean the user hasn't made the gettext
   # macros available, e.g., by properly setting ACLOCAL_PATH.
   rm -rf m4
@@ -93,13 +84,13 @@
 ACLOCAL="$ACLOCAL -Wno-syntax"
 END
 
-# Remove any Makefile.in possibly created by gettextize/autopoint, to
-# avoid spurious maintainer-check failures.
+# Remove any Makefile.in possibly created by autopoint, to avoid spurious
+# maintainer-check failures.
 rm -f $(find . -name Makefile.in)
 
-# The file gettextize or autopoint might have copied in the 'm4'
-# subdirectory of the test directory are going to be needed by
-# other tests, so we must not remove the test directory.
+# The file autopoint might have copied in the 'm4' subdirectory of the
+# test directory are going to be needed by other tests, so we must not
+# remove the test directory.
 keep_testdirs=yes
 
 :

[1] https://www.gnu.org/software/gettext/manual/html_node/gettextize-Invocation.html
--- t/gettext-macros.sh.bak	2014-12-31 14:26:32.000000000 +0100
+++ t/gettext-macros.sh	2017-04-15 01:23:19.751007887 +0200
@@ -28,28 +28,19 @@
 echo "# Automatically generated by $me." > get.sh
 echo : >> get.sh
 
-# The 'gettextize' and 'autopoint' scripts will look into Makefile.am.
+# The 'autopoint' script will look into Makefile.am.
 echo ACLOCAL_AMFLAGS = -I m4 > Makefile.am
 
-# Prefer autopoint to gettextize, since the more modern versions of the
-# latter might unconditionally require user interaction to complete;
-# yes, this means confirmation from /dev/tty (!) -- see:
+# Prefer autopoint to gettextize, since the latter unconditionally
+# requires user interaction to complete; yes, this means confirmation
+# from /dev/tty (!) -- see:
 #  <http://lists.gnu.org/archive/html/bug-gettext/2011-12/msg00000.html>
-# Since this "forced interaction" behaviour of gettextize wasn't present
-# before the introduction of autopoint, we should be able to safely
-# fall back to calling gettextize non-interactively if autopoint is not
-# present.
-if autopoint --version; then
-  am_gettextize_command=autopoint
-else
-  am_gettextize_command=gettextize
-fi
 
-# We will need to specify the correct autopoint (or gettextize) version
-# in the AM_GNU_GETTEXT_VERSION call in configure.ac if we want autopoint
-# (or gettextize) to setup the correct infrastructure -- in particular,
-# for what concerns us, to bring in all the required .m4 files.
-autopoint_version=$(extract_program_version $am_gettextize_command) \
+# We will need to specify the correct autopoint version in the
+# AM_GNU_GETTEXT_VERSION call in configure.ac if we want autopoint to
+# setup the correct infrastructure -- in particular, for what concerns
+# us, to bring in all the required .m4 files.
+autopoint_version=$(extract_program_version autopoint) \
   && test -n "$autopoint_version" \
   || autopoint_version=0.10.35
 
@@ -61,11 +52,11 @@
 AM_GNU_GETTEXT_VERSION([$autopoint_version])
 END
 
-if $am_gettextize_command --force && test -f m4/gettext.m4; then
+if autopoint --force && test -f m4/gettext.m4; then
   echo "ACLOCAL_PATH='$(pwd)/m4':\$ACLOCAL_PATH" >> get.sh
   echo "export ACLOCAL_PATH" >> get.sh
 else
-  # Older versions of gettext might not have a gettextize program
+  # Older versions of gettext might not have an autopoint program
   # available, but this doesn't mean the user hasn't made the gettext
   # macros available, e.g., by properly setting ACLOCAL_PATH.
   rm -rf m4
@@ -93,13 +84,13 @@
 ACLOCAL="$ACLOCAL -Wno-syntax"
 END
 
-# Remove any Makefile.in possibly created by gettextize/autopoint, to
-# avoid spurious maintainer-check failures.
+# Remove any Makefile.in possibly created by autopoint, to avoid spurious
+# maintainer-check failures.
 rm -f $(find . -name Makefile.in)
 
-# The file gettextize or autopoint might have copied in the 'm4'
-# subdirectory of the test directory are going to be needed by
-# other tests, so we must not remove the test directory.
+# The file autopoint might have copied in the 'm4' subdirectory of the
+# test directory are going to be needed by other tests, so we must not
+# remove the test directory.
 keep_testdirs=yes
 
 :