1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 06:49:49 +02:00

20222: turn on max function depth

plus unposted reference to this in README
plus unposted neatening of 20219 history-pattern-search
This commit is contained in:
Peter Stephenson 2004-07-30 11:09:16 +00:00
parent b550cfe7e3
commit ab899b76c7
6 changed files with 62 additions and 24 deletions

View File

@ -1,3 +1,13 @@
2004-07-30 Peter Stephenson <pws@csr.com>
* unposted: minor tidy up for 20219: neaten read-from-minibuffer
and make history-pattern-search use last pattern as default.
* unposted: README: mention max function depth is on by default
* 20222: INSTALL, configure.ac: turn on max function depth by
default to avoid crash.
2004-07-29 Peter Stephenson <pws@csr.com>
* 20221: Src/exec.c, Src/signals.c, Test/A05execution.ztst:

View File

@ -28,7 +28,9 @@ else
fi
# Read pattern. Prompt could be made customisable.
read-from-minibuffer "pat ($dir): "
read-from-minibuffer "pat ($dir): " $_last_history_pattern_search
_last_history_pattern_search=$REPLY
# Abort if bad status or nothing entered
[[ $? -ne 0 || -z $REPLY ]] && return 0

View File

@ -5,15 +5,17 @@ local opt keys
integer stat
while getopts "k:" opt; do
case $opt in
(k)
keys=$OPTARG
;;
case $opt in
# Read the given number of keys. This is a bit
# ropey for more than a single key.
(k)
keys=$OPTARG
;;
(*)
return 1
;;
esac
(*)
return 1
;;
esac
done
(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
@ -27,13 +29,13 @@ ${1:-? }"
POSTDISPLAY=
if [[ -n $keys ]]; then
zle -R
read -k $keys
stat=$?
zle -R
read -k $keys
stat=$?
else
zle recursive-edit
stat=$?
(( stat )) || REPLY=$BUFFER
zle recursive-edit
stat=$?
(( stat )) || REPLY=$BUFFER
fi
LBUFFER=$savelbuffer

13
INSTALL
View File

@ -330,6 +330,19 @@ $fpath array on shell startup. This directory will not be affected by
`make uninstall' or `make uninstall.fns', although the version-specific
directory and its contents will be deleted.
Function depth
--------------
Shell functions may be called recursively. In order to detect infinite
recursion the shell has a limit on the depth to which functions may be
called: note that this is a single limit for all functions, not a limit
for each function called recursively. The default for the limit is 4096.
The limit may be altered to the value MAX by passing the option
--enable-max-function-depth=MAX to configure. Alternatively, the limit may
be disabled with --disable-max-function-depth. However, this is not
recommended as it is likely to cause the shell to crash on an infinite
recursion.
Support for large files and integers
------------------------------------

21
README
View File

@ -25,14 +25,23 @@ Possible incompatibilities
---------------------------
Currently the only known incompatibilities between 4.2.0 and later
versions are minor: IPv6 addresses must be specified in
square brackets in the zftp module and function system; special
traps for pseudosignals ZERR, DEBUG and EXIT are no longer executed
inside other traps (users may well have assumed this was the case anyway
since the behaviour was not explicity documented). See the NEWS file for
versions are minor:
IPv6 addresses must be specified in square brackets in the zftp module and
the function system built on top of the zftp module.
Special traps for pseudosignals ZERR, DEBUG and EXIT are no longer executed
inside other traps. Users may well have assumed this was the case anyway
since the behaviour was not explicity documented. See the NEWS file for
more detail.
Some particular differences you may notice since version 4.0:
By default, a maximum function depth of 4096 is now compiled into the
shell. This may be altered during configuration; see `Function depth' in
INSTALL.
Some particular differences you may notice between the 4.0 and 4.2 series
of releases:
The bash-compatibility zle functions described in the zshcontrib manual
page have been removed as a more configurable set of editing widgets for

View File

@ -301,12 +301,14 @@ ifdef([max_function_depth],[undefine([max_function_depth])])dnl
AH_TEMPLATE([MAX_FUNCTION_DEPTH],
[Define for function depth limits])
AC_ARG_ENABLE(max-function-depth,
[ --enable-max-function-depth=MAX limit function depth to MAX],
[ --enable-max-function-depth=MAX limit function depth to MAX, default 4096],
[if test x$enableval = xyes; then
AC_DEFINE(MAX_FUNCTION_DEPTH, 4096)
else
elif test x$enableval != xno; then
AC_DEFINE_UNQUOTED(MAX_FUNCTION_DEPTH, $enableval)
fi])
fi],
[AC_DEFINE(MAX_FUNCTION_DEPTH, 4096)]
)
dnl Do you want to look for pcre support?
AC_ARG_ENABLE(pcre,