zsh-workers
 help / color / mirror / code / Atom feed
* add-zle-hook-widget: infinite recursion ("job table full or recursion limit exceeded")
@ 2016-08-30 17:23 Daniel Shahaf
  2016-08-30 23:31 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2016-08-30 17:23 UTC (permalink / raw)
  To: zsh-workers

It's trivial to trigger:

% Src/zsh -fc 'autoload add-zle-hook-widget; f() {}; add-zle-hook-widget zle-line-pre-redraw f' 
add-zle-hook-widget:182: job table full or recursion limit exceeded
zsh: exit 1     $prefix/zsh/bin/zsh -fc 

Here's the trace:

% Src/zsh -x -fc 'autoload add-zle-hook-widget; f() {}; add-zle-hook-widget zle-line-pre-redraw f' 2>&1 | head -30
+zsh:1> autoload add-zle-hook-widget
+zsh:1> add-zle-hook-widget zle-line-pre-redraw f
+add-zle-hook-widget:21> '(anon)' zle-line-pre-redraw f
+(anon):2> emulate -L zsh
+(anon):5> zmodload -e zsh/zle
+(anon):5> return 1
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc (*file)
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc (*evalautofunc)
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc (*loadautofunc)
+add-zle-hook-widget:181> add-zle-hook-widget zle-line-pre-redraw f
+add-zle-hook-widget:21> '(anon)' zle-line-pre-redraw f
+(anon):2> emulate -L zsh
+(anon):5> zmodload -e zsh/zle
+(anon):5> return 1
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc shfunc (*file)
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc shfunc (*evalautofunc)
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc shfunc (*loadautofunc)
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc shfunc (*)
+add-zle-hook-widget:182> [[ -o kshautoload ]]
+add-zle-hook-widget:182> add-zle-hook-widget zle-line-pre-redraw f
+add-zle-hook-widget:21> '(anon)' zle-line-pre-redraw f
+(anon):2> emulate -L zsh
+(anon):5> zmodload -e zsh/zle
+(anon):5> return 1
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc shfunc shfunc (*file)
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc shfunc shfunc (*evalautofunc)
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc shfunc shfunc (*loadautofunc)
+add-zle-hook-widget:178> case cmdarg shfunc loadautofunc shfunc shfunc (*)
+add-zle-hook-widget:182> [[ -o kshautoload ]]
+add-zle-hook-widget:182> add-zle-hook-widget zle-line-pre-redraw f
zsh: broken pipe  $prefix/zsh/bin/zsh -x -fc  2>&1 | 
zsh: done         head -30

Running 'zmodload zsh/zle' before the call appears to prevent hte
problem.  I can do that in my callsite (z-sy-h's "make check"), but
I assume zsh shouldn't enter an infinite loop, either.

Cheers,

Daniel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: add-zle-hook-widget: infinite recursion ("job table full or recursion limit exceeded")
  2016-08-30 17:23 add-zle-hook-widget: infinite recursion ("job table full or recursion limit exceeded") Daniel Shahaf
@ 2016-08-30 23:31 ` Bart Schaefer
  2016-08-31  2:22   ` Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2016-08-30 23:31 UTC (permalink / raw)
  To: zsh-workers

On Aug 30,  5:23pm, Daniel Shahaf wrote:
} Subject: add-zle-hook-widget: infinite recursion ("job table full or recur
}
} +add-zle-hook-widget:21> '(anon)' zle-line-pre-redraw f
} +(anon):2> emulate -L zsh
} +(anon):5> zmodload -e zsh/zle
} +(anon):5> return 1

Ah ...

} Running 'zmodload zsh/zle' before the call appears to prevent hte
} problem.  I can do that in my callsite (z-sy-h's "make check"), but
} I assume zsh shouldn't enter an infinite loop, either.

Need to move the sanity checks out of the anonymous function.  Unless
someone suggests a variation of "return" that works like "break 2".


diff --git a/Functions/Misc/add-zle-hook-widget b/Functions/Misc/add-zle-hook-widget
index c47d9a3..572de25 100644
--- a/Functions/Misc/add-zle-hook-widget
+++ b/Functions/Misc/add-zle-hook-widget
@@ -18,10 +18,6 @@
 #
 # The -L option lists the hooks and their associated widgets.
 
-() { # Preserve caller global option settings
-
-emulate -L zsh
-
 # This is probably more safeguarding than necessary
 zmodload -e zsh/zle || return 1
 { zmodload zsh/parameter && zmodload zsh/zleparameter } || {
@@ -29,6 +25,10 @@ zmodload -e zsh/zle || return 1
     return 1
 }
 
+() { # Preserve caller global option settings
+
+emulate -L zsh
+
 # Setup - create the base functions for hook widgets that call the others
 
 local -a hooktypes=( zle-isearch-exit zle-isearch-update


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: add-zle-hook-widget: infinite recursion ("job table full or recursion limit exceeded")
  2016-08-30 23:31 ` Bart Schaefer
@ 2016-08-31  2:22   ` Daniel Shahaf
  2016-08-31  3:28     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2016-08-31  2:22 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote on Tue, Aug 30, 2016 at 16:31:38 -0700:
> Need to move the sanity checks out of the anonymous function.

Thanks, this fixes the problem.

I suppose an error message couldn't hurt:

diff --git Functions/Misc/add-zle-hook-widget Functions/Misc/add-zle-hook-widget
index 572de25..f45bec2 100644
--- Functions/Misc/add-zle-hook-widget
+++ Functions/Misc/add-zle-hook-widget
@@ -19,5 +19,8 @@
 # This is probably more safeguarding than necessary
-zmodload -e zsh/zle || return 1
+zmodload -e zsh/zle || {
+    print -u2 "add-zle-hook-widget: zle is not present in this shell"
+    return 1
+}
 { zmodload zsh/parameter && zmodload zsh/zleparameter } || {
     print -u2 "add-zle-hook-widget: Need parameter modules for zle hooks"
     return 1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: add-zle-hook-widget: infinite recursion ("job table full or recursion limit exceeded")
  2016-08-31  2:22   ` Daniel Shahaf
@ 2016-08-31  3:28     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2016-08-31  3:28 UTC (permalink / raw)
  To: zsh-workers

On Aug 31,  2:22am, Daniel Shahaf wrote:
}
} I suppose an error message couldn't hurt:

I left that error message out on purpose, because the only shells
in which zle isn't loaded would probably be the same shells where a
spurious error message would be really annoying.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-31  4:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-30 17:23 add-zle-hook-widget: infinite recursion ("job table full or recursion limit exceeded") Daniel Shahaf
2016-08-30 23:31 ` Bart Schaefer
2016-08-31  2:22   ` Daniel Shahaf
2016-08-31  3:28     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).