Mercurial > hg > octave-nkf > gnulib-hg
changeset 13623:86a433e3cc28
tests: init.sh improvements for re-exec'ing with zsh
Tom's IRIX setup had a broken bash, and proceeded to run zsh
outside of POSIX mode. But trying to trace that setup proved
difficult, since the re-exec lost tracing.
* tests/init.sh: Borrow autoconf POSIX-mode sanitization. Pass
-vx through shell re-exec.
Reported by Tom G. Christensen.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Thu, 02 Sep 2010 13:49:41 -0600 |
parents | fcda011710d9 |
children | ffaf89c03c87 |
files | ChangeLog tests/init.sh |
diffstat | 2 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,11 @@ 2010-09-02 Eric Blake <eblake@redhat.com> + tests: init.sh improvements for re-exec'ing with zsh + * tests/init.sh: Borrow autoconf POSIX-mode sanitization. Pass + -vx through shell re-exec. + Reported by Tom G. Christensen. + wctype: fix typo in previous commit * m4/wctype_h.m4 (gl_WCTYPE_H): Fix spelling. Reported by Ludovic Courtès.
--- a/tests/init.sh +++ b/tests/init.sh @@ -79,6 +79,19 @@ skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; } framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 99; } +# Sanitize this shell to POSIX mode, if possible. +DUALCASE=1; export DUALCASE +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; + esac +fi + # We require $(...) support unconditionally. # We require a few additional shell features only when $EXEEXT is nonempty, # in order to support automatic $EXEEXT emulation: @@ -122,8 +135,14 @@ test "$re_shell_" = fail && skip_ failed to find an adequate shell "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null if test $? = 9; then - # Found an acceptable shell. - exec "$re_shell_" "$0" --no-reexec "$@" + # Found an acceptable shell. Preserve -v and -x. + case $- in + *v*x* | *x*v*) opts_=-vx ;; + *v*) opts_=-v ;; + *x*) opts_=-x ;; + *) opts_= ;; + esac + exec "$re_shell_" $opts_ "$0" --no-reexec "$@" echo "$ME_: exec failed" 1>&2 exit 127 fi