[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: init.sh improvements for re-exec'ing with zsh
From: |
Eric Blake |
Subject: |
[PATCH] tests: init.sh improvements for re-exec'ing with zsh |
Date: |
Thu, 2 Sep 2010 13:52:56 -0600 |
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 <address@hidden>
---
> > Jim, I'm wondering if init.sh should propagate v and/or x as part of
> > the re-exec (certainly it would make it easier to get a full trace):
> Good idea. I think that would have helped me once or twice, too.
> Please do.
Done.
ChangeLog | 5 +++++
tests/init.sh | 22 +++++++++++++++++++++-
2 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 74e4991..fa3aafd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2010-09-02 Eric Blake <address@hidden>
+ 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.
diff --git a/tests/init.sh b/tests/init.sh
index bc82d69..be31e2d 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -79,6 +79,19 @@ fail_() { warn_ "$ME_: failed test: $@"; Exit 1; }
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:
@@ -116,6 +129,13 @@ else
: # The current shell is adequate. No re-exec required.
else
# Search for a shell that meets our requirements.
+ # Preserve -v and -x to any child shell.
+ case $- in
+ *v*x* | *x*v*) opts_=-vx ;;
+ *v*) opts_=-v ;;
+ *x*) opts_=-x ;;
+ *) opts_= ;;
+ esac
for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh
fail
do
test "$re_shell_" = no_shell && continue
@@ -123,7 +143,7 @@ else
"$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
if test $? = 9; then
# Found an acceptable shell.
- exec "$re_shell_" "$0" --no-reexec "$@"
+ exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
echo "$ME_: exec failed" 1>&2
exit 127
fi
--
1.7.2.2
- IRIX failures [was: next m4 snapshot], Eric Blake, 2010/09/01
- Re: IRIX failures [was: next m4 snapshot], Tom G. Christensen, 2010/09/01
- test-vc-cvs [was: IRIX failures], Eric Blake, 2010/09/01
- Re: test-vc-cvs, Jim Meyering, 2010/09/02
- [PATCH] tests: init.sh improvements for re-exec'ing with zsh,
Eric Blake <=
- Re: test-vc-cvs [was: IRIX failures], Tom G. Christensen, 2010/09/02
- Re: test-vc-cvs [was: IRIX failures], Eric Blake, 2010/09/02
- Re: test-vc-cvs [was: IRIX failures], Tom G. Christensen, 2010/09/02
- Re: test-vc-cvs [was: IRIX failures], Eric Blake, 2010/09/02
minimum perl version [was: IRIX failures], Eric Blake, 2010/09/01
Re: minimum perl version, Bruno Haible, 2010/09/04
Re: minimum perl version, Jim Meyering, 2010/09/04