<!DOCTYPE html>
<html data-lt-installed="true">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body style="padding-bottom: 1px;">
    <p>Sergey,</p>
    <p>thanks for the patch! See my comments.</p>
    <p>Sergey</p>
    <div class="moz-cite-prefix">On 7/2/26 17:28, Sergey Kaplun wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20260702142817.2292243-1-skaplun@tarantool.org">
      <pre wrap="" class="moz-quote-pre">RED OS for some reason sets `errno` to 2 ENOENT ("No such file or
directory") after the call to `mktime()`. So just skip the test for it.
---

Branch: <a class="moz-txt-link-freetext" href="https://github.com/tarantool/luajit/tree/skaplun/fix-os-time-test-redos">https://github.com/tarantool/luajit/tree/skaplun/fix-os-time-test-redos</a>
Failed workflow: <a class="moz-txt-link-freetext" href="https://github.com/tarantool/tarantool/actions/runs/28585213455/job/84775371860?pr=12886#step:5:20692">https://github.com/tarantool/tarantool/actions/runs/28585213455/job/84775371860?pr=12886#step:5:20692</a>

Side note: The errno is set for __any__ call to the `mktime()`.

Tested inside the following Docker:

===================================================================
FROM registry.red-soft.ru/ubi8/<a class="moz-txt-link-freetext" href="ubi-minimal:latest">ubi-minimal:latest</a>

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 RedOS incrorrect behaviour for mktime

 .../lj-1470-os-time-epoch-minus-1s.test.lua    | 18 +++++++++++++++++-
 1 file changed, 17 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..ebfe6f22 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,25 @@
 local tap = require('tap')
 
+local function detect_redos()
+  local read_file = require('utils').tools.read_file
+  local hasfile, data = pcall(read_file, '/etc/os-release')
+  if not hasfile then
+    -- Not Linux probably, so not the Red OS.
+    return false
+  else
+    return <a class="moz-txt-link-freetext" href="data:match('RED">data:match('RED</a> OS')
+  end
+end</pre>
    </blockquote>
    <p>Why do you think the problem is in RedOS, not in Glibc?</p>
    <p>I propose skipping test for some Glibc version using CMake macro </p>
    <p>introduced in the following commit:</p>
    <p>commit af0f59da76292f30ff75be1ab01458d47b226995<br>
      Author: Sergey Kaplun <a class="moz-txt-link-rfc2396E" href="mailto:skaplun@tarantool.org"><skaplun@tarantool.org></a><br>
      Date:   Wed Dec 4 15:03:56 2024 +0300<br>
      <br>
          test: fix LuaJIT-tests for old libc version<br>
    </p>
    <p>Otherwise, we will skip this test for always for RedOS.</p>
    <p>in RedOS 8 glibc version is 2.36-14:</p>
    <p>[root@pony /]# rpm -qa | grep glibc<br>
      glibc-common-2.36-14.red80.x86_64<br>
      glibc-gconv-extra-2.36-14.red80.x86_64<br>
      glibc-langpack-en-2.36-14.red80.x86_64<br>
      glibc-langpack-ru-2.36-14.red80.x86_64<br>
      glibc-2.36-14.red80.x86_64<br>
      glibc-devel-2.36-14.red80.x86_64<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>Also, why detect_redos() is not in utils.lua?</p>
    <blockquote type="cite"
      cite="mid:20260702142817.2292243-1-skaplun@tarantool.org">
      <pre wrap="" class="moz-quote-pre">
+
 -- The test file demonstrates os.time() fail to return -1 time
 -- value.
 -- See also: <a class="moz-txt-link-freetext" href="https://github.com/LuaJIT/LuaJIT/issues/1470">https://github.com/LuaJIT/LuaJIT/issues/1470</a>.
-local test = tap.test('lj-1470-os-time-epoch-minus-1s')
+local test = tap.test('lj-1470-os-time-epoch-minus-1s'):skipcond({
+  -- XXX: RED OS for some reason sets `errno` to 2 ENOENT ("No
+  -- such file or directory") after the call to `mktime()`. So
+  -- just skip the test for it.
+  ['RED OS incrorrect behaviour for mktime'] = detect_redos(),
+})
 
 <a class="moz-txt-link-freetext" href="test:plan(1)">test:plan(1)</a>
 
</pre>
    </blockquote>
  </body>
  <lt-container></lt-container>
</html>