From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Subject: Re: nstrftime %c bug w.r.t. time zone
Date: Fri, 09 Feb 2024 11:10:39 +0100 [thread overview]
Message-ID: <5810074.1B3tZ46Xf9@nimes> (raw)
In-Reply-To: <d6dad056-46ba-46e5-aefe-6588079042ad@cs.ucla.edu>
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
prev parent reply other threads:[~2024-02-09 10:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 0:04 nstrftime %c bug w.r.t. time zone Bruno Haible
2024-02-08 11:50 ` Bruno Haible
2024-02-08 13:55 ` Bruno Haible
2024-02-09 7:36 ` Paul Eggert
2024-02-09 10:10 ` Bruno Haible [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5810074.1B3tZ46Xf9@nimes \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=eggert@cs.ucla.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).