summaryrefslogtreecommitdiff
path: root/ext/POSIX/t
Commit message (Collapse)AuthorAgeFilesLines
* locales: Add LC_NAME capabilitiesKarl Williamson2022-12-061-1/+1
| | | | | | | | | | | | | 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.
* POSIX::localeconv: Return empty/special valuesKarl Williamson2022-11-301-6/+3
| | | | | | | | | | | | | | | | | | | | | 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.
* Add last-resort implementation for POSIX::FLT_ROUNDS.TAKAI Kousuke2021-12-241-0/+48
| | | | | | | | 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 is now an XS function rather than a constantTAKAI Kousuke2021-12-241-0/+6
| | | | | | 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()).
* Remove AT&T UWIN supportDagfinn Ilmari Mannsåker2021-11-021-2/+1
| | | | | UWIN is a UNIX compatibility layer for Windows. It was last released in 2012 and has been superseded by Cygwin these days.
* Remove DOS/DJGPP supportDagfinn Ilmari Mannsåker2021-11-023-8/+5
| | | | | | 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.
* Remove NetWare supportDagfinn Ilmari Mannsåker2021-10-082-2/+2
| | | | The build has been broken since 2009.
* Nothing changed in SIGINFO for OpenBSD 7.0Andrew Hewus Fresh2021-09-211-1/+1
| | | | | We'll check back in five years for OpenBSD 8.0 unless someone notices a fix before then.
* POSIX: Make strtoul() return UV if possibleTAKAI Kousuke2021-07-241-2/+9
| | | | | 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.
* Silence one "non-numeric" warningJames E Keenan2021-06-161-2/+3
| | | | | | As suggested by Tom Hukins. For: https://github.com/Perl/perl5/issues/18244
* POSIX: Prefer system's NAN/INFINITY for POSIX::NAN and POSIX::INFINITY.TAKAI Kousuke2021-04-171-4/+25
| | | | | | | | | | 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.
* ext/POSIX/t/mb.t: Don't skip if alt fcn is availableKarl Williamson2021-02-111-2/+2
| | | | | | 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.
* ext/POSIX/t/waitpid.t: Correct one typoJames E Keenan2020-12-191-1/+1
|
* ext/POSIX: Added tests to check integer constants are defined as IVTAKAI Kousuke2020-12-191-0/+69
|
* Correctly set LC_CTYPE back in POSIX/t/time.tLeon Timmermans2020-12-171-1/+1
|
* POSIX: t/posix.t: avoid warningDavid Mitchell2020-12-011-1/+6
| | | | | | | 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.
* dragonfly BSD sets errno incorrectly for terminal control functionsTony Cook2020-11-051-7/+37
|
* ext/POSIX/t/sysconf.t: only unlink the fifo if we have a name for itTony Cook2020-11-041-1/+3
| | | | | This warned on Win32 since the whole test file is skipped due to the lack of anything sysconf() to test.
* ext/POSIX/t/posix.t: 0ee0b3d1 added 'use warnings', fix the warningsTony Cook2020-11-041-3/+3
| | | | | | | | | | | | | | | | | 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.
* ext/POSIX/t/posix.t: use 'warnings'Karl Williamson2020-10-301-0/+1
|
* sysconf.t: close() takes filehandle, not file descriptorJames E Keenan2020-10-191-5/+6
| | | | | Per suggestion from Leon Timmermans in https://github.com/Perl/perl5/issues/18249.
* Add z/OS locale categoriesKarl Williamson2020-07-171-1/+1
| | | | | | | 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.
* Fix edge case test failure in ext/POSIX/t/mb.tDominic Hargreaves2020-04-111-7/+8
| | | | | | | | | | | | | | 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
* Fixup POSIX::mbtowc, wctombKarl Williamson2020-02-191-2/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* POSIX::mblen: Make length parameter optionalKarl Williamson2020-02-191-3/+5
| | | | Now that the typemap is an SV, we can access the length from that.
* POSIX::mblen() Make thread-safe; allow shift state controlKarl Williamson2020-02-191-7/+16
| | | | | | | | | | | | | | | | | | | 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.
* error check the calls to sigaddset in POSIX::SigSet->newTony Cook2020-01-061-0/+19
| | | | | | | | | | 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.
* POSIX/t/time.t: Reset LC_CTYPE to CKarl Williamson2019-11-271-3/+11
| | | | | | | | | | 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.
* Revert "Fix edge case test failure in ext/POSIX/t/mb.t"James E Keenan2019-06-081-6/+2
| | | | | | | | | | | | | | | 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>
* Fix edge case test failure in ext/POSIX/t/mb.tDominic Hargreaves2019-06-071-2/+6
| | | | | | | | | | | | | | 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
* ext/POSIX/t/posix.t: Fix undefined C behavior in testsisyphus2019-04-281-1/+2
| | | | | | | | | | 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.
* ext/POSIX/t/posix.t: Fix typo in test namesisyphus2019-04-281-1/+1
|
* ext/POSIX/t/mb.t: Skip a test on early HP-UXKarl Williamson2019-04-191-2/+2
| | | | This was fixed by the time of 11.31
* ext/POSIX/t/posix.t: Clarify testsKarl Williamson2019-04-191-5/+6
| | | | | | 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.
* Check that perl and POSIX::strtod assign same valuesisyphus2019-04-191-3/+51
|
* ext/POSIX/t/mb.t: Fix osvers= syntax checkingKarl Williamson2019-04-151-1/+1
| | | | | | | | 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.
* POSIX/t/mb.t: Skip test on early HP-UXKarl Williamson2019-04-141-0/+6
| | | | | | | 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.
* Reinstate and fix failing POSIX mb.t testKarl Williamson2019-04-131-4/+8
| | | | | | | 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.
* Revert "ext/POSIX/t/mb.t: Add test for MB_CUR_MAX"James E Keenan2019-04-121-6/+4
| | | | | | | | 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>
* ext/POSIX/t/mb.t: Add test for MB_CUR_MAXKarl Williamson2019-04-091-4/+6
|
* ext/POSIX/t/mb.t: Use actual expected char lenKarl Williamson2019-04-091-2/+2
| | | | | Some platforms want the precise number of expected bytes passed to mblen(), not just some maximum.
* ext/POSIX/t/mb.t: Generalize for EBCDICKarl Williamson2019-04-091-1/+4
|
* Fix POSIX::mblen mbstate_t initialization on threaded perls with glibcNiko Tyni2019-03-241-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* we don't need ext/POSIX/t/math.t +xTony Cook2018-12-121-0/+0
|
* math.t - support C99 math for mingwsisyphus2018-12-111-1/+6
|
* Correct spelling errorJames E Keenan2018-11-011-1/+1
|
* ext/POSIX/t/posix.t - Fix 'strtold works' testsisyphus2018-08-021-1/+1
|
* Teach perl about more locale categoriesKarl Williamson2018-01-301-2/+4
| | | | | | | | | | | | | | | | | 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.
* Replace multiple 'use vars' by 'our' in extNicolas R2017-11-111-1/+1
| | | | | | | | 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.
* (perl #131982) provide constants for get/setpriority in POSIX.pmTony Cook2017-10-161-0/+4
| | | | | | <sys/time.h> isn't necessarily needed, but apparently increases portability, since the rusage structure defined in <sys/resource.h> has struct timeval members.