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

Paul Eggert eggert at cs.ucla.edu
Tue Jun 7 00:49:11 UTC 2022

On 6/6/22 15:56, enh wrote:

> it's your mktime(), so you tell me :-)

tzdb mktime doesn't make any attempt to preserve errno on success. Even 
on a platform like bionic with primitives following a 
preserve-errno-on-success philosophy, tzdb functions can succeed after 
calling other functions that may fail and set errno. For example, 
tzset_unlocked can recover from a failed zoneinit (which sets errno) by 
calling zoneinit again.

> in bionic we use RAII to make functions "errno clean" all
> the time to avoid this kind of problem because it's too hard to reason
> about...)

If we wanted to make tzdb localtime.c and strftime.c "errno clean" it'd 
require some careful work. It'd be doable but I expect it's not a 
one-hour job (though perhaps you could prove me wrong :-).

More information about the tz mailing list