From: Jim Meyering Date: Sun, 16 May 2010 20:30:00 +0000 (+0200) Subject: init.sh: fix an error in the previous change; add more comments X-Git-Tag: v0.1~4142 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=1a183f8268eb1aae67bbc6bf65d98c703ac7983b;p=gnulib.git init.sh: fix an error in the previous change; add more comments * tests/init.sh: Compare exit code in loop against 9, not 2. Patch by Bruno Haible. Make the two tests more similar by adding an empty "then" clause. Add comments. --- diff --git a/ChangeLog b/ChangeLog index ea50e39e4..e7fbe0b23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-05-16 Jim Meyering + init.sh: fix an error in the previous change; add more comments + * tests/init.sh: Compare exit code in loop against 9, not 2. + Patch by Bruno Haible. + Make the two tests more similar by adding an empty "then" clause. + Add comments. + init.sh: avoid unnecessary shell re-exec * tests/init.sh: Improve the re-exec-required check to first test the current shell. If it passes the test, do not search for a shell that diff --git a/tests/init.sh b/tests/init.sh index 2ad385f2f..e23aa54be 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -90,13 +90,17 @@ else # It does not evaluate any of the code after the "unexpected" `('. Thus, # we must run it in a subshell. ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1 - if test $? != 9; then + if test $? = 9; then + : # The current shell is adequate. No re-exec required. + else + # Search for a shell that meets our requirements. for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail do test "$re_shell_" = no_shell && continue test "$re_shell_" = fail && skip_ failed to find an adequate shell "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null - if test $? = 2; then + if test $? = 9; then + # Found an acceptable shell. exec "$re_shell_" "$0" --no-reexec "$@" echo "$ME_: exec failed" 1>&2 exit 127