From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2175 invoked from network); 25 Apr 2021 17:47:17 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 25 Apr 2021 17:47:17 -0000 Received: (qmail 28154 invoked by uid 550); 25 Apr 2021 17:47:10 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 28124 invoked from network); 25 Apr 2021 17:47:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=l4J/I0vSbT KF3aI7jRVqnHTb4YCb40lZAUUnBZAHP5Q=; h=from:subject:to:date; d=soeren-tempel.net; b=sipt6YNJK/m6/E3AEWBZMoJvD3EF7/88PjoYC/0WDW6J4+a 7zWOC4a9jkEUiqOjlCMwJFbDgsXZoOF+fBVHe9M+12rHdiDLWE6TYyox8tmAKFKPq5d0Xf 4tU0sdkPm/QNfId8Jl5Z5dqM58HHsglE1ycVT5+NnH/bG2RzdVTIF0= Date: Sun, 25 Apr 2021 19:46:51 +0200 To: musl@lists.openwall.com From: =?UTF-8?Q?S=C3=B6ren?= Tempel Message-Id: <2V3462FZGWFIY.1YKM4G9ZM41UC@8pit.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [musl] Handling of non-location specific TZ values Hi, While debugging a test failure of the calendar application calcurse on Alpine I noticed that musl does not support TZ values which don't include area/location information, e.g. TZ=3DCET [0]. This is contrary to the documentation from the musl wiki which states the following [1]: The zoneinfo file is interpreted as an absolute pathname if it begins with a slash, a relative pathname if it begins with a dot, and otherwise is searched in /usr/share/zoneinfo, /share/zoneinfo, and /etc/zoneinfo. Since commit 5c4f11d995cf178b3146cde0734d6988c145f243 musl only consults the zoneinfo database if the value of the TZ environment variable starts with a colon or contains a slash [2]. As such, the zoneinfo database is not consulted for TZ=3DCET thereby causing musl to not determine DST etc. correctly for such TZ values. TZ values such as Europe/Kaliningrad are correctly looked up in the zoneinfo database though. The aforementioned commit claims that this strict check is necessary since "TZ=3Dname is reserved for POSIX-form" which consists of a mandatory timezone name (std), an offset, and some more optional information [3]. **If** TZ values adhering to the POSIX format should not be looked up in the zoneinfo database, it would be necessary to somehow determine if a given string adheres to the POSIX timezone format before performing the lookup. The glibc implementation seems to unconditionally consult the zoneinfo database and falls back to the POSIX format (__tzset_parse_tz) if no corresponding file was found in the database [4]. Apart from glibc, the non-POSIX TZ format with TZ=3D is also supported BSDs, e.g. OpenBSD [5]. Any thoughts on how this could fixed in musl? Greetings, S=C3=B6ren [0]: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/19695 [1]: https://wiki.musl-libc.org/environment-variables.html [2]: https://git.musl-libc.org/cgit/musl/commit/?id=3D5c4f11d995cf178b3146c= de0734d6988c145f243 [3]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.ht= ml#tag_08_03 [4]: https://sourceware.org/git/?p=3Dglibc.git;a=3Dblob;f=3Dtime/tzset.c;h=3D= 2fc51194b63bda8eeaff4f2ac111291ff43c28ad;hb=3D24f261f27fb8fd19ae294ff2a13bc= 5b7a0bafc91#l405 [5]: https://github.com/openbsd/src/blob/2207c4325726fdc5c4bcd0011af0fdf7d3= dab137/lib/libc/time/Theory