apache / apache/arrow

[C++] Vendored date library does not respect TZDIR environment variable

Open
#49,351 0 comments 0 reactions 1 assignee Claimed by @canassa View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

The vendored Howard Hinnant date library hardcodes `/usr/share/zoneinfo` as the timezone database path in `discover_tz_dir()` (`cpp/src/arrow/vendored/datetime/tz.cpp`). It does not check the `TZDIR` environment variable, which is the POSIX standard mechanism for overriding this path.

This causes timezone operations to fail on non FHS Linux distributions such as NixOS, where `zoneinfo` resides under a non standard path like `/nix/store/.../share/zoneinfo`.

The upstream library also lacks `TZDIR` support

### Reproduction

On NixOS without a `TZDIR` patch:

```python
import pyarrow as pa

arr = pa.array([1], type=pa.timestamp("s", tz="America/New_York"))
# Fails: discover_tz_dir failed to find zoneinfo
```

### Expected Behavior

Arrow should check `TZDIR` before falling back to hardcoded paths, consistent with POSIX conventions and tools such as glibc, busybox, and Python's `zoneinfo` module.

### Component(s)

C++

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.