| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
LC_NAME is a GNU extension that Perl hadn't been aware of. The
consequences were that it couldn't be set or queried in Perl (except by
using LC_ALL to set everything). There are other GNU extensions that
Perl has long known about; this was the only missing one.
The values associated with this category are retrievable by the glibc
call nl_langinfo(3) in XS code. The standard-specified items are
retrievable from pure Perl via I18N::Langinfo, but it doesn't know only
about any of the non-standard ones, including the ones for this
category.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function returns a hash allowing Perl access to the localeconv()
data structure, with the keys being the structure's field names, and the
values being their corresponding value in the current locale.
Prior to this commit, it did not populate the hash with:
1) any string-valued keys whose value is the empty string
2) any numeric-valued keys whose value is the special value CHAR_MAX
This is wrong. localeconv() should return a complete list of fields on
the platform, regardless of their values. Someone may well wish
to iterate over all the keys in the hash.
CHAR_MAX just indicates special handling is required for that
numeric field. And all string fields legally can be empty, except for
the decimal point. For example, the symbol indicating a number is
positive is empty in many locales.
I couldn't find a reason in the history why these have been omitted.
|
|
|
|
|
|
|
|
| |
POSIX::FLT_ROUNDS now emulates (more) standard behavior that
reflects the current rounding mode set by fesetround(),
even when compiled with GCC whose FLT_ROUNDS is wrongly fixed to 1.
Also add tests for this.
|
|
|
|
|
|
| |
POSIX::FLT_ROUNDS used to be an NV constant, but C FLT_ROUNDS is
actually an integer and not a constant (C99 seems to say that
it reflects the current rounding mode set by fesetround()).
|
|
|
|
|
| |
UWIN is a UNIX compatibility layer for Windows. It was last released
in 2012 and has been superseded by Cygwin these days.
|
|
|
|
|
|
| |
DJGPP is a port of the GNU toolchain to 32-bit x86 systems running DOS.
The last known attempt to build Perl on it was on 5.20, which only got
as far as building miniperl.
|
|
|
|
| |
The build has been broken since 2009.
|
|
|
|
|
| |
We'll check back in five years for OpenBSD 8.0 unless someone notices a
fix before then.
|
|
|
|
|
| |
POSIX::strtoul() used to return NV if return value does not fit in IV,
but this caused loss of precision if unsigned long and NV are both 64-bit.
|
|
|
|
|
|
| |
As suggested by Tom Hukins.
For: https://github.com/Perl/perl5/issues/18244
|
|
|
|
|
|
|
|
|
|
| |
POSIX::NAN and POSIX::INFINITY used to return NV_NAN and NV_INF
defined in the perl core respectively, but these might be different
from the values defined in the POSIX system header, as these special
values might have multiple internal representations.
If respective POSIX macro is not defined (eg. on pre-C99 system),
they will return NV_NAN/NV_INF, so there should be no degradation.
|
|
|
|
|
|
| |
In some cases, the core can use one of two similar functions to
accomplish a task. This adds a check so that only if both are missing
is the test skipped.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Since warnings were enabled in this test file, skip one spurious warning
being generated. S_ISBLK() is being called purely to test run-time
loading; so it's being called without an arg, which now triggers an
'uninitialized value' warning.
|
| |
|
|
|
|
|
| |
This warned on Win32 since the whole test file is skipped due
to the lack of anything sysconf() to test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
locales_enabled() accepts either an optional category name, or an
arrayref of category names, and is prototyped to accept a scalar, so
the qw() was evaluated in scalar context, ignoring the "NUMERIC" and
producing a warning.
The POSIX::pipe() test is testing the POSIX::pipe() function, not
globs, so just use lexical handles.
These warnings came up while cleaning up noise in the Win32 build, but
the warnings occur on Linux too.
Useless use of a constant ("NUMERIC") in void context at t/posix.t line 358.
Name "main::WRITER" used only once: possible typo at t/posix.t line 78.
Name "main::READER" used only once: possible typo at t/posix.t line 77.
|
| |
|
|
|
|
|
| |
Per suggestion from Leon Timmermans in
https://github.com/Perl/perl5/issues/18249.
|
|
|
|
|
|
|
| |
z/OS has two locale categories, LC_SYNTAX and LC_TOD, not found outside
IBM products. This makes Perl know about them, so that a program can
refer to them, but like other similar categories found on other OS's,
nothing more is done with them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This new test fails in an environment where LANG is set to one thing and
LC_ALL is set to another, and where LANG is set to a locale which is
not installed in the environment in question.
Such a test environment is arguably broken, but appears in common
chroot setups such as Debian's sbuild tool where LANG is inherited from
the parent environment, and LC_ALL is used to override it.
(Committer rebased the patch)
This fixes GH #17039
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit enhances these functions so that on threaded perls, they use
mbrtowc and wcrtomb when available, making them thread safe. The
substitution isn't completely transparent, as no effort is made to hide
any differences in errno setting upon error. And there may be slight
differences in edge case behavior on some platforms.
This commit also changes the behaviors so that they take a scalar
parameter instead of a char *, and this might be 'undef' or not be
forceable into a valid PV. If not a PV, the functions initialize the
shift state. Previously the shift state was always reinitialized with
every call, which meant these could not work on locales with shift
states.
In addition, there were several issues in mbtowc and wctomb that this
commit fixes.
mbtowc and wctomb, when used, are now run with a semaphore. This avoids
races if called at the same time in another thread.
The returned wide character from mbtowc() could well have been garbage.
The final parameter to mbtowc is now optional, as passing an SV allows
us to determine the length without the need for an extra parameter. It
is now used only to restrict the parsing of the string to shorter than
the actual length.
wctomb would segfault if the string parameter was shared or hadn't
been pre-allocated with a string of sufficient length to hold the
result.
|
|
|
|
| |
Now that the typemap is an SV, we can access the length from that.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit changes the behavior so that it takes a scalar parameter
instead of a char *, and thus might not be forceable into a valid PV.
When not a PV, the shift state is reinitialized, like calling mblen with
a NULL first parameter. Previously the shift state was always
reinitialized with every call, which meant this could not work on
locales with shift states.
This commit also changes to use mbrlen() on threaded perls transparently
(mostly), when available, to achieve thread-safe operation. It is not
completely transparent because mbrlen (under the very rare stateful
locales) returns a different value when it's resetting the shift state.
It also may set errno differently upon errors, and no effort is made to
hide that difference. Also mbrlen on some platforms can handle partial
characters.
[perl #133928] showed that someone was having trouble with shift states.
|
|
|
|
|
|
|
|
|
|
| |
Coverity complained that SvIV() could return negative numbers,
but doesn't complain about the similar call in the sigaddset()
method, which is error checked.
So error check sigaddset() and throw an error if it fails.
CID 244386.
|
|
|
|
|
|
|
|
|
|
| |
The C standard says about the format in strftime(): "The format shall be
a multibyte character sequence, beginning and ending in its initial
shift state"
Tony Cook and I interpret that as meaning that to be sure, not only does
LC_TIME have to be reset, but LC_CTYPE to account for all possible
variations in these tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 69b89a0f0bb2cbb4c1607e78c3b414bf45244bea.
This commit generated two test failures on Linux when perl was built
with config_args like these:
'-des -Dusedevel -Dcc=clang -Accflags=-Werror=declaration-after-statement -g -fno-omit-frame-pointer -fsanitize=address -fno-common -fsanitize-blacklist=/home/jkeenan/gitwork/perl/asan_ignore -Aldflags=-fsanitize=address'
See: https://rt.perl.org/Ticket/Display.html?id=134182#txn-1639258
Reverting from blead; will create branch for testing.
Signed-off-by: James E Keenan <jkeenan@cpan.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This new test fails in an environment where LANG is set to one thing and
LC_ALL is set to another, and where LANG is set to a locale which is
not installed in the environment in question.
Such a test environment is arguably broken, but appears in common
chroot setups such as Debian's sbuild tool where LANG is inherited from
the parent environment, and LC_ALL is used to override it.
Committer: removed one non-printing character from patch
For: RT # 134182
|
|
|
|
|
|
|
|
|
|
| |
Behavior marked as undefined by the C standard should be avoided. Its
a simple matter to fix this .t to not have such behavior.
In general, the programmer may not have control over the input string
being parsed to convert to a number, and so it could be too large or
tiny for the available precision and hence result in undefined behavior.
That is something that is unavoidable.
|
| |
|
|
|
|
| |
This was fixed by the time of 11.31
|
|
|
|
|
|
| |
These tests, added in 693d95f399039f4aa96bb6737166aeeb546e5350, may be
confusing, due to truncation due to precision in any failing output.
This changes the test name to include a caveat.
|
| |
|
|
|
|
|
|
|
|
| |
Commit 918fbd43ad287e3a4b8f309a55f91e409747c895 added a test skip to
this .t for early HP-UX platforms. Unfortunately, due to a machine
crash, I don't have access to such a platform to test it on, and I got
the syntax wrong. In consulation with Merijn Brand, I believe this
commit gets it right.
|
|
|
|
|
|
|
| |
There is a bug in this OS, fixed as of 11.31, in which mblen() doesn't
return the proper result in the UTF-8 locale C.utf8. Any other UTF-8
locales on this platform are broken for another reason, being that a
bunch of what Perl expects to be punctuation characters aren't.
|
|
|
|
|
|
|
| |
Somehow I had pushed to blead a draft version of the test, rather than
the final one that actually should work. The draft is what got reverted
by 8cc54175018f1cabb5c0354371c9e2ee24f8ee5a. Reinstate the test,
corrected.
|
|
|
|
|
|
|
|
| |
This reverts commit 858fc58a344c7550c68495d7fe648b39a1a50c0c.
The unit test introduced by the commit fails on many operating systems.
Signed-off-by: James E Keenan <jkeenan@cpan.org>
|
| |
|
|
|
|
|
| |
Some platforms want the precise number of expected bytes passed to
mblen(), not just some maximum.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As reported in https://bugs.launchpad.net/bugs/1818953 POSIX::mblen()
is broken on threaded perls with glibc.
% perl -MPOSIX=mblen -e 'mblen("a", 1)'
perl: mbrtowc.c:105: __mbrtowc: Assertion `__mbsinit (data.__statep)' failed.
zsh: abort (core dumped) perl -MPOSIX=mblen -e 'mblen("a", 1)'
This broke in v5.27.8-134-g6c9ff7e96e which made the function
use mbrlen(3) under the hood on threaded perls.
The problem is initialization of the shift state with
mbrlen(NULL, 0, &ps));
The glibc documentation for mbrlen(3) at
https://www.gnu.org/software/libc/manual/html_node/Converting-a-Character.html#Converting-a-Character
does not mention initialization by passing in a null pointer for the
string, only a pointer to a NUL wide character.
If the next multibyte character corresponds to the NUL wide character,
the return value is 0. If the next n bytes form a valid multibyte
character, the number of bytes belonging to this multibyte character
byte sequence is returned.
Use memset(3) instead for mbstate_t initialization, as suggested in
https://www.gnu.org/software/libc/manual/html_node/Keeping-the-state.html
with the hope that this is more portable.
While at it, add a few basic test cases. These are in a new file because
they need fresh_perl_is() from test.pl while the existing ones use
Test::More (and conversion of at least posix.t looks way too involved.)
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1818953
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
glibc has various other categories than the ones perl handles, for
example LC_PAPER. This commit adds knowledge of these to perl, so that
one can set them, interrogate them, and have libraries work on them,
even though perl itself does not.
This is in preparation for future commits, where it becomes more
important than currently for perl to know about all the locale
categories on the system.
I looked through various other systems to try to find other categories,
but did not see any. If a system does have such a category, it is
pretty easy to tell perl about it, and recompile. Use the changes in
this commit as a template, and send an email to perlbug@perl.org, so
that the next Perl release will have it.
|
|
|
|
|
|
|
|
| |
Using vars pragma is discouraged and has been superseded by 'our' declarations
available in Perl v5.6.0 or later.
This commit is about replacing the usage of 'vars' pragma
by 'our' in 'ext' directory.
|
|
|
|
|
|
| |
<sys/time.h> isn't necessarily needed, but apparently increases
portability, since the rusage structure defined in <sys/resource.h>
has struct timeval members.
|