From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14660 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jens Gustedt Newsgroups: gmane.linux.lib.musl.general Subject: Re: printf doesn't respect locale Date: Wed, 11 Sep 2019 20:08:19 +0200 Organization: inria.fr Message-ID: <20190911200819.67e671cd@inria.fr> References: <20190910163143.GI22009@port70.net> <20190910184312.GJ22009@port70.net> <539924f1-6cdb-0652-e9bf-4c5e6922823d@adelielinux.org> <20190911100159.GK22009@port70.net> <20190911120722.6ed0b3fb@inria.fr> <20190911114437.GS9017@brightrain.aerifal.cx> <20190911145336.08554c4e@inria.fr> <20190911134727.GU9017@brightrain.aerifal.cx> <20190911171545.437a2033@inria.fr> <20190911153853.GY9017@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/Er5C/r5LRKicfVFhhz+r7H4"; protocol="application/pgp-signature"; micalg=pgp-sha1 Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="269327"; mail-complaints-to="usenet@blaine.gmane.org" Cc: musl@lists.openwall.com Original-X-From: musl-return-14676-gllmg-musl=m.gmane.org@lists.openwall.com Wed Sep 11 20:08:36 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1i872h-0017xb-VB for gllmg-musl@m.gmane.org; Wed, 11 Sep 2019 20:08:36 +0200 Original-Received: (qmail 32177 invoked by uid 550); 11 Sep 2019 18:08:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 32159 invoked from network); 11 Sep 2019 18:08:32 -0000 X-IronPort-AV: E=Sophos;i="5.64,494,1559512800"; d="scan'208";a="401302196" In-Reply-To: <20190911153853.GY9017@brightrain.aerifal.cx> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAACRQTFRFERslNjAsLTE9Ok9wUk9TaUs8iWhSrYZkj42Rz6aD3sGZ Xref: news.gmane.org gmane.linux.lib.musl.general:14660 Archived-At: --Sig_/Er5C/r5LRKicfVFhhz+r7H4 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 11 Sep 2019 11:38:53 -0400 Rich Felker 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? =20 >=20 > 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 --=20 :: 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 :: --Sig_/Er5C/r5LRKicfVFhhz+r7H4 Content-Type: application/pgp-signature Content-Description: Digitale Signatur von OpenPGP -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSN9stI2OFN1pLljN0P0+hp2tU34gUCXXk4EwAKCRAP0+hp2tU3 4i4JAJ9MtdlncRn9JP60iE5xmj/3uci8kwCgmm4zrB2i8wh5lj6ZHFzTQioCr3Y= =ef2x -----END PGP SIGNATURE----- --Sig_/Er5C/r5LRKicfVFhhz+r7H4--