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 1BE706ECD0; Tue, 30 Jun 2026 13:06:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1BE706ECD0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1782813967; bh=nwEL7lNgoL8Dki3YTazWAl8F5jU+1mdzoPmU8A8Z5BM=; 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=WJN2gTIja7GToePIj8Y7+fB6uWQSg8uKpTZ6EH0K8ZXrsr7LCBT3mUCcSucxMVCle flo7uF65H38D8E4LLBZQj+rz8L0yAbWigS2RozQPkxWvurfhzax8Gwx7Jy1r048EOt z7lUMaFPPLUcK5WohGyO4Ir8mlcT6JLLRUnIKVp4= Received: from send197.i.mail.ru (send197.i.mail.ru [95.163.59.36]) (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 B9D166ECD0 for ; Tue, 30 Jun 2026 13:06:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B9D166ECD0 Received: by exim-smtp-78b8b8c574-mttf2 with esmtpa (envelope-from ) id 1weVLw-000000007Hb-2qi2; Tue, 30 Jun 2026 13:06:05 +0300 Date: Tue, 30 Jun 2026 13:05:25 +0300 To: Evgeniy Temirgaleev Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD918D6BB028DF8CB6160F722F80D193856B2AF1D4CA356E611182A05F53808504035EC8FD42BE0CDF23DE06ABAFEAF6705727FD73FBA5FF851E97839EB5D6DBC73DEB700F1740BDFE9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7544B1CCE26E01C74EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB553375667C07923B88CEC0ED0FB2DF538309A89EE7413265C68BE965B7F4F230CA9711C7389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0DEC8C2C8BCD2534D8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6E232F00D8D26902CA471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CB0EC3B1FCAE4A06943847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A58EE4761227666EED5002B1117B3ED696C943BB9C6E58F47CE99897350C7C491E823CB91A9FED034534781492E4B8EEADFCE5E68AF59B345DBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D6597B1D9AC2B9F46A72F73E7407F1005CF5B97CBD05B29843EB8678DEC62581A04DD7E63AD6936223AEB8341EE9D5BE9A0A49F79BB6D84E26597E2E63F613A873715CE475928A69D2DE6536EB022892E5344C41F94D744909CECFA6C6B0C050A61A8CAF69B82BA93681CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVRSZSJkMhZtMKVJp3XFnIIE= X-DA7885C5: 485D50E7D8DE66D2F255D290C0D534F981A1B75095FF5965C9356E845808419D9BA577E2BE81A1A85B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393520AF17B8A65FDE2AEAA4216D6E954CE02B0CBAEF309A9BB5034C7FB62CDC4E1E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 1/2] Fix corner case of os.time(). 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, Evgeniy! Thanks for the patch! LGTM, with minor nits below. On 29.06.26, Evgeniy Temirgaleev wrote: > From: Mike Pall > > Thanks to Temir Galeev. #1470 Please strip the issue number to avoid overmentioning the ticket on GitHub. (The Issue can be easily found by the cherry-picked commit, though). This helps to avoid overmentioning during the review and applying the patch to long-term branches. > > (cherry picked from commit 72d2061ae2fa9a5fd45237943f9982baf59435ec) > > This patch fixes invalid os.time(t) behavior, when it handles -1 time value Typo: s/, when/ when/ Typo: s/-1/the -1/ > as a fail of the libc mktime() regardless of the errno value. > > Temir Galeev: > * added the description and the test for the patch > > Part of tarantool/tarantool#12480 > --- > src/lib_os.c | 3 ++- > .../lj-1470-os-time-epoch-minus-1s.test.lua | 12 ++++++++++++ > 2 files changed, 14 insertions(+), 1 deletion(-) > create mode 100644 test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua > > diff --git a/src/lib_os.c b/src/lib_os.c > index ffbc3fdc..f6841357 100644 > --- a/src/lib_os.c > +++ b/src/lib_os.c > @@ -242,9 +242,10 @@ LJLIB_CF(os_time) > ts.tm_mon = getfield(L, "month", -1) - 1; > ts.tm_year = getfield(L, "year", -1) - 1900; > ts.tm_isdst = getboolfield(L, "isdst"); > + errno = 0; > t = mktime(&ts); > } > - if (t == (time_t)(-1)) > + if (t == (time_t)(-1) && errno != 0) > lua_pushnil(L); > else > lua_pushnumber(L, (lua_Number)t); > diff --git a/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua b/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua > new file mode 100644 > index 00000000..6b5703e4 > --- /dev/null > +++ b/test/tarantool-tests/lj-1470-os-time-epoch-minus-1s.test.lua > @@ -0,0 +1,12 @@ > +local tap = require('tap') > + > +-- The test file demonstrates os.time() fail to return -1 time value. Side note: It looks like the patch is outdated compared to the branch. > +-- See also: https://github.com/LuaJIT/LuaJIT/issues/1470. > +local test = tap.test('lj-1470-os-time-epoch-minus-1s') > + > +test:plan(1) > + > +local minus_1s_time = os.date("*t", -1) Nit: We use everywhere in Lua code single quotes if possible (see other tests). > +test:is(os.time(minus_1s_time), -1, 'correct os.time()') > + > +test:done(true) > -- > 2.49.0 > -- Best regards, Sergey Kaplun