<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><br class=""><blockquote type="cite" class="">14 сент. 2018 г., в 18:17, Vladimir Davydov <<a href="mailto:vdavydov.dev@gmail.com" class="">vdavydov.dev@gmail.com</a>> написал(а):<br class=""><br class="">On Mon, Sep 10, 2018 at 04:36:43PM +0300, Serge Petrenko wrote:<br class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Calling box.schema.user:passwd() instead of box.schema.user.passwd()<br class=""><br class=""></blockquote><br class="">This isn't a proper fix, because the following command still crashes:<br class=""><br class=""> box.schema.user.passwd(123)<br class=""><br class="">And this one crashes too:<br class=""><br class=""> box.session.su('admin', function(x) return #x end, 123)<br class=""><br class="">Making error messages user-friendly is good, but I think that #3659 is<br class="">about invalid usage of luaT_error in lbox_session_su...<br class=""></blockquote><br class="">Hi! I found the cause of this and fixed the issue. I also removed the type check since it<br class="">seems to be outside of the patch scope now. New diff is below.<br class=""><br class="">---<br class=""> src/box/lua/session.c  | 5 ++++-<br class=""> test/box/misc.result   | 9 +++++++++<br class=""> test/box/misc.test.lua | 6 ++++++<br class=""> 3 files changed, 19 insertions(+), 1 deletion(-)<br class=""><br class="">diff --git a/src/box/lua/session.c b/src/box/lua/session.c<br class="">index b2e1400b6..7541da0a7 100644<br class="">--- a/src/box/lua/session.c<br class="">+++ b/src/box/lua/session.c<br class="">@@ -201,8 +201,11 @@ lbox_session_su(struct lua_State *L)<br class=""> <span class="Apple-tab-span" style="white-space:pre">        </span>/* Restore the original credentials. */<br class=""> <span class="Apple-tab-span" style="white-space:pre">  </span>fiber_set_user(fiber(), old_credentials);<br class=""> <br class="">-<span class="Apple-tab-span" style="white-space:pre">  </span>if (error)<br class="">+<span class="Apple-tab-span" style="white-space:pre">    </span>if (error) {<br class="">+<span class="Apple-tab-span" style="white-space:pre">          </span>luaT_toerror(L);<br class=""> <span class="Apple-tab-span" style="white-space:pre">         </span>luaT_error(L);<br class="">+<span class="Apple-tab-span" style="white-space:pre">        </span>}<br class="">+<br class=""> <span class="Apple-tab-span" style="white-space:pre">  </span>return lua_gettop(L) - 1;<br class=""> }<br class=""> <br class="">diff --git a/test/box/misc.result b/test/box/misc.result<br class="">index 62376754e..4ee4797d0 100644<br class="">--- a/test/box/misc.result<br class="">+++ b/test/box/misc.result<br class="">@@ -1148,6 +1148,15 @@ s = box.schema.space.create('test', {user="no_such_user"})<br class=""> ---<br class=""> - error: User 'no_such_user' is not found<br class=""> ...<br class="">+--<br class="">+-- gh-3659 assertion failure after an error in code called from<br class="">+-- box.session.su()<br class="">+--<br class="">+box.session.su("admin", function(x) return #x end, 3)<br class="">+---<br class="">+- error: '[string "return box.session.su("admin", function(x) re..."]:1: attempt to<br class="">+    get length of local ''x'' (a number value)'<br class="">+...<br class=""> -- Too long WAL write warning (gh-2743).<br class=""> s = box.schema.space.create('test')<br class=""> ---<br class="">diff --git a/test/box/misc.test.lua b/test/box/misc.test.lua<br class="">index d6815645e..ee81c7be1 100644<br class="">--- a/test/box/misc.test.lua<br class="">+++ b/test/box/misc.test.lua<br class="">@@ -320,6 +320,12 @@ s:drop()<br class=""> --<br class=""> s = box.schema.space.create('test', {user="no_such_user"})<br class=""> <br class="">+--<br class="">+-- gh-3659 assertion failure after an error in code called from<br class="">+-- box.session.su()<br class="">+--<br class="">+box.session.su("admin", function(x) return #x end, 3)<br class="">+<br class=""> -- Too long WAL write warning (gh-2743).<br class=""> s = box.schema.space.create('test')<br class=""> _ = s:create_index('pk')<br class="">-- <br class="">2.15.2 (Apple Git-101.1)</body></html>