autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

zsh 4.3.2 mishandles function return value -> 'configure' screwups


From: Paul Eggert
Subject: zsh 4.3.2 mishandles function return value -> 'configure' screwups
Date: Mon, 30 Apr 2007 10:20:23 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

At the end of this message is a shell script that illustrates the bug.
When I run it with zsh 4.3.2 (as distributed in Debian stable), zsh
outputs "as_func_failure succeeded" and exits with nonzero status.
Zsh should operate silently and exit with status zero; this is what
Bash, ksh, and zsh 3.0.8 do.

This failure causes Autoconf-generated configure scripts to consider
zsh 4.3.2 to be broken, so it tries other shells.  If zsh is the only
shell available on the system, 'configure' complains to the user.  For
an example of this behavior, please see the Emacs bug report
<http://lists.gnu.org/archive/html/emacs-devel/2007-04/msg01452.html>.


if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  emulate sh
  NULLCMD=:
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '${1+"$@"}'='"$@"'
  setopt NO_GLOB_SUBST
else
  case `(set -o) 2>/dev/null` in
  *posix*) set -o posix ;;
esac

fi
(as_func_return () {
  (exit $1)
}
as_func_success () {
  as_func_return 0
}
as_func_failure () {
  as_func_return 1
}
as_func_ret_success () {
  return 0
}
as_func_ret_failure () {
  return 1
}

exitcode=0
if as_func_success; then
  :
else
  exitcode=1
  echo as_func_success failed.
fi

if as_func_failure; then
  exitcode=1
  echo as_func_failure succeeded.
fi

if as_func_ret_success; then
  :
else
  exitcode=1
  echo as_func_ret_success failed.
fi

if as_func_ret_failure; then
  exitcode=1
  echo as_func_ret_failure succeeded.
fi

if ( set x; as_func_ret_success y && test x = "$1" ); then
  :
else
  exitcode=1
  echo positional parameters were not saved.
fi

test $exitcode = 0) || { (exit 1); exit 1; }

(
  as_lineno_1=$LINENO
  as_lineno_2=$LINENO
  test "x$as_lineno_1" != "x$as_lineno_2" &&
  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]