From: Jens Gustedt <jens.gustedt@inria.fr>
Cc: musl@lists.openwall.com
Subject: Re: printf doesn't respect locale
Date: Wed, 11 Sep 2019 20:08:19 +0200 [thread overview]
Message-ID: <20190911200819.67e671cd@inria.fr> (raw)
In-Reply-To: <20190911153853.GY9017@brightrain.aerifal.cx>
[-- Attachment #1: Type: text/plain, Size: 1762 bytes --]
On Wed, 11 Sep 2019 11:38:53 -0400 Rich Felker <dalias@libc.org> wrote:
> On Wed, Sep 11, 2019 at 05:15:45PM +0200, Jens Gustedt wrote:
> > Do you think that a highlevel implementation using _Thread_local or
> > (tss calls) and setlocale would be doable, such that we could even
> > provide a reference implementation for all POSIX systems that also
> > implement some form of thread local variables?
>
> It can't be done in terms of setlocale because setlocale is not
> thread-safe or thread-local. It could be done in terms of POSIX
> uselocale, but such an implementation would not be fail-safe -- it
> needs to be able to allocate a locale_t object via duplocale, since
> the uselocale API works with a locale_t objects that describe the
> value of *all* locale categories, rather than the categories being
> individually settable on a per-thread basis (this is a design flaw in
> the POSIX interfaces, and the historic xlocale ones they were based
> on, IMO).
Ok, yes this sounds too complicated.
> So such an implementation could be a pseudo-code/demo of the
> functionality, but I think I'd want the proposed functionality to be
> always-succeeds to discourage erroneous code that ignores the result
> (resulting in wrong formatting/parsing, which is unsafe) or aborts the
> program (eew).
Yes, "can't fail" is an important property for such a function. This
should be part of the normative requirement, then.
Jens
--
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536 ::
:: :::::::::::::::::::::: gsm France : +33 651400183 ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
prev parent reply other threads:[~2019-09-11 18:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-09 16:31 Daniel Schoepe
2019-09-09 16:39 ` Daniel Schoepe
2019-09-09 16:51 ` Szabolcs Nagy
2019-09-09 17:55 ` Rich Felker
2019-09-09 17:54 ` Rich Felker
2019-09-10 16:00 ` Daniel Schoepe
2019-09-10 16:31 ` Szabolcs Nagy
2019-09-10 16:44 ` Tim Tassonis
2019-09-10 17:30 ` Rich Felker
2019-09-10 17:10 ` Daniel Schoepe
2019-09-10 17:33 ` Rich Felker
2019-09-10 18:43 ` Szabolcs Nagy
2019-09-10 21:55 ` A. Wilcox
2019-09-11 10:01 ` Szabolcs Nagy
2019-09-11 10:07 ` Jens Gustedt
2019-09-11 11:44 ` Rich Felker
2019-09-11 12:53 ` Jens Gustedt
2019-09-11 13:47 ` Rich Felker
2019-09-11 15:15 ` Jens Gustedt
2019-09-11 15:38 ` Rich Felker
2019-09-11 18:08 ` Jens Gustedt [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190911200819.67e671cd@inria.fr \
--to=jens.gustedt@inria.fr \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).