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 295C36EC60; Wed, 31 Mar 2021 01:18:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 295C36EC60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617142716; bh=xEnTYz4gSn2zAhP2KMACVEr2gMO7Mm+iooW0ddx4e60=; 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=RkkHbelB4+On8gCk5IEqhGivZQhvsXsTy2/4lbTzbeIZinBoQ/uvvsJ+P8x2HJcL0 t3nxzlD+1u1376o+CifR5G2VJlbKYbKq1oPqqDsiwnph4XCRHsPJdDHUzIlKV5I7r8 j9Csffp3/NmMTnHK6tvnirqSMkOIvFlbhwdr0kDE= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 A47BF6BD05 for ; Wed, 31 Mar 2021 01:16:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A47BF6BD05 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lRMfA-00034F-Qd; Wed, 31 Mar 2021 01:16:41 +0300 Date: Wed, 31 Mar 2021 01:16:31 +0300 To: Sergey Kaplun Message-ID: <20210330221631.GA29703@tarantool.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.10.1 (2018-07-13) X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947427BE79D20CABD4ABD7C98AF5DBFD37182A05F5380850403EF877A1CE6B6CE2E7AF779F19D60B3F30C8258CC7839F9CFDE8535C8252A227 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A3DED2DACB82E709C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE72AC9FB60380F23AEEA1F7E6F0F101C67CDEEF6D7F21E0D1D174C73DBBBFC7664EF7DA896057A139BF3A08010F0785012A0DEA0B54BEBBB40389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0A3E989B1926288338941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6D52CD31C43BF465FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB86D1867E19FE14079C09775C1D3CA48CFC5EA940A35A165FF2DBA43225CD8A89FB1E7EB37E7A723DAA91E23F1B6B78B78B5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C9783119062ECCC221CF455E2DD01FEC9EDF0A X-C1DE0DAB: 0D63561A33F958A5D81B87B62D4F10772FFBC151BA0B53D1FF44CF29E352590ED59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34FDC9529E4578B99C34E5C49066D85C9B5DF5B945908E6E07A4FCD4D7C9407A57D065256C47E936321D7E09C32AA3244C53167D3F4E7EBA96AA3A239057B8C309D9ADFF0C0BDB8D1F927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojfQIxm2xDGoZdnWxlmwd/0w== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638229FB08FDB6F593371400963C8671C5463A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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. > 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? 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 verbose explanation what has been changed in 7cc981c? > > 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/. > https://www.lua.org/tests/lua-5.2.0-tests.tar.gz. > > Closes tarantool/tarantool#5710 As we discussed before: s/Closes/Resolves/. > 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