[tz] [musl] Re: Weird PST8PDT and EST5EDT behavior on Alpine Linux

Rich Felker dalias at libc.org
Tue Mar 5 20:12:47 UTC 2024


On Tue, Mar 05, 2024 at 10:52:23AM +0700, Đoàn Trần Công Danh wrote:
> On 2024-03-03 22:51:49-0800, Russ Allbery via tz <tz at iana.org> wrote:
> > Why would the system decide that time stamp should use daylight saving
> > time?  The system time zone is set to UTC, so it shouldn't be some sort of
> > contamination from it.  Or is this some odd bug in the busybox date
> > command?  It works correctly with busybox 1.36.1 on a Debian system,
> > though:
> > 
> > % busybox env TZ=PST8PDT date -R -d @1643145780
> > Tue, 25 Jan 2022 13:23:00 -0800
> > 
> > The Alpine Linux system in question does have PST8PDT and EST5EDT files in
> > /usr/share/zoneinfo.  The Olson time zone identifiers do work as expected:
> 
> 
> Please correct me if I were wrong!
> (also added musl-lib list)
> 
> I believe it's musl-libc's behaviours.
> 
> Both PST8PDT and EST5EDT are timezones in POSIX form.
> musl specificly check for that first [1].
> 
> Time POSIX form is (space inserted for clarity):
> 
> 	std offset[dst[offset][,start[/time],end[/time]]]
> 
> But seems like nothings was enforced if rule isnot given in the
> timezone, which makes it open to intepretion.
> 
> Musl inteprete that as no transition at all [2].

Yes, it's not clear to me (POSIX doesn't seem to specify) what the
default rules should be when none are specified. However, it is clear
that these strings meet the syntax for the POSIX TZ form, and thus
musl does not attempt to interpret them as filenames, which could
result in behavior contrary to the specified meaning.

If you want to use a file by that name, the safe way to request that
is by prefixing it with a colon, as in TZ=:PST8PDT

Rich



More information about the tz mailing list