summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-07-30 11:09:16 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-07-30 11:09:16 +0000
commitab899b76c790d1cb13b76716d4d99b6bd7ac983c (patch)
tree9685f177c31645e5394be3236bd4deecb3f0b8af
parentb550cfe7e382c7704965a166af81933f1ac50d4b (diff)
downloadzsh-ab899b76c790d1cb13b76716d4d99b6bd7ac983c.tar.gz
zsh-ab899b76c790d1cb13b76716d4d99b6bd7ac983c.tar.xz
zsh-ab899b76c790d1cb13b76716d4d99b6bd7ac983c.zip
20222: turn on max function depth
plus unposted reference to this in README
plus unposted neatening of 20219 history-pattern-search
-rw-r--r--ChangeLog10
-rw-r--r--Functions/Zle/history-pattern-search4
-rw-r--r--Functions/Zle/read-from-minibuffer32
-rw-r--r--INSTALL13
-rw-r--r--README21
-rw-r--r--configure.ac8
6 files changed, 63 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 98508d1d1..9c1a1abe8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
diff --git a/Functions/Zle/history-pattern-search b/Functions/Zle/history-pattern-search
index 02f85a2fb..a6b12bd9c 100644
--- a/Functions/Zle/history-pattern-search
+++ b/Functions/Zle/history-pattern-search
@@ -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
diff --git a/Functions/Zle/read-from-minibuffer b/Functions/Zle/read-from-minibuffer
index c3848ae9f..ba75cbdce 100644
--- a/Functions/Zle/read-from-minibuffer
+++ b/Functions/Zle/read-from-minibuffer
@@ -5,15 +5,17 @@ local opt keys
 integer stat
 
 while getopts "k:" opt; do
-    case $opt in
-	(k)
-	keys=$OPTARG
-	;;
-
-	(*)
-	return 1
-	;;
-    esac
+  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
 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
diff --git a/INSTALL b/INSTALL
index 5ed5abc03..08f3383e9 100644
--- a/INSTALL
+++ b/INSTALL
@@ -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
 ------------------------------------
 
diff --git a/README b/README
index b2bf31894..b3d564c35 100644
--- a/README
+++ b/README
@@ -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
diff --git a/configure.ac b/configure.ac
index 5003018bd..3fdac2104 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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,