Fix POSIX:setlocale() documentation

This commit is contained in:
Petr Písař 2020-03-27 14:29:05 +01:00
parent 12f4b2afc9
commit 6c3e2dc957
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,60 @@
From 06283613f8e6e81053444fea0cfc441db9c776a9 Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
Date: Fri, 20 Dec 2019 14:40:47 -0700
Subject: [PATCH] POSIX.pod: Update setlocale() docs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This should have been updated in 5.28, but was overlooked.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
ext/POSIX/lib/POSIX.pod | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/ext/POSIX/lib/POSIX.pod b/ext/POSIX/lib/POSIX.pod
index cab1501dab..d0b7f5ade2 100644
--- a/ext/POSIX/lib/POSIX.pod
+++ b/ext/POSIX/lib/POSIX.pod
@@ -1451,14 +1451,18 @@ see L<perlfunc/eval>.
=item C<setlocale>
-WARNING! Do NOT use this function in a L<thread|threads>. The locale
-will change in all other threads at the same time, and should your
-thread get paused by the operating system, and another started, that
-thread will not have the locale it is expecting. On some platforms,
-there can be a race leading to segfaults if two threads call this
-function nearly simultaneously.
-
-Modifies and queries the program's underlying locale. Users of this
+WARNING! Prior to Perl 5.28 or on a system that does not support
+thread-safe locale operations, do NOT use this function in a
+L<thread|threads>. The locale will change in all other threads at the
+same time, and should your thread get paused by the operating system,
+and another started, that thread will not have the locale it is
+expecting. On some platforms, there can be a race leading to segfaults
+if two threads call this function nearly simultaneously. On unthreaded
+builds, or on Perl 5.28 and later on thread-safe systems, this warning
+does not apply.
+
+This function
+modifies and queries the program's underlying locale. Users of this
function should read L<perllocale>, whch provides a comprehensive
discussion of Perl locale handling, knowledge of which is necessary to
properly use this function. It contains
@@ -1466,7 +1470,9 @@ L<a section devoted to this function|perllocale/The setlocale function>.
The discussion here is merely a summary reference for C<setlocale()>.
Note that Perl itself is almost entirely unaffected by the locale
except within the scope of S<C<"use locale">>. (Exceptions are listed
-in L<perllocale/Not within the scope of "use locale">.)
+in L<perllocale/Not within the scope of "use locale">, and
+locale-dependent functions within the POSIX module ARE always affected
+by the current locale.)
The following examples assume
--
2.21.1

View File

@ -300,6 +300,9 @@ Patch71: perl-5.30.1-handle-s-being-updated-without-len-being-updated.pat
# in upstream after 5.31.6
Patch72: perl-5.31.6-PATCH-GH-17081-Workaround-glibc-bug-with-LC_MESSAGES.patch
# Fix POSIX:setlocale() documentation, in upstream after 5.31.7
Patch73: perl-5.31.7-POSIX.pod-Update-setlocale-docs.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -4358,6 +4361,7 @@ you're not running VMS, this module does nothing.
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch200 -p1
%patch201 -p1
@ -4423,6 +4427,7 @@ perl -x patchlevel.h \
'Fedora Patch70: Fix a race in File::stat() tests (GH#17234)' \
'Fedora Patch71: Fix a buffer overread when parsing a number (GH#17279)' \
'Fedora Patch72: Work around a glibc bug in caching LC_MESSAGES (GH#17081)' \
'Fedora Patch73: Fix POSIX:setlocale() documentation' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -7183,6 +7188,7 @@ popd
- Make perl-macros package noarch
- Fix a directory ownership in perl-Sys-Hostname
- Work around a glibc bug in caching LC_MESSAGES (GH#17081)
- Fix POSIX:setlocale() documentation
* Mon Mar 16 2020 Jitka Plesnikova <jplesnik@redhat.com> - 4:5.30.2-452
- 5.30.2 bump (see <https://metacpan.org/pod/release/SHAY/perl-5.30.2/pod/perldelta.pod>