summaryrefslogtreecommitdiff
path: root/bugs
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2012-10-01 11:05:31 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2012-10-01 11:05:31 -0300
commitadaba04059ddec1c7c55dab16981f3ae2f0c3279 (patch)
treef867059a39749ff72d925af0daa447dc93025e04 /bugs
parentb157f3546eddda96b8b4f5cd81f56d4ceed2c418 (diff)
downloadlua-adaba04059ddec1c7c55dab16981f3ae2f0c3279.tar.gz
lua-adaba04059ddec1c7c55dab16981f3ae2f0c3279.tar.bz2
lua-adaba04059ddec1c7c55dab16981f3ae2f0c3279.zip
'pcall' may not restore previous error function when
inside coroutines + Check for garbage collector in function calls does not cover all paths
Diffstat (limited to '')
-rw-r--r--bugs99
1 files changed, 97 insertions, 2 deletions
diff --git a/bugs b/bugs
index b2795312..beb73f86 100644
--- a/bugs
+++ b/bugs
@@ -1880,8 +1880,8 @@ patch = [[
1880+++ lundump.c 2008/04/04 19:51:41 2.7.1.4 1880+++ lundump.c 2008/04/04 19:51:41 2.7.1.4
1881@@ -1,5 +1,5 @@ 1881@@ -1,5 +1,5 @@
1882 /* 1882 /*
1883-** $Id: bugs,v 1.116 2012/07/13 14:53:38 roberto Exp roberto $ 1883-** $Id: bugs,v 1.117 2012/09/11 12:42:14 roberto Exp roberto $
1884+** $Id: bugs,v 1.116 2012/07/13 14:53:38 roberto Exp roberto $ 1884+** $Id: bugs,v 1.117 2012/09/11 12:42:14 roberto Exp roberto $
1885 ** load precompiled Lua chunks 1885 ** load precompiled Lua chunks
1886 ** See Copyright Notice in lua.h 1886 ** See Copyright Notice in lua.h
1887 */ 1887 */
@@ -2691,6 +2691,10 @@ patch = [[
2691]] 2691]]
2692} 2692}
2693 2693
2694
2695-----------------------------------------------------------------
2696-- Lua 5.2.1
2697
2694Bug{ 2698Bug{
2695what = [[Some patterns can overflow the C stack, due to recursion]], 2699what = [[Some patterns can overflow the C stack, due to recursion]],
2696report = [[Tim Starling, 2012/07/08]], 2700report = [[Tim Starling, 2012/07/08]],
@@ -2702,6 +2706,97 @@ patch = [[
2702]=] 2706]=]
2703 2707
2704 2708
2709Bug{
2710what = [['pcall' may not restore previous error function when
2711inside coroutines]],
2712report = [[Alexander Gavrilov, 2012/06/12]],
2713since = [[5.2]],
2714fix = nil,
2715example = [[
2716function errfunc(x)
2717 return 'errfunc'
2718end
2719
2720function test(do_yield)
2721 print(do_yield and "yielding" or "not yielding")
2722 pcall(function() -- this pcall sets errfunc back to none
2723 if do_yield then
2724 coroutine.yield() -- stops errfunc from being restored
2725 end
2726 end)
2727 error('fail!')
2728end
2729
2730coro = coroutine.wrap(function()
2731 print(xpcall(test, errfunc, false))
2732 print(xpcall(test, errfunc, true))
2733 print(xpcall(test, errfunc, false))
2734end)
2735
2736coro()
2737--> not yielding
2738--> false errfunc
2739--> yielding
2740coro()
2741--> false temp:12: fail! <<<< should be 'errfunc' too
2742--> not yielding
2743--> false errfunc
2744]],
2745patch = [[
2746--- ldo.c 2012/08/28 18:30:45 2.107
2747+++ ldo.c 2012/09/23 15:49:55
2748@@ -403,7 +403,11 @@
2749 int n;
2750 lua_assert(ci->u.c.k != NULL); /* must have a continuation */
2751 lua_assert(L->nny == 0);
2752- /* finish 'lua_callk' */
2753+ if (ci->callstatus & CIST_YPCALL) { /* was inside a pcall? */
2754+ ci->callstatus &= ~CIST_YPCALL; /* finish 'lua_pcall' */
2755+ L->errfunc = ci->u.c.old_errfunc;
2756+ }
2757+ /* finish 'lua_callk'/'lua_pcall' */
2758 adjustresults(L, ci->nresults);
2759 /* call continuation function */
2760 if (!(ci->callstatus & CIST_STAT)) /* no call status? */
2761]]
2762}
2763
2764Bug{
2765what = [[Check for garbage collector in function calls does not cover
2766all paths]],
2767report = [[Roberto, 2012/08/15]],
2768since = [[5.2.1]],
2769fix = nil,
2770example = [[
2771See <a href="http://lua-users.org/lists/lua-l/2012-08/msg00149.html">
2772http://lua-users.org/lists/lua-l/2012-08/msg00149.html</a>
2773]],
2774patch = [[
2775@@ -311,6 +311,7 @@
2776 ci->top = L->top + LUA_MINSTACK;
2777 lua_assert(ci->top <= L->stack_last);
2778 ci->callstatus = 0;
2779+ luaC_checkGC(L); /* stack grow uses memory */
2780 if (L->hookmask & LUA_MASKCALL)
2781 luaD_hook(L, LUA_HOOKCALL, -1);
2782 lua_unlock(L);
2783@@ -338,6 +339,7 @@
2784 ci->u.l.savedpc = p->code; /* starting point */
2785 ci->callstatus = CIST_LUA;
2786 L->top = ci->top;
2787+ luaC_checkGC(L); /* stack grow uses memory */
2788 if (L->hookmask & LUA_MASKCALL)
2789 callhook(L, ci);
2790 return 0;
2791@@ -393,7 +395,6 @@
2792 luaV_execute(L); /* call it */
2793 if (!allowyield) L->nny--;
2794 L->nCcalls--;
2795- luaC_checkGC(L);
2796 }
2797]]
2798}
2799
2705--[=[ 2800--[=[
2706Bug{ 2801Bug{
2707what = [[ ]], 2802what = [[ ]],