Re: setlocale: Update a comment.

2025-06-03 Thread Bruno Haible via Gnulib discussion list
Hi Collin, > I pushed this one line patch to update a comment that was written before > localename-unsafe.c existed. Thanks!

setlocale: Update a comment.

2025-06-03 Thread Collin Funk
ibc-alpha/bd1c3df2b8aaaeaf6199e715212db67d2b80266f.1748980203.git.collin.fu...@gmail.com/T/#u >From 61c4a6ae9ebdbabdfdcc0175b6f467419bada300 Mon Sep 17 00:00:00 2001 Message-ID: <61c4a6ae9ebdbabdfdcc0175b6f467419bada300.1748980594.git.collin.fu...@gmail.com> From: Collin Funk Date:

setlocale-null: Fix autoconf warning

2025-03-20 Thread Bruno Haible via Gnulib discussion list
e-Required configure.ac:38: gl_INIT is expanded from... configure.ac:957: the top level This patch fixes it. 2025-03-21 Bruno Haible setlocale-null: Fix autoconf warning. * m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Define through AC_DEFUN_ONCE. diff

new module 'setlocale-messages'

2025-02-21 Thread Bruno Haible via Gnulib discussion list
This patch extracts the base of the Windows LC_MESSAGES workaround into a separate module 'setlocale-messages', so that the module 'getlocalename_l' can depend on it without using the (large) 'setlocale' module. 2025-02-21 Bruno Haible setlocale-messa

setlocale: Relicense under LGPLv2+

2025-02-20 Thread Bruno Haible via Gnulib discussion list
A gnulib implementation of the POSIX:2024 function getlocalename_l will likely depend on or require code from lib/setlocale.c. Since I want that module to be under LGPLv2+, 'setlocale' needs to be under LGPLv2+ as well. I can do this relicensing, since I am the only author of copyrigh

setlocale: Update info about Galician and Tamil

2025-02-12 Thread Bruno Haible via Gnulib discussion list
I'm not sure how many people use a Galician or Tamil locale on macOS. But anyway: 2025-02-12 Bruno Haible setlocale: Update info about Galician and Tamil. * lib/setlocale.c (locales_with_principal_territory): Galician is mostly spoken in Spain, not Portugal. Tam

setlocale: Handle LC_MESSAGES correctly on native Windows

2024-12-23 Thread Bruno Haible via Gnulib discussion list
On native Windows, LC_MESSAGES does not exist in ; Gnulib adds a definition of it. Accordingly, setlocale() needs to be taught to handle the LC_MESSAGES category as part of LC_ALL. The code for doing this was incomplete. The first of these patches fixes it. The second patch adds a unit test

localename: Notice setlocale() invocations on more platforms

2024-02-14 Thread Bruno Haible
When a program calls setlocale() with some argument that is not reflected in the environment variables, ideally the gl_locale_name function should return that locale. Currently this is enabled only for glibc systems. But it is actually possible to do the same thing on some other platforms as well

mbrtowc, mbrtoc32, nl_langinfo, setlocale-null: Obey --disable-threads

2023-11-17 Thread Bruno Haible
the gnulib code that tests HAVE_PTHREAD_API. Since the ability to build a library without dependency on -lpthread can be seen as a useful feature, I'm implementing it here. 2023-11-17 Bruno Haible mbrtowc, mbrtoc32, nl_langinfo, setlocale-null: Obey --disable-threads. Repor

setlocale: Update after Turkey changed its name

2022-06-03 Thread Bruno Haible
Turkey has renamed itself, see https://edition.cnn.com/2022/06/02/europe/turkey-trkiye-united-nations-scli-intl/index.html 2022-06-03 Bruno Haible setlocale: Update after Turkey changed its name. * lib/setlocale.c: Update comments. diff --git a/lib/setlocale.c b/lib

Re: setlocale with NULL locale (to read current locale) segfaults on MSYS

2022-05-02 Thread Bruno Haible
Reuben Thomas asked: > I'm interested in why you suspect MSYS would be worse than mingw? Is it > because it is not as widely used as mingw That is one factor. The other one is that they welcome changes that are buggy in the long run, such as - in MSYS1, the argv[] processing in the middle of the

Re: setlocale with NULL locale (to read current locale) segfaults on MSYS

2022-05-02 Thread Reuben Thomas
On Mon, 2 May 2022 at 01:05, Bruno Haible wrote: > > We have documented hundreds of deficiencies of mingw [1] w.r.t. the POSIX > standard. MSYS is surely worse, not better, than mingw. I recommend to use > the respective modules, for those POSIX APIs that you use. > I'm happy to decide that on a

Re: setlocale with NULL locale (to read current locale) segfaults on MSYS

2022-05-01 Thread Bruno Haible
Reuben Thomas wrote: > > In the end I tried something a bit different, which was to reduce the > > > number of gnulib modules I was using, as for the code I'm writing it > > > seemed > > > reasonable to assume C99 and POSIX.1-2008. > > > > ?? That makes no sense to me. Either you want to assume PO

Re: setlocale with NULL locale (to read current locale) segfaults on MSYS

2022-05-01 Thread Reuben Thomas
On Sun, 1 May 2022 at 22:34, Bruno Haible wrote: > Reuben Thomas wrote: > > It's not really that I'm doing anything: gnulib seems to detect MSYS as > > being a POSIX platform. > > Not really; something in the configure step (which you haven't shown) > made it "detect" some POSIX threads facility.

Re: setlocale with NULL locale (to read current locale) segfaults on MSYS

2022-05-01 Thread Bruno Haible
Reuben Thomas wrote: > It's not really that I'm doing anything: gnulib seems to detect MSYS as > being a POSIX platform. Not really; something in the configure step (which you haven't shown) made it "detect" some POSIX threads facility. > In the end I tried something a bit different, which was to

Re: setlocale with NULL locale (to read current locale) segfaults on MSYS

2022-05-01 Thread Reuben Thomas
On Sat, 30 Apr 2022 at 12:44, Bruno Haible wrote: > Reuben Thomas wrote: > > on MSYS it goes wrong > > ... > > setlocale_null_with_lock (category=category@entry=0, buf=buf@entry > =0xbd80 > > "", bufsize=bufsize@entry=3221) at setlocale_null.c:228 > > 228 if (pthread_in_use()) > > (gdb)

Re: setlocale with NULL locale (to read current locale) segfaults on MSYS

2022-04-30 Thread Bruno Haible
Reuben Thomas wrote: > on MSYS it goes wrong > ... > setlocale_null_with_lock (category=category@entry=0, buf=buf@entry=0xbd80 > "", bufsize=bufsize@entry=3221) at setlocale_null.c:228 > 228 if (pthread_in_use()) > (gdb) > 230 pthread_mutex_t *lock = gl_get_setlocale_null_lock (

setlocale with NULL locale (to read current locale) segfaults on MSYS

2022-04-29 Thread Reuben Thomas
It works fine on mingw32 and mingw64, but on MSYS it goes wrong when calling pthread_mutex_lock. In the following gdb session, the first line is from my code; the rest is tracing through gnulib code. (gdb) n 171 char *old_locale = setlocale(LC_ALL, NULL); (gdb) s rpl_setlocale (category=0

[PATCH] setlocale-null-tests: work around GCC bug 44511

2020-11-21 Thread Paul Eggert
insertions(+) diff --git a/ChangeLog b/ChangeLog index d46bfbb1a..de92d102e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2020-11-21 Paul Eggert + setlocale-null-tests: work around GCC bug 44511 + * tests/test-setlocale_null-mt-all.c: + * tests/test-setlocale_null-mt

setlocale-null: avoid crashing the MSVC linker

2020-01-02 Thread Bruno Haible
printf.lo setlocale.lo setlocale-lock.lo setlocale_null.lo version.lo xsize.lo osdep.lo intl-compat.lo windows-mutex.lo windows-rwlock.lo windows-recmutex.lo windows-once.lo libintl.res.lo libtool: link: dumpbin -symbols .libs/bindtextdom.obj .libs/dcgettext.obj .libs/dgettext.obj .libs/gettext

Re: setlocale: make calls with NULL argument multithread-safe

2020-01-01 Thread Bruno Haible
On 2019-12-18 I wrote: > Use of setlocale(), with the gnulib override, now requires linking > with $(LIB_SETLOCALE) - to avoid link errors on AIX. I see such a link error on AIX: xlC -q64 -qthreaded -qtls -DHAVE_CONFIG_H -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_T

Re: new module 'setlocale-null'

2019-12-24 Thread Bruno Haible
Another tweak of this module: Add the ability to rely on the lock defined in another library. This makes it possible to avoid a link error regarding libgettextpo and libintl on Windows. 2019-12-24 Bruno Haible setlocale-null: Make it easy to rely on the lock in another library

Re: new module 'setlocale-null'

2019-12-22 Thread Bruno Haible
This patch ensures that the gl_get_setlocale_null_lock function gets exported from shared libraries (such as libintl.so) also on ELF systems, so that different shared libraries attached to the same process use the same lock. 2019-12-23 Bruno Haible setlocale-null: Export the lock

Re: new module 'setlocale-null'

2019-12-22 Thread Bruno Haible
While for most package, it is a convenience to have the setlocale_null function declared in , for gettext's libintl it's better to have it declared in a separate header file - because libintl does not use the gnulib-overridden locale.h file. 2019-12-22 Bruno Haible setl

Re: setlocale: make calls with NULL argument multithread-safe

2019-12-21 Thread Bruno Haible
> * modules/setlocale-tests (Makefile.am): Link the test programs with > $(LIB_SETLOCALE). > ... > * modules/nl_langinfo-tests (Makefile.am): Likewise. I missed one test program that also calls setlocale(). 2019-12-21 Bruno Haible nl_langinfo tests: Fi

Re: setlocale: make calls with NULL argument multithread-safe

2019-12-18 Thread Bruno Haible
Part of this new code in setlocale.c would also be useful for localename.c. I'm therefore moving it to module 'setlocale-null'. At the same time, I'm renaming the function setlocale_null to setlocale_null_r (in analogy with getlogin_r, ttyname_r, ptsname_r). 2019

setlocale: make calls with NULL argument multithread-safe

2019-12-18 Thread Bruno Haible
This patch makes use of the 'setlocale-null' module, to make the setlocale(..., NULL) calls multithread-safe. Use of setlocale(), with the gnulib override, now requires linking with $(LIB_SETLOCALE) - to avoid link errors on AIX. Although we now have two modules 'setlocale-null&

Re: new module 'setlocale-null'

2019-12-18 Thread Bruno Haible
setlocale (category, NULL)_can return NULL in two situations: - when the category argument is invalid, or - on Android (tested on Android 4.3). 2019-12-18 Bruno Haible setlocale-null: Handle NULL result from setlocale. * lib/locale.in.h (setlocale_null): Document EINVAL

setlocale-null: remove need for -lpthread on musl libc, *BSD, Haiku

2019-12-16 Thread Bruno Haible
This patch removes the need to link with -lpthread on several platforms, by using the "weak symbols" trick from lock.h. With this, the only platform on which setlocale-null requires -lpthread is AIX. 2019-12-16 Bruno Haible setlocale-null: Remove need for -lpthread on musl

new module 'setlocale-null'

2019-12-15 Thread Bruno Haible
It is the usual expectation that use of setlocale() to change the global locale is not multithread-safe (of course), but that setlocale(...,NULL) to query the name of the global locale is. However, POSIX does not guarantee it: <https://pubs.opengroup.org/onlinepubs/9699919799/functi

Re: Octave link failure with gnulib setlocale, missing CoreFoundation

2019-11-18 Thread Bruno Haible
has code to pull it in, in the gt_INTL_MACOSX macro. Yes. > However, gt_INTL_MACOSX is only invoked in the m4/gettext.m4 file, in > AM_GNU_GETTEXT, not from gl_FUNC_SETLOCALE in m4/setlocale.m4. gt_INTL_MACOSX is also required by gl_LOCALENAME in m4/localename.m4, part of module 'loc

Octave link failure with gnulib setlocale, missing CoreFoundation

2019-10-15 Thread Andrew Janke
4 file, in AM_GNU_GETTEXT, not from gl_FUNC_SETLOCALE in m4/setlocale.m4. This autoconf code seems to be assuming that the CoreFoundation linkage is only needed if you're using the gettext gnulib module in addition to the setlocale module, or that it's a prereq. But GNU Octave is (s

setlocale: improve fallback on macOS

2019-05-20 Thread Bruno Haible
On macOS, the setlocale override that I added produces warnings such as Warning: Failed to set locale category LC_NUMERIC to fr_DE. Warning: Failed to set locale category LC_TIME to fr_DE. Warning: Failed to set locale category LC_COLLATE to fr_DE. Warning: Failed to set locale category

setlocale: Work around bug on Android 4.3

2019-01-25 Thread Bruno Haible
/test-localename.c:103: assertion 'ret != NULL' failed FAIL test-localename (exit status: 139) The cause is that the native setlocale() function always fails. (See <https://android.googlesource.com/platform/bionic/+/29c7f0b4d18f812267c2194b85204e19e41d0387>.) This patch provides a wor

localename: assume setlocale function

2019-01-06 Thread Bruno Haible
The last platform which lacked setlocale() was probably SunOS 4. 2019-01-06 Bruno Haible localename: Assume setlocale function. * lib/localename.c (gl_locale_name_posix): Assume setlocale exists. * m4/localename.m4 (gl_LOCALENAME): Don't test whether setlocale e

setlocale: improve support for locales not supported by libc

2018-09-15 Thread Bruno Haible
Committed in both gettext and gnulib: 2018-09-15 Bruno Haible setlocale: Improve support for locales not supported by libc. Reported by Dapeng Gao at <https://savannah.gnu.org/bugs/?54479>. * gettext-runtime/intl/setlocale.c: I

setlocale of "POSIX" on Windows

2017-04-21 Thread Bruno Haible
test-mbrtowc5.sh fails on native Windows: The mingw or MSVC setlocale() understands the special locale name "C", but not the special locale name "POSIX". This fixes it. 2017-04-21 Bruno Haible Fix test-mbrtowc5.sh failure on native Windows.

[PATCH] doc: mention setlocale() issues on OpenBSD

2016-01-14 Thread Pádraig Brady
* doc/posix-functions/setlocale.texi: Mention setlocale(LC_ALL,"") never fails, and the need to check categories individually. --- ChangeLog | 6 ++ doc/posix-functions/setlocale.texi | 8 2 files changed, 14 insertions(+) diff --git a/ChangeLog b

setlocale: avoid test failure on Solaris 11 2011-11

2012-01-08 Thread Bruno Haible
On Solaris 11 2011-11, I see a test failure: Turkish_Turkey.65001: unknown locale setlocale did not fail for explicit (NULL) FAIL: test-setlocale2.sh The reason is that /bin/sh does not like to set LC_ALL to some values: $ /bin/sh -c 'LC_ALL=Turkish_Turkey.65001 pwd' Turkish_Tu

setlocale on Cygwin 1.5

2011-06-04 Thread Bruno Haible
On Cygwin 1.5.25, I'm seeing this test failure: setlocale did not fail for implicit ar_SA.ISO-8859-1 FAIL: test-setlocale2.sh This fixes it. 2011-06-04 Bruno Haible setlocale: Enable replacement on Cygwin 1.5. * m4/setlocale.m4 (gl_FUNC_SETLOCALE): Set REPLACE_SETL

Re: new module 'setlocale'

2011-02-18 Thread Eric Blake
On 02/17/2011 08:23 PM, Bruno Haible wrote: > > Huh? This is surprising. And what does this program show? > > #include > #include > #include > #include > > int > main () > { > setenv ("LC_ALL", "ar_SA.ISO-8859-1", 1); > if (se

Re: new module 'setlocale'

2011-02-17 Thread Bruno Haible
Eric Blake wrote: > > #include > > #include > > #include > > #include > > > > int > > main () > > { > >   if (setlocale (LC_ALL, "ar_SA.ISO-8859-1") != NULL) > >     { > >       printf ("%s\n

Re: new module 'setlocale'

2011-02-17 Thread Eric Blake
On 02/17/2011 07:40 PM, Bruno Haible wrote: > Hi Eric, > >> I'm now seeing this failure on Haiku alpha 2: >> >> FAIL: test-setlocale2.sh (exit: 1) >> ====== >> >> setlocale did not fail for implicit ar_SA.ISO-8859-1 &g

Re: new module 'setlocale'

2011-02-17 Thread Bruno Haible
Hi Eric, > I'm now seeing this failure on Haiku alpha 2: > > FAIL: test-setlocale2.sh (exit: 1) > ====== > > setlocale did not fail for implicit ar_SA.ISO-8859-1 > > What can I do to help you diagnose the root cause and work around thi

Re: new module 'setlocale'

2011-02-17 Thread Eric Blake
On 02/12/2011 10:21 AM, Bruno Haible wrote: >> I'm therefore taking the code from gettext. It provides a workaround against >> the problems 1 and 3. > > And here's the fix for problem 2. > > > 2011-02-11 Bruno Haible > > setlocale: W

Re: new module 'setlocale'

2011-02-12 Thread Bruno Haible
Now it's OK to use this new module in the tests. I'm applying this. Unfortunately, this does not fix the 13 test failures on mingw; still need to investigate. 2011-02-12 Bruno Haible Avoid setlocale bugs in tests. * modules/btowc (Dependencies): Add

Re: new module 'setlocale'

2011-02-12 Thread Bruno Haible
> I'm therefore taking the code from gettext. It provides a workaround against > the problems 1 and 3. And here's the fix for problem 2. 2011-02-11 Bruno Haible setlocale: Workaround native Windows bug. * lib/setlocale.c (rpl_setlocale): On native Windows

new module 'setlocale'

2011-02-12 Thread Bruno Haible
> The major problem on mingw is that setlocale(LC_ALL,"") does not look at the > environment variables. On POSIX systems it does, but on mingw it doesn't. > > The second problem is the detection whether setlocale succeeded: When passed > a string with suppo

Re: setlocale

2006-10-18 Thread Paul Eggert
Ben Pfaff <[EMAIL PROTECTED]> writes: > Bruno Haible <[EMAIL PROTECTED]> writes: > >> Simon Josefsson wrote: >>> Why can we assume setlocale exists? >>> Is it POSIX? >> >> Even more: It's specified by ISO C 99. > > Even more than

Re: setlocale

2006-10-18 Thread Ben Pfaff
Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> Why can we assume setlocale exists? >> Is it POSIX? > > Even more: It's specified by ISO C 99. Even more than that: it's in C90 also. -- Ben Pfaff email: [EMAIL PROTECTED] web: http://benpfaff.org

Re: setlocale

2006-10-18 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> Why can we assume setlocale exists? > > Because we haven't encountered systems without a setlocale() for 10 years. > The last such system that I remember was Linux libc5 5.0.xx or 5.2.xx. > >

Re: setlocale (was: hello-2.1.93 internationalization doesn't work)

2006-10-18 Thread Bruno Haible
Simon Josefsson wrote: > Why can we assume setlocale exists? Because we haven't encountered systems without a setlocale() for 10 years. The last such system that I remember was Linux libc5 5.0.xx or 5.2.xx. > Is it POSIX? Even more: It's specified by ISO C 99. Bruno

setlocale (was: Re: hello-2.1.93 internationalization doesn't work)

2006-10-18 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes: > The reason is that HAVE_SETLOCALE is tested, but nowhere defined. Since one > can assume setlocale() already for ca. 5 years, there is no risk in removing > the HAVE_SETLOCALE. Here is a proposed patch. I'm still testing for setlo