]> git.ipfire.org Git - thirdparty/automake.git/commit
test defs: fix ksh-related portability bug in warning messages
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 13 Jun 2011 20:42:25 +0000 (22:42 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 14 Jun 2011 15:15:49 +0000 (17:15 +0200)
commit29ca903b799b0a319f881701788f9b350ac50cc8
treeecd6eb25079e10ff8d291a94e2f324a033be82a1
parent1e8dc0f665c2d66d037cbe79c8e036f2d714311e
test defs: fix ksh-related portability bug in warning messages

Running "make check" normally prints a diagnostic to the outermost
stderr (usually a tty) to explain why a test is skipped, thus
giving better and faster feedback to the user.  It used to do
so by redirecting file descriptor 9 to stderr (via "exec 9>&2")
before invoking the test scripts, which then would write any skip
explanation to file descriptor 9 via the `skip_' function defined
in `tests/defs'.

However, various Korn Shells (at least Solaris 10's /bin/ksh and
Debian GNU/Linux's /bin/ksh) and the HP-UX's /bin/sh close open
file descriptors > 2 upon an `exec' system call; thus the effects
of "exec 9>&2" are cancelled upon fork-and-exec, so we would get
a "Bad file number" diagnostic and no skip explanation with those
shells.

The present change remedies this situation.

* tests/Makefile.am (AM_TESTS_ENVIRONMENT): Redirect more portably,
via a trailing "9>&2", rather than the prior "exec 9>&2; ...".  Add
explanatory comments.
* tests/defs (stderr_fileno_): Update the advice in comments.

Based on commit v8.12-82-g6b68745 "tests: accommodate HP-UX and
ksh-derived shells" in GNU coreutils.

Further references, with lots of discussion:
 <http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00002.html>
 <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488>
 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846>
ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/defs