From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 22C2C6EC60; Thu, 1 Apr 2021 15:34:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 22C2C6EC60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617280470; bh=oe2DxGjMqy3kTkSeLFM8o7Z8EPGrHhw4R4tTS59+t8c=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=gkxZ1xJlCIpXw47TMpoT5PPYb0A7KtAyIXEfrpo7Qemsu40byQd2gYKuzGwyIp5wZ UIGChNc9JFwAFJNVzI/s1itxY3MkCW6GEcTSfQ//M90+f8kPaGV3Z+yN5/qiCCUvUS rS6NVbjtURxp01ksrSzf+uAKsBu+ZcjqQ8PiyiMM= Received: from smtp60.i.mail.ru (smtp60.i.mail.ru [217.69.128.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C12866EC60 for ; Thu, 1 Apr 2021 15:34:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C12866EC60 Received: by smtp60.i.mail.ru with esmtpa (envelope-from ) id 1lRwWp-00087g-Vz; Thu, 01 Apr 2021 15:34:28 +0300 Date: Thu, 1 Apr 2021 15:33:33 +0300 To: Igor Munkin Message-ID: References: <20210330221631.GA29703@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210330221631.GA29703@tarantool.org> X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947427BE79D20CABD4F844F00D7AFD5C3C182A05F538085040E57DDBF5DE981C43078B18018B844ED57351F2C928C481E7167C17A8BCBAF689 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE792C68BF9CD4C0E9EEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378010A306A5B6F90A8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CE99938B3FD79E1DFBB165DDF4D890E37F4BE0C3AA61F784EA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C327ED053E960B195E117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637C970FD8DF19C51D2EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C978311B4C999DDE854CB70D9CEC0EA6A0B831 X-C1DE0DAB: 0D63561A33F958A5CBBC5EAFFA2E20333ADE7748DEC8D70E076E3746D376B8E9D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D340A59E724FC7897F7C4948D7433A312384A35F60499CED03AA8A36B8E70B7E4AF7DB91BA7148A9FF41D7E09C32AA3244C9B1B8ED91DECCF8D47BC22E8D89294648580396430872480FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojetunDCtJ20LuGvWbEb2uVw== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB4A99EA293AC4209EC0284E2555A97244EB4DCA256DB1C4B27F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 16/30] test: adapt PUC Lua test for %q in fmt for LuaJIT X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Igor, Thanks for the review! On 31.03.21, Igor Munkin wrote: > Sergey, > > Thanks for your patch! Please consider my comments below. > > On 26.03.21, Sergey Kaplun wrote: > > LuaJIT: LuaJIT since v2.0.0-beta6 has extension from Lua 5.2: > > Looks like you just copied the comment below. There is no need for > 'LuaJIT:' here. Fixed. > > > string.format(): %q reversible. > > See also https://luajit.org/extensions.html#lua52. > > > > In Lua 5.1 string.format() does not accept string values containing > > embedded zeros, except as arguments to the '%q' option. > > In Lua 5.2 '\0' is not handled differently from other > > control chars in string.format('%q', ...). > > See commit 7cc981c14067d4b0e774a6bfb0acfc2f5c911f0d > > (string.format("%q", str) is now fully reversible > > (from Lua 5.2).). > > Well, I honestly don't understand what is changed in *semantics*. I've > tried the following command with Lua 5.2, Lua 5.1 and LuaJIT 2.0.5 as an > interpreter being tested > | -e 'print(string.format("%q", "\0"))' > > I understand the semantics of "%q", but was it just a bug in Lua 5.1? A bug with the test for it??? > What does "fully reversible" mean in this context? > > I understand only the fact the behaviour differs and you reimplemented > the test assertion according to Lua 5.2 testing suite. That's all. > > I found not a single word regarding this issue in Lua bugs[1] page, > except invalid handling of \r[2]. Is there any issue/page with a more It looks unrelated to these changes. > verbose explanation what has been changed in 7cc981c? I just read these lines in Lua 5.1 reference manual :): | This function does not accept string values containing embedded | zeros, except as arguments to the q option. As for me, it is just new behaviour of Lua 5.2 -- patterns now accept '\0' as a reqular character (see 4541243355a299a9b75042d207feb87295872c3a (patterns now accept '\0' as a regular character) from Lua repository). So, according to commit 658ea8752b979102627e2fede7b7ddfbb67ba6c9 (no need to handle '\0' differently from other control chars in format '%q')) from Lua repository, this behaviour is excess. Also, it is mentioned here [2]. > > > > > This patch adapts test for LuaJIT and Lua 5.2 behaviour considering > > test from Lua 5.2 test suite taken from > > Typo: s/considering test/considering the test/. Fixed. > > > https://www.lua.org/tests/lua-5.2.0-tests.tar.gz. > > > > Closes tarantool/tarantool#5710 > > As we discussed before: s/Closes/Resolves/. Fixed. > > > Part of tarantool/tarantool#5845 > > Part of tarantool/tarantool#4473 > > --- > > test/PUC-Lua-5.1-tests/strings.lua | 12 +++++++++++- > > 1 file changed, 11 insertions(+), 1 deletion(-) > > > > diff --git a/test/PUC-Lua-5.1-tests/strings.lua b/test/PUC-Lua-5.1-tests/strings.lua > > index 237dbad..7c1dfb8 100644 > > --- a/test/PUC-Lua-5.1-tests/strings.lua > > +++ b/test/PUC-Lua-5.1-tests/strings.lua > > @@ -102,7 +102,17 @@ print('+') > > > > x = '"?lo"\n\\' > > assert(string.format('%q%s', x, x) == '"\\"?lo\\"\\\n\\\\""?lo"\n\\') > > -assert(string.format('%q', "\0") == [["\000"]]) > > +-- LuaJIT: LuaJIT since v2.0.0-beta6 has extension from Lua 5.2: > > +-- string.format(): %q reversible. > > +-- In Lua 5.1 string.format() does not accept string values > > +-- containing embedded zeros, except as arguments to the q option. > > +-- In Lua 5.2 '\0' is not handled differently from other > > +-- control chars in string.format('%q', ...). > > +-- See commit 7cc981c14067d4b0e774a6bfb0acfc2f5c911f0d > > +-- (string.format("%q", str) is now fully reversible > > +-- (from Lua 5.2).). > > +-- Test is adapted from PUC-Rio Lua 5.2 test suite. > > +assert(string.format('%q', "\0") == [["\0"]]) > > assert(string.format("\0%c\0%c%x\0", string.byte("?"), string.byte("b"), 140) == > > "\0?\0b8c\0") > > assert(string.format('') == "") > > -- > > 2.31.0 > > > > [1]: https://www.lua.org/bugs.html#5.1 > [2]: https://www.lua.org/bugs.html#5.1-4 > > -- > Best regards, > IM [1]: https://www.lua.org/manual/5.1/manual.html#pdf-string.format [2]: https://www.lua.org/manual/5.2/manual.html#8.2 -- Best regards, Sergey Kaplun