<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/95612>95612</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libcxx] Test 'time.zone.members/get_info.local_time.pass.cpp' fails on Debian 11.8
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            mordante
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zeroomega
      </td>
    </tr>
</table>

<pre>
    PR #89537 Introduced `time.zone.members/get_info.local_time.pass.cpp`. We observed that this tests fails on certain builders but passes on others. A closer look turns out that On Linux, this test will read host system's time zone database located at `/usr/share/zoneinfo/tzdata.zi` . On Debian system, this file is provided by package `tzdata`. On Debian 11.8, the version of this package is `2021a-1+deb11u11` while on newer version (e.g. Debian 11.9), this package is `2024a-0+deb11u1`. 

On Debian 11.8 system (didn't test even older system but likely will fail too). This test will fail with following messages:

```
******************** TEST 'llvm-libc++-static.cfg.in :: std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp' FAILED ********************
Exit Code: 250

Command Output (stdout):
--
# COMPILED WITH
/b/s/w/ir/x/w/llvm_build/./bin/clang++ /b/s/w/ir/x/w/llvm-llvm-project/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp -pthread --target=x86_64-unknown-linux-gnu -nostdinc++ -I /b/s/w/ir/x/w/llvm_build/include/c++/v1 -I /b/s/w/ir/x/w/llvm_build/include/x86_64-unknown-linux-gnu/c++/v1 -I /b/s/w/ir/x/w/llvm-llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Werror=thread-safety -Wuser-defined-warnings  -lc++experimental -nostdlib++ -L /b/s/w/ir/x/w/llvm_build/./lib/x86_64-unknown-linux-gnu -lc++ -lc++abi -o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/test/std/time/time.zone/time.zone.timezone/time.zone.members/Output/get_info.local_time.pass.cpp.dir/t.tmp.exe
# executed command: /b/s/w/ir/x/w/llvm_build/./bin/clang++ /b/s/w/ir/x/w/llvm-llvm-project/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp -pthread --target=x86_64-unknown-linux-gnu -nostdinc++ -I /b/s/w/ir/x/w/llvm_build/include/c++/v1 -I /b/s/w/ir/x/w/llvm_build/include/x86_64-unknown-linux-gnu/c++/v1 -I /b/s/w/ir/x/w/llvm-llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L /b/s/w/ir/x/w/llvm_build/./lib/x86_64-unknown-linux-gnu -lc++ -lc++abi -o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/test/std/time/time.zone/time.zone.timezone/time.zone.members/Output/get_info.local_time.pass.cpp.dir/t.tmp.exe
# EXECUTED AS
/b/s/w/ir/cipd_bin_packages/cpython3/bin/python3.8 /b/s/w/ir/x/w/llvm-llvm-project/libcxx/utils/run.py --execdir /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/test/std/time/time.zone/time.zone.timezone/time.zone.members/Output/get_info.local_time.pass.cpp.dir -- /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/test/std/time/time.zone/time.zone.timezone/time.zone.members/Output/get_info.local_time.pass.cpp.dir/t.tmp.exe
# executed command: /b/s/w/ir/cipd_bin_packages/cpython3/bin/python3.8 /b/s/w/ir/x/w/llvm-llvm-project/libcxx/utils/run.py --execdir /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/test/std/time/time.zone/time.zone.timezone/time.zone.members/Output/get_info.local_time.pass.cpp.dir -- /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/test/std/time/time.zone/time.zone.timezone/time.zone.members/Output/get_info.local_time.pass.cpp.dir/t.tmp.exe
# .---command stderr------------
# | Assertion failure: lhs.end == rhs.end /b/s/w/ir/x/w/llvm-llvm-project/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp 78
# | 
# | End:
# | Expected output 1880-08-02 00:25:21
# | Actual output   1880-08-02 00:25:00
# `-----------------------------
# error: command failed with exit status: 250

--

********************
```

This test will pass is `tzdata` package is updated to a newer version. With some local instrumentation, we located code for the failed test here: https://github.com/llvm/llvm-project/blob/de736d9c6a7634285c4283b369a9442a9d191cd9/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp#L866-L876

libcxx tests or LLVM tests in general should be made as hermetic as possible. This detailed system environment setup shouldn't affect the tests results like this. Therefore should be treated as a bug and we should fix it.

Steps to reproduce with docker on a Debian based Linux:

* Build libcxx and its tests for Linux x64 (other arch is also OK but we didn't test it). (revision de736d9c6a7634285c4283b369a9442a9d191cd9)
* Locate the test file generated for 'time.zone.members/get_info.local_time.pass.cpp', which should be in build directory with path like `test/std/time/time.zone/time.zone.timezone/time.zone.members/Output/get_info.local_time.pass.cpp.dir/t.tmp.exe` . A prebuilt for linux-x64 can be downloaded from here: [t.tmp.exe.zip](https://github.com/user-attachments/files/15844194/t.tmp.exe.zip), but we recommend you build your own.
* Copy the test file `t.tmp.exe` to an newly created directory, assuming it is `/path/to/build_dir`
* Run `docker run --mount type=bind,src=/path/to/build_dir,dst=/build_dir debian:11.8 /build_dir/t.tmp.exe`. You should see error message like:

```
Assertion failure: lhs.end == rhs.end /b/s/w/ir/x/w/github-zeroomega-llvm-project/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp 77

End:
Expected output 1880-08-02 00:25:21
Actual output 1880-08-02 00:25:00
```

* Run `docker run --mount type=bind,src=/path/to/build_dir,dst=/build_dir debian:11.9 /build_dir/t.tmp.exe`. You should see error message disappeared.

I also attached the timezone data file from the bots which fail and pass this test.
[tzdata.zi.zip](https://github.com/user-attachments/files/15844218/tzdata.zi.zip)


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsGl1v4zby1ygvAwoy_f2QBye22-CyyWI3d2mfDEoc27ylSIGkYmd__WEo2Za3-9Vsrz30EgS2SZHD-Z7RDIX3amMQL5PhVcJ5aZ0UJmDCeTKcX4g6bK27_IjO2hI34iK38vny7TtIeH8yHfbHcGOCs7IuUEIyy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