bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nstrftime %c bug w.r.t. time zone


From: Bruno Haible
Subject: Re: nstrftime %c bug w.r.t. time zone
Date: Fri, 09 Feb 2024 11:10:39 +0100

Paul Eggert wrote:
> > This patch provides a workaround, and thus removes the test-nstrftime-2.sh
> > failure at test-nstrftime.h:421.
> 
> I was thinking of something a bit more general: temporarily set the time 
> zone before calling the underlying strftime, and reset it afterwards.
> This of course won't work in a multithreaded system ...

Yes, this is not MT-safe. For 20 years I've been training myself to avoid
thinking in a non-MT-safe way, and apparently now in this case it worked :-)

> time_rz.c already does this sort of thing, and I suppose it could export 
> its secrets to nstrftime.c.

Ouch ouch. No, instead of making more code *not* MT-safe, we should make more
code MT-safe!

Indeed, time_rz.c with its setenv_TZ function is not MT-safe, and with it
also the modules
  nstrftime
  c-nstrftime
  fprintftime
  parse-datetime
!!

This is a show-stopper, since we've been discussing nstrftime and c-nstrftime,
as replacements to recommend to developers, for three days. And of course we
cannot recommend functions that look MT-safe but are not.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]