init.sh: fix an error in the previous change; add more comments
authorJim Meyering <meyering@redhat.com>
Sun, 16 May 2010 20:30:00 +0000 (22:30 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 16 May 2010 20:30:00 +0000 (22:30 +0200)
* 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.

ChangeLog
tests/init.sh

index ea50e39..e7fbe0b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-05-16  Jim Meyering  <meyering@redhat.com>
 
+       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
index 2ad385f..e23aa54 100644 (file)
@@ -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