Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Recursion error and line numbers



Bart Schaefer wrote:
> } How about 1000?  That seems to stop it.
> 
> It looks as if it's been 4096 ever since we added it back in about
> April 2000.  A default of 1000 is most likely OK, given that it's
> configure-time settable.

Yes, I think making the average PC work is a good thing to aim for in
the default settings.  Here's the patch.

> } > Obviously the recursion depth isn't 1 or 10 or 50 either.  Where is that
> } > number coming from?  I would have expected "1" in all cases.
> } 
> } It's a subtle effect of line number handling and I haven't quite worked
> } out why yet.
> 
> Perhaps it has something to do with having left off the braces around
> the function body?

That seems to be it.  Hmm... some difference in behaviour is not *so*
stupid.  A function written in that form is a bit like an inlined macro,
and you might usually be more interested in the line number in the
context rather than the function.  Still, the combination of function
name and line number which isn't in the function is clearly wrong.

Index: README
===================================================================
RCS file: /cvsroot/zsh/zsh/README,v
retrieving revision 1.32
diff -u -r1.32 README
--- README	20 Mar 2006 11:06:23 -0000	1.32
+++ README	19 Jun 2006 10:17:31 -0000
@@ -63,6 +63,12 @@
 hit for anyone not using PINE.  The previous default can be restored with:
   zstyle ':completion:*' pine-directory ~/mail
 
+The default maximum function depth (configurable with
+--enable-max-function-depth) has been decreased to 1000 from 4096.  The
+previous value was observed to be large enough that crashes still occurred
+on some fairly common PC configurations.  This change is only likely to
+affect some highly specialised uses of the shell.
+
 Documentation
 -------------
 
Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.54
diff -u -r1.54 configure.ac
--- configure.ac	5 Jun 2006 16:55:38 -0000	1.54
+++ configure.ac	19 Jun 2006 10:17:33 -0000
@@ -325,13 +325,13 @@
 AH_TEMPLATE([MAX_FUNCTION_DEPTH],
 [Define for function depth limits])
 AC_ARG_ENABLE(max-function-depth,
-AC_HELP_STRING([--enable-max-function-depth=MAX], [limit function depth to MAX, default 4096]),
+AC_HELP_STRING([--enable-max-function-depth=MAX], [limit function depth to MAX, default 1000]),
 [if test x$enableval = xyes; then
-  AC_DEFINE(MAX_FUNCTION_DEPTH, 4096)
+  AC_DEFINE(MAX_FUNCTION_DEPTH, 1000)
 elif test x$enableval != xno; then
   AC_DEFINE_UNQUOTED(MAX_FUNCTION_DEPTH, $enableval)
 fi],
-[AC_DEFINE(MAX_FUNCTION_DEPTH, 4096)]
+[AC_DEFINE(MAX_FUNCTION_DEPTH, 1000)]
 )
 
 dnl Do you want to look for pcre support?

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



Messages sorted by: Reverse Date, Date, Thread, Author