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 3E2EFD473C0; Tue, 12 Nov 2024 22:24:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3E2EFD473C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1731439449; bh=nDWscQmNoEbKTZGZeOfSTgkvTNXKdE4Szw6BUI1mcSM=; 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=cH8Q92HjlAzWGTSZii0kgj+VD2VO0cJhCq2sN1ZskLK+YO6wx9Vxspi9hOXtyrZEB KM06bS3N1nyfC7Z6++9g/Gifh4ordlK7hAHCfbLjPT3Dwl/g02bYXe9s/Qzrb703kj 4Ng6N0nPBktroyeqXf3lBE1VgbZSf78yedNCttt0= Received: from smtp49.i.mail.ru (smtp49.i.mail.ru [95.163.41.91]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id CEAADD473D0 for ; Tue, 12 Nov 2024 22:24:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CEAADD473D0 Received: by exim-smtp-f57bd98df-dvw8h with esmtpa (envelope-from ) id 1tAwUg-000000004I6-2OPh; Tue, 12 Nov 2024 22:24:07 +0300 Date: Tue, 12 Nov 2024 22:23:20 +0300 To: Sergey Bronnikov Message-ID: References: <76c9c163c365aec70741162ab83fdfa6385a9118.1730976041.git.sergeyb@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <76c9c163c365aec70741162ab83fdfa6385a9118.1730976041.git.sergeyb@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD95DB1AC9E176400EC8F32E72126049F3EA789E2BE8A632FAB00894C459B0CD1B9C128A731AD2DD223D4FF92D56319F19729312F6F4AD4FE2EDE0E7CCDE33D6412EC456C66D2279EA7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE745229D52CF30560CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006378D8F1FE4E764DFCDEA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BC08E230531AC9C908DB1B15B182DA23609EDEC0875910302128C0586579C8EEEA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C353FA85A707D24CADCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB86D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE7AAF33752BA76F867731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A5269FCA93EC8520A05002B1117B3ED6964510D820636C74F48B25839F35DFE037823CB91A9FED034534781492E4B8EEADB05233B9BC4759D3 X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D34E9B0C12ABED551377D38FCCAA0EF47AE8038C4AAB440B0499EA3F8CD37592892A5504E490D7CB8981D7E09C32AA3244C798265BF8DCE9BE777DD89D51EBB7742B08F718A2A888049EA455F16B58544A21C197AAF4D2E4732A5AE236DF995FB59829709634694AABAED6A17656DB59BCAD427812AF56FC65B X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojiL36rItsrIw1RFJqsxt1eg== X-DA7885C5: 15321B2A8B207C00F255D290C0D534F989F618DB4B6C2E102B4CC3CA4F9182C04292A3008525B5D85B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F739381B31377CF4CA2197D45B844AA201850EA4E215E15F86CA6C1CEBD72BD6C536FE49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] Fix compilation of getmetatable() for UDTYPE_IO_FILE 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" Hi, Sergey! Thanks for the patch! Nice catch! Please, consider my comments below. On 07.11.24, Sergey Bronnikov wrote: > From: Sergey Bronnikov > > The patch fixes a problem with recording `getmetatable()` > for I/O object: recording of `getmetatable` call with a file Typo: s Typo: s/recording of/recording the/ Typo: s/a file/file/ > descriptors represented by userdata object `UDTYPE_IO_FILE` > (like `io.stdout`) leads to violation of assertion in > `rec_check_slots`. Nit: | ... by the userdata object `UDTYPE_IO_FILE` (like `io.stdout`) always | stores `nil` instead of the given metatable. This leads to the | violation of the assertion in `rec_check_slots`. > > Note, the problem was fixed upstream in different manner, see > commit 5141cbc20c43 Nit: Please, use full commit hash. Also, please describe that specialized recording (introduced in the upstream) lacks the check of the metatable precense. So, the fix in upstream is incomplete (according to the comment [1]). Also, please add both testcases from the issue comment [1] (don't forget to restore metatable after the first of them). > ("Fix compiliation of getmetatable() for UDTYPE_IO_FILE."). > --- > src/lj_record.c | 2 +- > ...-incorrect-recording-getmetatable.test.lua | 21 +++++++++++++++++++ > 2 files changed, 22 insertions(+), 1 deletion(-) > create mode 100644 test/tarantool-tests/lj-1279-incorrect-recording-getmetatable.test.lua > > diff --git a/src/lj_record.c b/src/lj_record.c > index cc97bdf9..7181b72a 100644 > --- a/src/lj_record.c > +++ b/src/lj_record.c > diff --git a/test/tarantool-tests/lj-1279-incorrect-recording-getmetatable.test.lua b/test/tarantool-tests/lj-1279-incorrect-recording-getmetatable.test.lua > new file mode 100644 > index 00000000..8bf22ca7 > --- /dev/null > +++ b/test/tarantool-tests/lj-1279-incorrect-recording-getmetatable.test.lua > @@ -0,0 +1,21 @@ > +local tap = require('tap') > + > +local test = tap.test('lj-1279-incorrect-recording-getmetatable') > +test:plan(1) > + > +-- A test file to demonstrate an incorrect recording of > +-- getmetatable() for I/O handlers. > +-- https://github.com/LuaJIT/LuaJIT/issues/1279 Nit: Usually the link is right before `tap.test()` declaration. > + > +jit.opt.start("hotloop=1") Nit: Please use single quotes. > + > +local obj = io.stdout Minor: I would rather name the variable like the corresponding type -- `ud_io_file`. Feel free to ignore. > +local getmetatable = getmetatable > + > +for _ = 1, 4 do > + _ = getmetatable(obj) > +end > + > +test:ok(true, 'getmetatable() recording is correct') Let's check the resulted metatable too. (We can use `test:samevalues()` here, for example.) > + > +test:done(true) > -- > 2.34.1 > [1]: https://github.com/LuaJIT/LuaJIT/issues/1279#issuecomment-2382392847 -- Best regards, Sergey Kaplun