Re: Sandbox causes hang!
"Nigel Atkinson" <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
I tried running your code interactively in Lua, and it mostly worked. How is your test.lua setup however. With simply just a: function foo() print( 'Foooo!' ) end the tables mylib and mylib.test are not created, and the function is global. Perhaps this is a clue to your hang. Nigel On Tue, February 1, 2011 12:47 am, Kristoffer Danielsson wrote: > > I found the problem. If function "foo" does not exist in mylib\test.lua, > then it hangs. > However, this only happens when I have applied my sandbox code. Not sure > how to interpret this. > > Chris > >> From: [email protected] >> To: [email protected] >> Date: Mon, 31 Jan 2011 23:37:20 +1100 >> Subject: Re: [luabind] Sandbox causes hang! >> >> At a quick glance your 'foo' function looks like it might be calling >> itself... >> >> Nigel >> >> On Mon, 2011-01-31 at 12:05 +0100, Kristoffer Danielsson wrote: >> > Luabind 0.9.1 and Lua 5.1.4. Consider this sandbox code: >> > >> > "load = nil\n >> > loadfile = nil\n >> > dofile = nil\n >> > package.loadlib = nil\n >> > package.loaders[3] = nil\n >> > package.loaders[4] = nil\n >> > package.path = >> > 'C:/Users/Test/Desktop/MyApp/Scripts/?;C:/Users/Test/MyApp/Scripts/?.lua;C:/Users/Test/Desktop/MyApp/Scripts/'\n >> > " >> > >> > After executing that, I run this script (located in C:\Users\Test >> > \Desktop\MyApp): >> > require 'mylib.test' -- C:\Users\Test\Desktop\MyApp\mylib\test.lua >> > does exist! >> > >> > function foo() >> > return mylib.test.foo() >> > end >> > >> > Then I call "foo": >> > luabind::call_function<string>(L, "foo"); >> > >> > The script that hangs! It seems to get stuck in the for-loop in >> > lvm.c(385): >> > >> > case OP_GETGLOBAL: { >> > TValue g; >> > TValue *rb = KBx(i); >> > sethvalue(L, &g, cl->env); >> > lua_assert(ttisstring(rb)); >> > Protect(luaV_gettable(L, &g, rb, ra)); // I keep getting here. >> > Forever... >> > continue; >> > >> > >> > What's wrong with my sandbox code? If I remove the assignment of >> > "package.path", it works! Also, the above seems to work for some >> > scripts with the same logic. Don't get it... >> > >> > Please help! >> > ------------------------------------------------------------------------------ >> > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! >> > Finally, a world-class log management solution at an even better >> price-free! >> > Download using promo code Free_Logger_4_Dev2Dev. Offer expires >> > February 28th, so secure your free ArcSight Logger TODAY! >> > http://p.sf.net/sfu/arcsight-sfd2d >> > _______________________________________________ luabind-user mailing >> list [email protected] >> https://lists.sourceforge.net/lists/listinfo/luabind-user >> >> >> >> ------------------------------------------------------------------------------ >> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! >> Finally, a world-class log management solution at an even better >> price-free! >> Download using promo code Free_Logger_4_Dev2Dev. Offer expires >> February 28th, so secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsight-sfd2d >> _______________________________________________ >> luabind-user mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/luabind-user > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better > price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d_______________________________________________ > luabind-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/luabind-user > ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d