To: vim_dev@googlegroups.com Subject: Patch 8.0.0137 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0137 Problem: When 'maxfuncdepth' is set above 200 the nesting is limited to 200. (Brett Stahlman) Solution: Allow for Ex command recursion depending on 'maxfuncdepth'. Files: src/ex_docmd.c, src/testdir/test_nested_function.vim *** ../vim-8.0.0136/src/ex_docmd.c 2017-01-02 14:27:15.619201170 +0100 --- src/ex_docmd.c 2017-01-02 15:12:58.408210687 +0100 *************** *** 787,794 **** #endif /* It's possible to create an endless loop with ":execute", catch that ! * here. The value of 200 allows nested function calls, ":source", etc. */ ! if (call_depth == 200) { EMSG(_("E169: Command too recursive")); #ifdef FEAT_EVAL --- 787,795 ---- #endif /* It's possible to create an endless loop with ":execute", catch that ! * here. The value of 200 allows nested function calls, ":source", etc. ! * Allow 200 or 'maxfuncdepth', whatever is larger. */ ! if (call_depth >= 200 && call_depth >= p_mfd) { EMSG(_("E169: Command too recursive")); #ifdef FEAT_EVAL *** ../vim-8.0.0136/src/testdir/test_nested_function.vim 2016-11-14 21:49:57.080090226 +0100 --- src/testdir/test_nested_function.vim 2017-01-02 15:22:33.304211286 +0100 *************** *** 40,42 **** --- 40,63 ---- delfunc g:X unlet g:Y endfunc + + func Recurse(count) + if a:count > 0 + call Recurse(a:count - 1) + endif + endfunc + + func Test_max_nesting() + let call_depth_here = 2 + let ex_depth_here = 5 + set mfd& + + call Recurse(99 - call_depth_here) + call assert_fails('call Recurse(' . (100 - call_depth_here) . ')', 'E132:') + + set mfd=210 + call Recurse(209 - ex_depth_here) + call assert_fails('call Recurse(' . (210 - ex_depth_here) . ')', 'E169:') + + set mfd& + endfunc *** ../vim-8.0.0136/src/version.c 2017-01-02 14:57:05.494810156 +0100 --- src/version.c 2017-01-02 15:22:45.076129622 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 137, /**/ -- hundred-and-one symptoms of being an internet addict: 173. You keep tracking down the email addresses of all your friends (even childhood friends). /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///