changeset 13345:42694f286281

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.
author Jim Meyering <meyering@redhat.com>
date Sun, 16 May 2010 22:30:00 +0200
parents 6e88c61e5eff
children f2aa3e15a4e0
files ChangeLog tests/init.sh
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -90,13 +90,17 @@
   # 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