[Perl/perl5] 7f3402: locale.c: handle codesets GB18030, EUC-TW

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 7f3402777ae7541fe5b0ade7791871742645f5ea
  
https://github.com/Perl/perl5/commit/7f3402777ae7541fe5b0ade7791871742645f5ea
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: handle codesets GB18030, EUC-TW

These two codesets are multi-byte, like UTF-8.  Previously we sort of-of
looked for them, but not fully.  This commit rectifies that.  If the
code set matches one of those two, we don't create a bias towards the
locale being UTF-8.

I discovered this by testing in an unusual Configuration.




[Perl/perl5] 60f97b: locale.c: Minimize time spent with a toggled locale

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 60f97bc0381cea86e15a196fdc2a9ce7988b6480
  
https://github.com/Perl/perl5/commit/60f97bc0381cea86e15a196fdc2a9ce7988b6480
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Minimize time spent with a toggled locale

It's better to disturb things the least amount of time as possible.
Here it's just as convenient to reorder things so the untoggling is done
sooner.




[Perl/perl5] ec02ab: locale.c: toggle LC_CTYPE in S_override

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: ec02ab7a647280ff4f7f3fe63a35eecb515380f5
  
https://github.com/Perl/perl5/commit/ec02ab7a647280ff4f7f3fe63a35eecb515380f5
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: toggle LC_CTYPE in S_override

Commit 0b60dbbe529b372662069aaadf3dfcf18f85c1cc missed this.  Most of
this function must be done in the requested locale so that the libc
functions work on the correct underlying locale.




[Perl/perl5] 4f3785: locale.c: toggling locales is a no-op if no locales

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 4f3785661c86751b74bdb1c94d0963829aa9a5b7
  
https://github.com/Perl/perl5/commit/4f3785661c86751b74bdb1c94d0963829aa9a5b7
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: toggling locales is a no-op if no locales

When the only legal locale is C, toggling to another locale doesn't make
sense.  By #defining the macro that implements toggling this to do
nothing in this case, we can avoid some #ifdefs




[Perl/perl5] e0748e: locale.c: C is the only locale under NO_LOCALE

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: e0748e831ac8161a2a2e1c67162330c025ddb2e7
  
https://github.com/Perl/perl5/commit/e0748e831ac8161a2a2e1c67162330c025ddb2e7
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: C is the only locale under NO_LOCALE

It is possible to Configure perl to not pay attention to locales at all.
Effectively that means the only permissible locale is "C", which
underlies all C programs at startup.

Thus, when asked what the current locale is, the answer is always going
to be "C"; and we can define the macro that computes this info to just
return "C" instead of doing any lookup.




[Perl/perl5] eacceb: locale.c: Be sure to toggle into dot radix locale

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: eacceb3846b76a5b595ac9da9d68cd7858396c51
  
https://github.com/Perl/perl5/commit/eacceb3846b76a5b595ac9da9d68cd7858396c51
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c
M t/run/locale.t

  Log Message:
  ---
  locale.c: Be sure to toggle into dot radix locale

This fixes GH #21746

Perl keeps the LC_NUMERIC category in a locale where the radix character
is a dot, regardless of what the user has requested.  This is because
much XS code has been written with the dot assumption.  When the user's
actual radix character is desired, the locale is briefly toggled to that
one for the duration of the operation.

When the user changes the LC_NUMERIC locale, the new one is noted, but
the attempted change is otherwise ignored unless its radix is a dot.
The new one will be briefly toggled into when appropriate.

The blamed commit contains a logic error

commit 818cdb7aa9f85227c1c7313257c6204c872beb94
Author: Karl Williamson 
AuthorDate: Sun Apr 11 05:57:07 2021 -0600
Commit: Karl Williamson 
CommitDate: Thu Sep 1 09:02:04 2022 -0600

locale.c: Skip code if will be a no-op

It decided it was a no-op if the new locale that the user is changing to
is the same as the previous locale.  But it didn't consider that what
actually happens is that the new locale does actually get changed, and
this code is supposed to make sure that, before returning control to the
user, that a dot radix locale is in effect.

If the new locale is a dot radix locale, then no harm is done by
skipping the code, but otherwise things can go wrong.

I am chagrined that I made this logic error without noticing before it
got pushed, and am surprised that it took this long for the error to
surrface.  There must be something else intervening to make this not a
problem in most circumstances, but I haven't analyzed what it might be.

The details as to why it happened in this test case are pretty obscure.
The locale in effect is looking for a comma radix, but what is being
checked for is a Perl version number, like 5.0936.  When converting that
to a floating point number, the dot is not recognized, and only the
initial '5' is found.  The failing code in a module has different
actions depending on the current perl version it is being called from,
and the conditional got the answer wrong because 5 is less than 5.0936,
whereas the actual version is above that.  So it did the wrong thing and
caused an error.




[Perl/perl5] 20c74a: locale.c: This label is only used in WIN32

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 20c74aefda7443241b32e3d2845e830369d191fe
  
https://github.com/Perl/perl5/commit/20c74aefda7443241b32e3d2845e830369d191fe
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: This label is only used in WIN32




[Perl/perl5] 7bc020: locale.c: Refactor an #ifdef

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 7bc020dea5befba1149612fa3fd8220c10b51dec
  
https://github.com/Perl/perl5/commit/7bc020dea5befba1149612fa3fd8220c10b51dec
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Refactor an #ifdef

I have some #ifdef'd code that when enabled makes the locale handling
think it's running on a Windows MingW machine.  It doesn't emulate the
whole platform by any means, but it does reproduce the different logic
that is required for Windows in locale.c, and allows checking that
changes made likely will compile there without having to actually go to
a Windows machine.

It is mostly hidden from the rest of the code, except in the one spot
where it gets set up.  This makes it unobtrusive, but more importantly
maximizes the chances of it faithfully doing what Windows would do.

But there are two places in locale.c where I couldn't completely hide
it.  One is in teardown to avoid a leak, and the other is this spot in
the code where the codeset names are calculated.  There are big
differences in the Windows name syntax (integers) from the POSIX ones
(character strings).

This commit uses a macro to convert the integers into strings, so that
the required #ifdef doesn't interrupt the logic flow.




[Perl/perl5] 0450e7: Define setlocale_i() on unsafe threaded builds

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 0450e7bee49f92a5d7419b50d6e6d60314bd1f3e
  
https://github.com/Perl/perl5/commit/0450e7bee49f92a5d7419b50d6e6d60314bd1f3e
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  Define setlocale_i() on unsafe threaded builds

On threaded Configurations where thread-safe locale handling is not
available, perl automatically does a modicum of prevention of races by
executing locale changes in a critical section, and copying the results
to a thread-safe location.

This commit defines setlocale_i() on such builds.  This macro is used to
bypass more complex handling required in fully thread-safe builds, and
is used where the libc setlocale() can be wrapped such that it works for
both querying what the existing locale is, and changing the locale.




[Perl/perl5] 82bce0: locale.c: Add a debugging statement

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 82bce0cf1ab7cd4bc4b204d2b1730b455f2c03dd
  
https://github.com/Perl/perl5/commit/82bce0cf1ab7cd4bc4b204d2b1730b455f2c03dd
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Add a debugging statement

This can be helpful in tracing what's happening with nl_langinfo()
calls.




[Perl/perl5] 450120: locale.c: Change some -DLv statements to -DL

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 4501209adb14988aa841d8086f3031a05f993902
  
https://github.com/Perl/perl5/commit/4501209adb14988aa841d8086f3031a05f993902
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Change some -DLv statements to -DL

These debug statements show something isn't quite normal, so shouldn't
require a verbose option to be displayed




[Perl/perl5] 1b737c: locale.c: Rmv duplicate strlen()

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 1b737c9e4ec80561223b1492c7092d433b271817
  
https://github.com/Perl/perl5/commit/1b737c9e4ec80561223b1492c7092d433b271817
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Rmv duplicate strlen()

Inadvertently introduced in 16c984f24273a831a74a01b900d5a400ae331c5d




[Perl/perl5] 6df87f: Revert "Experimentally enable glibc undocumented q...

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 6df87f50951859efcb589a324498e6dc4a69f5ed
  
https://github.com/Perl/perl5/commit/6df87f50951859efcb589a324498e6dc4a69f5ed
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c
M perl.h

  Log Message:
  ---
  Revert "Experimentally enable glibc undocumented querylocale()"

This reverts commit 2ba88c8c7f1c33fe9f3145cbd2c4de3b1668efe9.
It turns out that that commit causes a porting test failure on the rare
Configuration where the POSIX 2008 locale API is used on a system
without threads.  (Someone might want to do that on platforms where
setlocale() is buggy.)

The next commit fixes this test.  Normally that would just be a
follow-on commit without this reversion.  But to ensure that when the
time comes to revert, the whole process is just one commit, this
reversion is done, and the next commit reinstates this reverted commit
plus adding the fix.


  Commit: 6eb3b0c7c89d29c37927b53a5142f06f8bd1621e
  
https://github.com/Perl/perl5/commit/6eb3b0c7c89d29c37927b53a5142f06f8bd1621e
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c
M makedef.pl
M perl.h

  Log Message:
  ---
  Experimentally enable glibc undocumented querylocale()

This is querylocale() by another name, and is undocumented, hence we
haven't enabled it by default.  But it seems to work fine.  In order to
gain wider experience in using it, it is here default-enabled through
5.39.9 (unless we decide to end the experiment earlier), at which point
a compilation error will remind us to decide to keep it or take it out.

I put the check in locale.c instead of the more obvious perl.h, because
the definition would come earlier in perl.h than the PERL_VERSION macros
are defined, and I don't think its worth moving things around for just a
potential of a few releases.


Compare: https://github.com/Perl/perl5/compare/b188d37a9688...6eb3b0c7c89d


[Perl/perl5] b188d3: Hoist nl_item typedef definition

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: b188d37a96881a63a94826e2126746968b845200
  
https://github.com/Perl/perl5/commit/b188d37a96881a63a94826e2126746968b845200
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M embed.fnc
M embed.h
M locale.c
M perl_langinfo.h
M proto.h

  Log Message:
  ---
  Hoist nl_item typedef definition

nl_item is a typedef defined in  for use by nl_langinfo().
But on platforms without this, perl emulates it, and hence needs to
create its own nl_item typedef.

Prior to this commit, the definition was in locale.c, which meant that
there needed to be two definitions in embed.fnc for each function that
has an argument of this type.

Simply putting it in "perl_langinfo.h" when there is no 
allows those duplicate definitions to be removed




[Perl/perl5] 16c984: locale.c: Move three functions within file

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 16c984f24273a831a74a01b900d5a400ae331c5d
  
https://github.com/Perl/perl5/commit/16c984f24273a831a74a01b900d5a400ae331c5d
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Move three functions within file

These are moved to where the other functions operating on the same thing
are.




[Perl/perl5] 8e2f13: locale.c: Change variable name

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 8e2f130506f71e820359080127f8b1cf8e36073e
  
https://github.com/Perl/perl5/commit/8e2f130506f71e820359080127f8b1cf8e36073e
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Change variable name

Use the casing style that was otherwise uniformly used in this file.




[Perl/perl5] 0d9b8f: locale.c: Quit if strftime() returns EINVAL on Win32

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 0d9b8f871e57458542b4d94e1fb5682ba2176ab1
  
https://github.com/Perl/perl5/commit/0d9b8f871e57458542b4d94e1fb5682ba2176ab1
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Quit if strftime() returns EINVAL on Win32

It turns out that Windows sets errno to EINVAL when the libc
function strftime() finds the input format to be in error, though this
is not specified in the Standard (a defect there in my opinion).
Quit when an EINVAL errno is detected on Windows.

I chose not to change for Windows that the loop exits when the buffer
gets large.  It seems that it is best to keep a bound, and should it
ever be exceeded, we can raise the limit.




[Perl/perl5] f49e38: locale.c: Remove obsolete comments

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: f49e381d1cd163baaf5e01cc6cc0fcd5ae36ffd5
  
https://github.com/Perl/perl5/commit/f49e381d1cd163baaf5e01cc6cc0fcd5ae36ffd5
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Remove obsolete comments




[Perl/perl5] cf8a7a: locale.c: Delete erroneous comment

2024-01-02 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: cf8a7a52e7b38c3dca17b7aff9a4290b77663fda
  
https://github.com/Perl/perl5/commit/cf8a7a52e7b38c3dca17b7aff9a4290b77663fda
  Author: Karl Williamson 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Delete erroneous comment

Part of the comment is correct, but is now documented elsewhere in the
file.  The part about it not being a problem with nl_langinfo() was long
ago found to be wrong; the code was corrected, but this comment wasn't
updated.




[Perl/perl5] 5a3cea: Fix an error in `perlvar`: `@+` may have *more* el...

2024-01-02 Thread mkende via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 5a3cea7d65b114c26ace15f27a5da4680adcc3f1
  
https://github.com/Perl/perl5/commit/5a3cea7d65b114c26ace15f27a5da4680adcc3f1
  Author: Mathias Kende 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M pod/perlvar.pod

  Log Message:
  ---
  Fix an error in `perlvar`: `@+` may have *more* elements than `@-`.




[Perl/perl5] 2c51eb: fix the source link in the RMG to point to an exis...

2024-01-02 Thread Philippe Bruhat (BooK)
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 2c51ebbde7522387a80d69296be2b234b283e66c
  
https://github.com/Perl/perl5/commit/2c51ebbde7522387a80d69296be2b234b283e66c
  Author: Philippe Bruhat (BooK) 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M Porting/release_managers_guide.pod

  Log Message:
  ---
  fix the source link in the RMG to point to an existing document




[Perl/perl5] 2ebf93: Prepare Module::Corelist for 5.39.7

2024-01-02 Thread Philippe Bruhat (BooK)
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 2ebf93127ab891c8eca442a7dee481dec886e89f
  
https://github.com/Perl/perl5/commit/2ebf93127ab891c8eca442a7dee481dec886e89f
  Author: Philippe Bruhat (BooK) 
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
M Porting/Maintainers.pl
M dist/Module-CoreList/Changes
M dist/Module-CoreList/lib/Module/CoreList.pm
M dist/Module-CoreList/lib/Module/CoreList/Utils.pm

  Log Message:
  ---
  Prepare Module::Corelist for 5.39.7