[tz] Invalid tm handling in %s pattern in strftime

Paul Eggert eggert at cs.ucla.edu
Tue Jun 7 02:07:49 UTC 2022


On 6/6/22 18:23, enh wrote:
> i think the safest choice for bionic is probably just "disable the new
> check and preserve the old behavior".

Yes, that sounds right.

Come to think of it, that's simpler (and arguably better) on all 
platforms. That is, if you give strftime a format containing %s, you 
must also pass a struct tm that came from a successful localtime call; 
otherwise behavior is undefined. In the undefined case tzdb strftime can 
simply output (time_t)-1 for %s.

Proposed patch attached and installed into the development repository. 
This doesn't affect tzdb itself, as tzdb never gets into this situation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-strftime-s-no-longer-worries-about-mktime-failure.patch
Type: text/x-patch
Size: 2514 bytes
Desc: not available
URL: <https://mm.icann.org/pipermail/tz/attachments/20220606/d28e07b3/0001-strftime-s-no-longer-worries-about-mktime-failure.patch>


More information about the tz mailing list