Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250605214537.GE1827@brightrain.aerifal.cx>
Date: Thu, 5 Jun 2025 17:45:37 -0400
From: Rich Felker <dalias@...c.org>
To: David Steele <david@...ackrest.org>
Cc: Markus Wichmann <nullplan@....net>, musl@...ts.openwall.com
Subject: Re: Possible issue formatting epoch time with strftime()

On Tue, Jun 03, 2025 at 09:52:43PM +0000, David Steele wrote:
> On 6/3/25 11:03, Markus Wichmann wrote:
> > Am Mon, Jun 02, 2025 at 07:33:41PM +0000 schrieb David Steele:
> > > Ubuntu 22.04 (UTC) gcc:
> > > 
> > > local epoch: 1573222014
> > > utc epoch: 1573240014
> > > local time: 20191108-090654
> > > utc time: 20191108-140654
> > > 
> > > [...]
> > > 
> > > Alpine 3.21 (America/New_York or UTC) gcc/musl:
> > > 
> > > local epoch: 1573222014
> > > utc epoch: 1573222014        <------
> > > local time: 20191108-090654
> > > utc time: 20191108-140654
> > > 
> > 
> > I think what happened here is that musl is currently implementing
> > non-standard extension behavior that is no longer conforming as of last
> > year. My reading of POSIX-2024 is that strftime() is to treat the
> > incoming timestamp as local time, at least for the purpose of a %s
> > conversion.  Which it isn't at the moment. But POSIX-2018 did not
> > specify %s at all, so musl was allowed to do whatever until POSIX-2024.
> 
> Interesting -- thanks for the analysis.
> 
> The only place this appears is in our unit tests so we can just remove it
> and add an assert to ensure we don't accidentally use it in core.
> 
> I did want to bring it up, though, just in case it needed to be fixed.

If it's non-conforming now it should be fixed. Is the new requirement
that %s treat the broken-down time as if it were in local time? Does
this create a new requirement that strftime behave as if it calls
tzset, and thereby a new environment dependency (and rule for when
it's safe to modify the environment), and is this addressed in the
standard?

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.