Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>,
	Evgeniy Temirgaleev <e.temirgaleev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 luajit] test: skip lj-1470 test for unconfigured timezones
Date: Thu, 02 Jul 2026 22:41:05 +0300	[thread overview]
Message-ID: <E6CDBDA9-17F2-4C34-8832-58E5F0CB1B60@tarantool.org> (raw)
In-Reply-To: <20260702192103.2399743-1-skaplun@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 3399 bytes --]

Sergey,

thanks for the patch, LGTM.

Sergey

2 июля 2026 г. 22:21:03 GMT+03:00, Sergey Kaplun <skaplun@tarantool.org> пишет:
>`os.time()` uses `mktime()` to specify time by the given table.
>`mktime()` produces the call to `tzset()` to determine the system's
>timezone. If the TZ variable does not appear in the environment, the
>system timezone is used. The system timezone is configured by copying,
>or linking, a file in the tzfile(5) format to /etc/localtime. So, if
>this file is omitted (like in RED OS), the errno is set to a non-zero
>value. This leads to the nil returned by the `os.time()` for -1 time
>value.
>
>This patch skips the test if this file is missed to be sure that we
>don't obtain any false positive failures due to system
>misconfigurations.
>---
>
>Branch: https://github.com/tarantool/luajit/tree/skaplun/fix-os-time-test-redos
>Failed workflow: https://github.com/tarantool/tarantool/actions/runs/28585213455/job/84775371860?pr=12886#step:5:20692
>
>Tested inside the following Docker:
>
>===================================================================
>FROM registry.red-soft.ru/ubi8/ubi-minimal:latest
>
>RUN dnf update -y && \
>    dnf install -y cmake vim make git curl gcc g++ gdb man && \
>    dnf clean all
>===================================================================
>
>| docker build . --tag redos
>| docker run --network=host -ti redos bash
>
>Then clone LuaJIT and proceed as usual.
>
>With the patch the test skipped:
>| 1..0 # SKIP Unconfigured timezone rules
>
>Changes in v2:
>
>* Skip patch not for RED OS but for all distributions with unconfigured
>  timezones (i.e. missing '/etc/localtime').
>
> .../lj-1470-os-time-epoch-minus-1s.test.lua   | 20 ++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
>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
>index dfe1ee11..48c6c3a3 100644
>--- 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
>@@ -1,9 +1,27 @@
> local tap = require('tap')
> 
>+local function unconfigured_timezone()
>+  -- `os.time()` uses `mktime()` to specify time by the given
>+  -- table. `mktime()` produces the call to `tzset()` to determine
>+  -- the system's timezone.
>+  -- If the TZ variable does not appear in the environment, the
>+  -- system timezone is used. The system timezone is configured by
>+  -- copying, or linking, a file in the tzfile(5) format to
>+  -- /etc/localtime. So, if this file is omitted, the errno is
>+  -- set to a non-zero value. This leads to the nil returned by
>+  -- the `os.time()` for -1 time value. Let's skip the test if
>+  -- this file is missed to be sure that we don't obtain any false
>+  -- positive failures due to system misconfigurations.
>+  local f = io.open('/etc/localtime', 'r')
>+  return not f
>+end
>+
> -- The test file demonstrates os.time() fail to return -1 time
> -- value.
> -- See also: https://github.com/LuaJIT/LuaJIT/issues/1470.
>-local test = tap.test('lj-1470-os-time-epoch-minus-1s')
>+local test = tap.test('lj-1470-os-time-epoch-minus-1s'):skipcond({
>+  ['Unconfigured timezone rules'] = unconfigured_timezone(),
>+})
> 
> test:plan(1)
> 
>-- 
>2.54.0
>

[-- Attachment #2: Type: text/html, Size: 3924 bytes --]

      reply	other threads:[~2026-07-02 19:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 19:21 Sergey Kaplun via Tarantool-patches
2026-07-02 19:41 ` Sergey Bronnikov via Tarantool-patches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E6CDBDA9-17F2-4C34-8832-58E5F0CB1B60@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=e.temirgaleev@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 luajit] test: skip lj-1470 test for unconfigured timezones' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox