This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
3 years agotoke.c: Recognize "0odddd" octal literals.
TAKAI Kousuke [Thu, 22 Oct 2020 14:23:57 +0000 (23:23 +0900)]
toke.c: Recognize "0odddd" octal literals.

t/base/num.t: Add some test for "0odddd" octals.

3 years agoUse GNU Bison's named references
Branislav Zahradník [Thu, 6 Aug 2020 07:18:15 +0000 (09:18 +0200)]
Use GNU Bison's named references

Usage of Bison's named references makes actions little bit easier
to read and maintain.

3 years agoRaise minimal supported GNU Bison version to 2.5
Branislav Zahradník [Thu, 6 Aug 2020 17:42:08 +0000 (19:42 +0200)]
Raise minimal supported GNU Bison version to 2.5

which added support for named references

3 years agoAdd start-up/tear-down for many-reader mutexes
Karl Williamson [Mon, 30 Nov 2020 19:18:30 +0000 (12:18 -0700)]
Add start-up/tear-down for many-reader mutexes

These were missed in 5640a370e8b19af74b8ca0b4694464c21a87916b.

3 years agoChange many-reader mutex API for consistency
Karl Williamson [Tue, 1 Dec 2020 00:09:56 +0000 (17:09 -0700)]
Change many-reader mutex API for consistency

The API for other mutexes passes the address of the lock, instead of the
lock itself.  It is less confusing to have the APIs be the same.

3 years agoHiRes.xs: Remove unused macro defns
Karl Williamson [Mon, 30 Nov 2020 18:16:16 +0000 (11:16 -0700)]
HiRes.xs: Remove unused macro defns

3 years agoperllocale: Remove stray markup
Karl Williamson [Tue, 1 Dec 2020 19:37:52 +0000 (12:37 -0700)]
perllocale: Remove stray markup

3 years agoNot all Win32 compilers have a small macro buffer
Karl Williamson [Fri, 4 Dec 2020 15:01:31 +0000 (08:01 -0700)]
Not all Win32 compilers have a small macro buffer

Commit e7ae132ec78 consolidated PERL_SMALL_MACRO_BUFFER usages, but it
omitted the _MSC_VER number at which the buffer became large enough.
Apparently it did this because Windows compilations were failing with
the error "string too long", which doesn't happen if __ASSERT_ expands
to nothing, which it does under PERL_SMALL_MACRO_BUFFER.

However,  commits 92a0bb2 and 88086fd shortened the offending strings
so later Windows compilers don't have to be considered as having small
macro buffers.

3 years agoRevert "Don't test for 16-bit inputs in inRANGE()"
Karl Williamson [Fri, 4 Dec 2020 14:40:54 +0000 (07:40 -0700)]
Revert "Don't test for 16-bit inputs in inRANGE()"

This effectively reverts commit
4c2aa7c802893d0276551ade1b9d5dcd1226afc4.

That commit removed checking for 16 bit inputs because an assert in a
macro was making compilations fail in some compilers that couldn't
handle the complexity.  This inadvertently broke systems which use C
language shorts in certain places, such Mingw and Win32 with their use
of UTF16, not typically found on other platforms.  At the time, we
weren't smoking Mingw so we didn't know about it there, but the Win32
failures on Win32 were "fixed" by another commit which disabled
assertions of this type completely.  It turns out the issue was passing
too long a string to assert().   Commits 92a0bb2 and 88086fd removed a
bunch of unnecessary and/or duplicate asserts, bringing the size down,
so that the 16 bit checks can be added back in without breaking these
compilers.

The reverted commit mentioned HP compilers as having problems.  The only
such box we currently have available for testing is HP-31, and the
reversion works fine on it, even before 92a0bb2 and 88086fd.

This fixes GH #18364

3 years agoperl.h: Move some code around
Karl Williamson [Sun, 5 Jul 2020 04:01:16 +0000 (22:01 -0600)]
perl.h: Move some code around

This is in preparation for future commits where things will be needed
earlier/later than currently.

3 years agoregen/regcharclass.pl: Use smaller inRANGE version
Karl Williamson [Sat, 5 Dec 2020 23:35:17 +0000 (16:35 -0700)]
regen/regcharclass.pl: Use smaller inRANGE version

The previous commit split inRANGE up so that code that was known to have
valid inputs to it could use a component that didn't have all the
compile-time checks (often duplicates) that otherwise are made.

This commit changes to use that component.  The reason the compile-time
checks are unnecessary here, is this is machine-generated code known to
meet the inRANGE input requirements.

All those compile-time checks added up to being too large for some
compilers to handle.

3 years agoinRANGE, withinCOUNT: Split so can avoid asserts
Karl Williamson [Sat, 5 Dec 2020 23:21:52 +0000 (16:21 -0700)]
inRANGE, withinCOUNT: Split so can avoid asserts

This commit splits these macros up into components that are separately
callable.  The components are considered internal core only, and the
purpose is to avoid duplicate assert() calls that were causing some
compilers to crash from not being able to handle the size.

In particular, this commit refactors inRANGE so that the asserts are
done only once, shortening what it expands to.

3 years agohandy.h: Fix typo in comment
Karl Williamson [Sat, 5 Dec 2020 23:20:41 +0000 (16:20 -0700)]
handy.h: Fix typo in comment

3 years agoRemove my_l?stat from public API
Karl Williamson [Sat, 29 Aug 2020 20:07:45 +0000 (14:07 -0600)]
Remove my_l?stat from public API

They are not documented, and if you try to use them, you get a compile
error.

3 years agoperlapi: Consolidate SvSET-ish entries
Karl Williamson [Sun, 6 Sep 2020 17:04:52 +0000 (11:04 -0600)]
perlapi: Consolidate SvSET-ish entries

These should also be in the SV section instead of Magic

3 years agoEvaluate arg once in all forms of SvTRUE
Karl Williamson [Sun, 29 Nov 2020 15:54:43 +0000 (08:54 -0700)]
Evaluate arg once in all forms of SvTRUE

5.32 did this for one form; now all do.

3 years agoAlways define dMY_CXT_SV, and to dNOOP
Karl Williamson [Wed, 22 Jul 2020 22:59:03 +0000 (16:59 -0600)]
Always define dMY_CXT_SV, and to dNOOP

3 years agoUse a more suitable test method
Tom Hukins [Wed, 2 Dec 2020 18:04:13 +0000 (18:04 +0000)]
Use a more suitable test method

like() provides better errors on failure thank ok().  This reduces the
usefulness of the removed printf() diagnostic.

3 years agoAvoid unnecessarily skipping a test to set $0
Tom Hukins [Wed, 2 Dec 2020 17:39:35 +0000 (17:39 +0000)]
Avoid unnecessarily skipping a test to set $0

The absence of /proc/$$/cmdline doesn't mean running ps(1) won't work.

3 years agoTest setting $0 on Dragonfly BSD
Tom Hukins [Wed, 2 Dec 2020 17:26:09 +0000 (17:26 +0000)]
Test setting $0 on Dragonfly BSD

Support for this began in Perl 5.26.0 with commit 38626956885060503.

3 years agoutf8.h: Fix syntax error only found on EBCDIC builds
Karl Williamson [Fri, 4 Dec 2020 23:39:02 +0000 (16:39 -0700)]
utf8.h: Fix syntax error only found on EBCDIC builds

3 years agoperl.h: Remove ';' from 'NOOP;'
Karl Williamson [Tue, 1 Dec 2020 14:28:13 +0000 (07:28 -0700)]
perl.h: Remove ';' from 'NOOP;'

These are useless here

3 years agotime64_config.h: #include reentr.h
Karl Williamson [Tue, 1 Dec 2020 04:27:44 +0000 (21:27 -0700)]
time64_config.h: #include reentr.h

This is so it will get any reentrant versions automatically

3 years agoperlvars.h: Fix comment
Karl Williamson [Mon, 30 Nov 2020 16:39:34 +0000 (09:39 -0700)]
perlvars.h: Fix comment

3 years agoPOSIX.xs: White-space only
Karl Williamson [Mon, 30 Nov 2020 16:33:42 +0000 (09:33 -0700)]
POSIX.xs: White-space only

Indent to standards

3 years agoPOSIX.xs: Use alternative functions if avail
Karl Williamson [Mon, 30 Nov 2020 16:30:52 +0000 (09:30 -0700)]
POSIX.xs: Use alternative functions if avail

These preprocessor directives failed to account for the existence of
common alternative functions (which the implementation knows about) if
the plain function is not available on the platform.

I doubt that this makes any difference, but it makes these conditionals
consistent with the others nearby.

3 years agolocale.c: Fix typo in #ifdef
Karl Williamson [Mon, 30 Nov 2020 16:25:52 +0000 (09:25 -0700)]
locale.c: Fix typo in #ifdef

This misspelling led to the code assuming that the platform didn't have
a feature that, if used, would result in faster execution.

3 years agoFix and update documentation of memEQ, memNE, ...
Karl Williamson [Fri, 4 Dec 2020 00:56:21 +0000 (17:56 -0700)]
Fix and update documentation of memEQ, memNE, ...

This fixes GH #18379

3 years agotime64.c: avoid 'uninit' compiler warning
David Mitchell [Thu, 3 Dec 2020 10:36:42 +0000 (10:36 +0000)]
time64.c: avoid 'uninit' compiler warning

clang isn't smart enough to recognise the pattern:

    if (foo) { ...} { else orig_year = ... }
    ...
    if (!foo) { ... use orig_year .. }

So just unconditionally initialise orig_year.

3 years agoperldelta for the Win32 symlink()/readlink()/stat() changes
Tony Cook [Thu, 3 Dec 2020 04:24:44 +0000 (15:24 +1100)]
perldelta for the Win32 symlink()/readlink()/stat() changes

3 years agoDocument PERL_TEST_HARNESS_ASAP
Karl Williamson [Thu, 3 Dec 2020 03:54:07 +0000 (20:54 -0700)]
Document PERL_TEST_HARNESS_ASAP

which can increase the CPU occupancy when running the test suite in
parallel on a many-core system, resulting in earlier completion.

3 years agoadd note on how to write NEXTKEY when you can't just wrap around each()
David Cantrell [Mon, 30 Nov 2020 22:50:00 +0000 (22:50 +0000)]
add note on how to write NEXTKEY when you can't just wrap around each()

3 years agoRevert "op.h: Restrict to core certain internal symbols"
Karl Williamson [Thu, 3 Dec 2020 01:56:27 +0000 (18:56 -0700)]
Revert "op.h: Restrict to core certain internal symbols"

This reverts commit 1d6cadf136bf2c85058a5359fb48b09b3ea9fe6f.

Due to cpan breakage: GH #18374 #18375 #18376

3 years agoadd more win32 stat tests
Tony Cook [Thu, 3 Dec 2020 00:00:43 +0000 (11:00 +1100)]
add more win32 stat tests

These tickets were suggested as fixed by the stat updates, some
were fixed, but some weren't.

Add tests (TODO for the unfixed) to help track them

3 years agocpan/Encode: sync with CPAN version 3.08
Dan Kogai [Wed, 2 Dec 2020 22:13:45 +0000 (17:13 -0500)]
cpan/Encode: sync with CPAN version 3.08

3 years agot/harness: Add option for faster test suite execution
Karl Williamson [Sun, 12 Apr 2020 21:13:25 +0000 (15:13 -0600)]
t/harness: Add option for faster test suite execution

This commit adds an environment variable, PERL_TEST_HARNESS_ASAP, which
if set to non-zero increases the parallelism in the execution of the
test suite, speeding it up on systems with multiple cores.

Normally, there are two main test sections, one for core and the second
for non-core tests, and the testing of the non-core one doesn't begin
until the core tests are complete.  Within each section, there are a
number of test categories, like 're' for regular expressions, and
'JSON::PP' for the pure perl implementation of JSON.

Within each category, there are various single .t test files.  Some
categories can have those be tested in parallel; some require them to be
done in a particular order, say because an earlier .t does setup for
subsequent ones.  We already have this capability.

Completion of all the tests in a category is not needed before those of
another category can be started.  This is how it already works.

However, the core section categories are ordered so that they begin in a
logical order for someone trying to get perl to work.  First to start
are the basic sanity tests, then by roughly decreasing order of
widespread use in perl programs in the wild, with the final two
categories, porting and perf, being mainly of use to perl5 porters.
These two categories aren't started until all the tests in the earlier
categories are started.  We have some long running tests in those two
categories, and generally they delay the start of the entire second
section.

If those long running tests could be started sooner, shorter tests in
the first section could be run in parallel with them, increasing the
average CPU utilization, and the second section could begin (and hence
end) earlier, shortening the total elapsed execution time of the entire
suite.

The second section has some very long running tests.  JSON-PP is one of
them.  If it could run in parallel with tests from the first section,
that would also speed up the completion of the suite.

The environment variable added by this commit does both things.  The
basic sanity test categories in the first section continue to be started
before anything else.  But then all other tests are run in decreasing
order of elapsed time they take to run, removing the boundaries between
some categories, and between the two sections.

The gain from this increases as the number of jobs run in parallel does;
slower high core platforms have the highest increase.  On the old
dromedary with 24 cores, the gain is 20%, almost 2 minutes.  On my more
modern box with 12 cores, it is 8%.

3 years agoTAP::Harness: Move timer initialization
Karl Williamson [Sun, 12 Apr 2020 16:14:25 +0000 (10:14 -0600)]
TAP::Harness: Move timer initialization

This commit adds to blead the accepted PR
https://github.com/Perl-Toolchain-Gang/Test-Harness/pull/98
but the updated module has not been released.

This commit allows a many-core processor to run the Perl test suite more
efficiently.

Prior to this commit, the timers for counting elapsed time and CPU usage
were begun when a job's first output appears.  This yields inaccurate
results.  These results are saved in t/test_state for future runs so
that they can start the longest-running tests first, which leads to
using the available cores more efficiently.  (If you start a long running
test after everything else is nearly done, you have to wait for it to
finish before the suite as a whole is; if you start the long ones first,
and the shortest last, you don't have to wait very long for any
stragglers to complete.)  Inaccurate results here lead to this
situation, which we were often seeing in the podcheck.t test.

The worst case is if there is heavy computation at the beginning of the
test being run.  podcheck, for example, examines all the pods in the
directory structure to find which links to other pods do or do not have
corresponding anchors.  Output doesn't happen until the analysis is
complete.  On my system, this takes over 30 seconds, but prior to this
commit, what was noted was just the time required to do the output,
about 200 milliseconds.  The result was that podcheck was viewed as
being one of the shortest tests run, so was started late in the process,
and generally held up the completion of it.

This commit by itself doesn't improve the test completion very much,
because, test tests are run a whole directory at a time, and the
directory podcheck is in, for example, is run last.  The next commit
addresses that.

3 years agofixup! Add Sevan Janiyan as author
Max Maischein [Wed, 2 Dec 2020 20:46:25 +0000 (21:46 +0100)]
fixup! Add Sevan Janiyan as author

3 years agoAdd Sevan Janiyan as author
Max Maischein [Wed, 2 Dec 2020 20:40:42 +0000 (21:40 +0100)]
Add Sevan Janiyan as author

3 years agoDetect GCC as compiler to use
Sevan Janiyan [Wed, 2 Dec 2020 19:50:37 +0000 (19:50 +0000)]
Detect GCC as compiler to use

On Illumos based distributions GCC is likely the compiler available on the system.
Change tested on SmartOS

3 years agoperlxs: Note that rpc.h is can be in different places
Karl Williamson [Mon, 2 Nov 2020 02:35:29 +0000 (19:35 -0700)]
perlxs: Note that rpc.h is can be in different places

This replaces PR #18247

3 years agofix the results of my stupidity
Tony Cook [Wed, 2 Dec 2020 00:43:16 +0000 (11:43 +1100)]
fix the results of my stupidity

I added these definitions late in the process, thinking I hadn't
already added them, but I had.

3 years agoStorable: t/canonical.t: avoid stderr noise
David Mitchell [Tue, 1 Dec 2020 16:45:58 +0000 (16:45 +0000)]
Storable: t/canonical.t: avoid stderr noise

informational text should to stdout, not stderr

3 years agoPOSIX: t/posix.t: avoid warning
David Mitchell [Tue, 1 Dec 2020 16:33:07 +0000 (16:33 +0000)]
POSIX: t/posix.t: avoid warning

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.

3 years agoUnicode-Normalize/Makefile.PL: avoid stderr
David Mitchell [Tue, 1 Dec 2020 16:02:06 +0000 (16:02 +0000)]
Unicode-Normalize/Makefile.PL: avoid stderr

During build, output general progress information to stdout, not stderr.

3 years agoappend colon to USE_STRICT_BY_DEFAULT description
David Mitchell [Tue, 1 Dec 2020 15:26:06 +0000 (15:26 +0000)]
append colon to USE_STRICT_BY_DEFAULT description

This stops autodoc.pl complaining that:

    USE_STRICT_BY_DEFAULT has no documentation

3 years agoODBM_File.xs: silence -Wc++-compat warning
David Mitchell [Tue, 1 Dec 2020 15:12:14 +0000 (15:12 +0000)]
ODBM_File.xs: silence -Wc++-compat warning

Under gcc -Wc++-compat, it warns that 'delete' is a keyword. Since this
is the name of the actual function in odbm, just temporarily disable
the warning.

3 years agoOpcode.xs: fix compiler warning
David Mitchell [Tue, 1 Dec 2020 11:07:59 +0000 (11:07 +0000)]
Opcode.xs: fix compiler warning

In some debugging code it was doing a SAVEDESTRUCTOR()
to do a warn() on scope exit, but it should have used the nocontext
version of warn().

3 years agoImplement symlink(), lstat() and readlink() on Win32
Tony Cook [Tue, 1 Dec 2020 04:29:45 +0000 (15:29 +1100)]
Implement symlink(), lstat() and readlink() on Win32

3 years agowin32 symlink: reindent
Tony Cook [Wed, 11 Nov 2020 00:46:15 +0000 (11:46 +1100)]
win32 symlink: reindent

3 years agowin32 symlink: treats paths that look like directories as directories
Tony Cook [Wed, 11 Nov 2020 00:42:23 +0000 (11:42 +1100)]
win32 symlink: treats paths that look like directories as directories

3 years agoTest-Harness: don't assume symlink succeeds
Tony Cook [Mon, 2 Nov 2020 03:28:29 +0000 (14:28 +1100)]
Test-Harness: don't assume symlink succeeds

https://github.com/Perl-Toolchain-Gang/Test-Harness/pull/103
upstream which has been applied but not released.

3 years agot/op/taint.t: handle symlink requiring anything unavailable
Tony Cook [Wed, 28 Oct 2020 02:46:01 +0000 (13:46 +1100)]
t/op/taint.t: handle symlink requiring anything unavailable

like privileges, or a filesystem without symlink support

3 years agoWin32: try to make the new stat pre-Vista compatible
Tony Cook [Tue, 20 Oct 2020 05:12:09 +0000 (16:12 +1100)]
Win32: try to make the new stat pre-Vista compatible

Skips the win32\stat.t execute flag test for handles pre-Vista

This is intended mostly for allowing the Win2000 smoker to build and
test.  If we end up dropping pre-Vista support this commit can be
removed (or reverted if it ends up in blead)

3 years agopre-vista support for win32_symlink
Tony Cook [Mon, 9 Nov 2020 02:52:09 +0000 (13:52 +1100)]
pre-vista support for win32_symlink

3 years agoWin32: don't include version specific config for prebuilt config_h.*
Tony Cook [Mon, 19 Oct 2020 03:26:57 +0000 (14:26 +1100)]
Win32: don't include version specific config for prebuilt config_h.*

This fixes the problem where doing a regen_config_h with a compiler
that supports stdbool.h would generate a config_h.* that would
result in a build failure on older compilers that didn't support
stdbool.h.

3 years agolstat(), readlink() and unlink() treat directory junctions as symlinks
Tony Cook [Thu, 15 Oct 2020 04:11:13 +0000 (15:11 +1100)]
lstat(), readlink() and unlink() treat directory junctions as symlinks

3 years agoremove ${^WIN32_SLOPPY_STAT}
Tony Cook [Thu, 15 Oct 2020 00:46:15 +0000 (11:46 +1100)]
remove ${^WIN32_SLOPPY_STAT}

The new implementation, like the UCRT implementation, always
opens the specified file.

3 years agowin32 symlink: only use the unprivileged flag if windows is new enough
Tony Cook [Thu, 15 Oct 2020 00:21:31 +0000 (11:21 +1100)]
win32 symlink: only use the unprivileged flag if windows is new enough

3 years agoWin32: re-work FILETIME <=> time_t conversions
Tony Cook [Wed, 14 Oct 2020 23:38:05 +0000 (10:38 +1100)]
Win32: re-work FILETIME <=> time_t conversions

Current versions of Windows claim to support leap seconds, but the
time conversion I was using ignores that possibility.

Switch to using APIs (FileTimeToSystemTime() and SystemTimeToFileTime())
that are documented to support leap seconds that might be included
in a FILETIME.

3 years agoFile::Copy: support symlinks on Win32
Tony Cook [Wed, 7 Oct 2020 01:08:30 +0000 (12:08 +1100)]
File::Copy: support symlinks on Win32

3 years agoFile::Find: support Win32 symlinks
Tony Cook [Wed, 7 Oct 2020 01:07:31 +0000 (12:07 +1100)]
File::Find: support Win32 symlinks

find.t, taint.t: check that symlink() works under the current
permissions/filesystem rather than assuming it will work

find.t: since symlinks are now available, an earlier test block
set $FileFileTests_OK, and the tests in this Win32 block don't use
either of the follow options, which is required for fast file tests.

taint.t: ensure we get "/" separated names to match File::Find's output

3 years agoFile::Find find.t: switch to done_testing()
Tony Cook [Wed, 7 Oct 2020 00:53:05 +0000 (11:53 +1100)]
File::Find find.t: switch to done_testing()

3 years agoPathTools: use PerlLIO_*() functions and chdir() on a symlink differences
Tony Cook [Wed, 7 Oct 2020 00:50:55 +0000 (11:50 +1100)]
PathTools: use PerlLIO_*() functions and chdir() on a symlink differences

Use PerlLIO_lstat() and PerlLIO_readlink() instead of directly calling
the POSIX names, so our Win32 overrides work.

For the test, unlike POSIX, changing directory via a symlink on Win32
appears to store the symlink as part of the current directory rather
so GetCurrentDirectory() fetches that rather than the hardlinked path.

3 years agoWin32: implement our own stat(), and hence our own utime
Tony Cook [Wed, 14 Oct 2020 02:27:50 +0000 (13:27 +1100)]
Win32: implement our own stat(), and hence our own utime

This fixes at least two problems:

- unlike UCRT, the MSVCRT used for gcc builds has a bug converting
  a FILETIME in an unlike current DST state, returning a time
  offset by an hour.  Fixes GH #6080

- the MSVCRT apparently uses FindFirstFile() to fetch file
  information, but this doesn't follow symlinks(), so stat()
  ends up returning information about the symlink(), not the
  underlying file.  This isn't an issue with the UCRT which
  opens the file as this implementation does.

Currently this code calculates the time_t for st_*time, and the
other way for utime() using a simple multiplication and offset
between time_t and FILETIME values, but this may be incorrect
if leap seconds are enabled.

This code also requires Vista or later.

Some of this is based on code by Tomasz Konojacki (xenu).

3 years agoWin32: implement symlink() and readlink()
Tony Cook [Wed, 7 Oct 2020 05:31:22 +0000 (16:31 +1100)]
Win32: implement symlink() and readlink()

The API used requires Windows Vista or later.

The API itself requires either elevated privileges or a sufficiently
recent version of Windows 10 running in "Developer Mode", so some
tests require updates.

3 years agoWin32: add lstat(), fetch st_dev and st_ino and fetch st_nlink for fstat
Tony Cook [Tue, 6 Oct 2020 06:07:00 +0000 (17:07 +1100)]
Win32: add lstat(), fetch st_dev and st_ino and fetch st_nlink for fstat

We need lstat() for various modules to work well with symlinks,
and the same modules often want to check for matches on the device
and inode number.

The values we're using for st_ino match those that the Python and Rust
libraries use, and Go uses the same volume and file index values for
testing if two stat objects refer to the same file.

They aren't entirely unique, given ReFS uses 128-bit file ids, but
the API used to check for this (GetFileInformationByHandleEx() for
FileIdInfo) is only available on server operating systems, so I can't
directly test it anyway.

3 years agoAccount for 'less' reserving an extra column
Karl Williamson [Tue, 1 Dec 2020 03:55:30 +0000 (20:55 -0700)]
Account for 'less' reserving an extra column

After decades of stability, the 'less' pager project decided to claim an
extra column for its own use when called with certain common options.

This commit changes some of the auto-generating tools to wrap one column
earlier to compensate, and changes podcheck to also whine on wide
verbatim text one column less.  But it changes the podcheck data base
to grandfather-in all the many existing places that exceed that amount.
That means only changes made to pods after this commit will be held to
the stricter value.

Of course, what this means is those pods will wrap or truncate in these
places on an 80 column window, making them harder to read, when used
with 'less' and when it is called with the options that reserve those
two columns.  Patches welcome.

I haven't seen the wrapping problem with perldoc, and haven't
investigated much.

3 years agoDocument various CopFILEfoo functions
Karl Williamson [Sat, 29 Aug 2020 16:55:02 +0000 (10:55 -0600)]
Document various CopFILEfoo functions

3 years agoopcode.h: Restrict scope of internal variables to core
Karl Williamson [Sat, 17 Oct 2020 13:18:16 +0000 (07:18 -0600)]
opcode.h: Restrict scope of internal variables to core

3 years agoDocument SvSHARED_HASH
Karl Williamson [Thu, 27 Aug 2020 17:03:44 +0000 (11:03 -0600)]
Document SvSHARED_HASH

3 years agobump version of ExtUtils::ParseXS
Graham Knop [Tue, 24 Nov 2020 20:42:05 +0000 (21:42 +0100)]
bump version of ExtUtils::ParseXS

3 years agorestore compatibility with old versions of ExtUtils::ParseXS
Graham Knop [Tue, 24 Nov 2020 20:27:43 +0000 (21:27 +0100)]
restore compatibility with old versions of ExtUtils::ParseXS

ExtUtils::ParseXS used to include a function called "errors", which was
documented. In was renamed to report_error_count in version 3.01 (perl
5.15.1) although the documentation wasn't fixed until 3.21 (perl 5.19.2).
As a documented function, this is a backwards compatibility issue.

It is possible for this to lead to errors when installing modules from
CPAN. If you are using the version of ExtUtils::ParseXS that comes with
core, between running the Makefile.PL and make, fulfilling prereqs can
result in upgrading ExtUtils::ParseXS. When Makefile.PL is run, the
generated Makefile gets the full path to xsubpp saved in it. Then when
upgraded from CPAN, ExtUtils::ParseXS and xsubpp will be in a new
location (site_perl or a local::lib). Running make will run the old
xsubpp, but it will then try to use the new ExtUtils::ParseXS which has
broken compatibility.

Restore the errors function as a compatibility shim to fix this.

3 years agocop.h: Extend core-only portion
Karl Williamson [Sat, 17 Oct 2020 12:43:55 +0000 (06:43 -0600)]
cop.h: Extend core-only portion

This encloses some #defines in a PERL_CORE section, as their only use is
in the macro immediately following, already confined to core.

3 years agoINSTALL: Fix grammar/typos
Karl Williamson [Wed, 7 Oct 2020 19:22:54 +0000 (13:22 -0600)]
INSTALL: Fix grammar/typos

3 years agoperlapi: Consolidate svREFCNT_dec-ish entries
Karl Williamson [Sun, 6 Sep 2020 04:18:06 +0000 (22:18 -0600)]
perlapi: Consolidate svREFCNT_dec-ish entries

3 years agoDynaLoader: use PerlEnv_getenv()
Karl Williamson [Sat, 7 Mar 2020 19:54:19 +0000 (12:54 -0700)]
DynaLoader: use PerlEnv_getenv()

Doing so invokes thread-safe guards

3 years agoop.h: Restrict to core certain internal symbols
Karl Williamson [Sat, 17 Oct 2020 13:04:41 +0000 (07:04 -0600)]
op.h: Restrict to core certain internal symbols

so that they aren't accessible to XS code and won't be picked up by
autodoc

3 years agoperlapi: Consolidate SvPVX-ish entries
Karl Williamson [Sun, 6 Sep 2020 04:20:45 +0000 (22:20 -0600)]
perlapi: Consolidate SvPVX-ish entries

3 years agoAdd -negative import args for 'use warnings'
David Cantrell [Mon, 27 Jan 2020 16:02:05 +0000 (16:02 +0000)]
Add -negative import args for 'use warnings'

3 years agoperlapi: Consolidate SvREFCNT_INC-ish entries
Karl Williamson [Sun, 6 Sep 2020 04:17:19 +0000 (22:17 -0600)]
perlapi: Consolidate SvREFCNT_INC-ish entries

3 years agoadd extra language in the quotemeta() docs for embedded \ and $
Karen Etheridge [Fri, 20 Nov 2020 23:57:25 +0000 (15:57 -0800)]
add extra language in the quotemeta() docs for embedded \ and $

One paragraph was lifted from perlop.pod, and the other from perlre.pod.

3 years agoperlvar - clarify that paragraph mode also discards a single leading newline
Dan Book [Fri, 27 Nov 2020 04:19:13 +0000 (23:19 -0500)]
perlvar - clarify that paragraph mode also discards a single leading newline

3 years agoAvoid deadlock with PERL_MEM_LOG
Karl Williamson [Thu, 26 Nov 2020 01:20:28 +0000 (18:20 -0700)]
Avoid deadlock with PERL_MEM_LOG

This fixes GH #18341

The Perl wrapper for getenv() was changed in 5.32 to allocate memory to
squirrel safely away the result of the wrapped getenv() call.  It does
this while in a critical section so as to make sure another thread can't
interrupt it and destroy it.

Unfortunately, when Perl is compiled for debugging memory problems and
has PERL_MEM_LOG enabled, that allocation causes a recursive call to
getenv() for the purpose of checking an environment variable to see how
to log that allocation.  And hence it deadlocks trying to enter the
critical section.

There are various solutions.  One is to use or emulate a general semaphore
instead of a binary one.  This is effectively what
PL_lc_numeric_mutex_depth does for another mutex, and the code for that
could be used as a template.

But given that this is an extreme edge case which requires Perl to be
specially compiled to enable this feature which is used only for
debugging, a much simpler, if less safe if it were to ever be used in
production, solution should suffice.  Tony Cook suggested just avoiding
the wrapper for this particular purpose.

3 years agoAdd mutex locking for many-reader/1-writer
Karl Williamson [Wed, 12 Aug 2020 20:59:12 +0000 (14:59 -0600)]
Add mutex locking for many-reader/1-writer

The mutex macros already in perl are sufficient to allow us to emulate
this type of locking, which may also be available natively, but I don't
think it is worth the effort to use the native calls.

3 years agolocale.c: Move comment to better place
Karl Williamson [Thu, 26 Nov 2020 13:16:13 +0000 (06:16 -0700)]
locale.c: Move comment to better place

3 years agoperlsub - indicate version requirement for "delete local"
Dan Book [Thu, 26 Nov 2020 02:29:22 +0000 (21:29 -0500)]
perlsub - indicate version requirement for "delete local"

3 years agoperlapi: PL_sv_yes and kin are read-only
Karl Williamson [Wed, 25 Nov 2020 13:54:37 +0000 (06:54 -0700)]
perlapi: PL_sv_yes and kin are read-only

3 years agoperlapi: Remove per-thread section; move to real scns
Karl Williamson [Wed, 18 Nov 2020 03:35:55 +0000 (20:35 -0700)]
perlapi: Remove per-thread section; move to real scns

Instead of having a grab bag section of all interpreter variables, move
their documentation to the section that they actually fit under.

3 years agoperlapi: Move PL_dowarn to Warnings section
Karl Williamson [Wed, 18 Nov 2020 03:35:01 +0000 (20:35 -0700)]
perlapi: Move PL_dowarn to Warnings section

3 years agoperldelta updates for the SysV IPC changes
Tony Cook [Tue, 24 Nov 2020 03:31:08 +0000 (14:31 +1100)]
perldelta updates for the SysV IPC changes

3 years agoVarious updates and fixes to some of the SysV IPC ops and their tests
Tony Cook [Tue, 24 Nov 2020 02:52:59 +0000 (13:52 +1100)]
Various updates and fixes to some of the SysV IPC ops and their tests

3 years agoio/shm.t: make runnable as ./perl io/shm.t
Tony Cook [Wed, 18 Nov 2020 04:02:05 +0000 (15:02 +1100)]
io/shm.t: make runnable as ./perl io/shm.t

and give editors a hint

3 years agoshmwrite: treat the string as bytes
Tony Cook [Wed, 18 Nov 2020 04:01:13 +0000 (15:01 +1100)]
shmwrite: treat the string as bytes

3 years agomsgrcv: properly downgrade the receive buffer
Tony Cook [Wed, 18 Nov 2020 03:26:38 +0000 (14:26 +1100)]
msgrcv: properly downgrade the receive buffer

If the receive buffer started with SVf_UTF8 on, the received message
SV would stay flagged, corrupting the result.

3 years agomsgsnd: handle an upgraded MSG parameter correctly
Tony Cook [Wed, 18 Nov 2020 03:20:47 +0000 (14:20 +1100)]
msgsnd: handle an upgraded MSG parameter correctly

3 years agoperlfunc/msgsnd: the supplied MSG doesn't have a length field
Tony Cook [Wed, 18 Nov 2020 00:42:24 +0000 (11:42 +1100)]
perlfunc/msgsnd: the supplied MSG doesn't have a length field

The length of the message is derived from the length of the MSG
less the size of the type field.

3 years agofix UTF-8 handling for semop()
Tony Cook [Tue, 17 Nov 2020 23:27:50 +0000 (10:27 +1100)]
fix UTF-8 handling for semop()

As with semctl(), the UTF-8 flag on the passed in opstring was ignored,
which meant that the upgraded version of the same string would
cause an error.

Just use SvPVbyte().

3 years agoio/sem.t: eliminate warnings
Tony Cook [Tue, 17 Nov 2020 04:59:44 +0000 (15:59 +1100)]
io/sem.t: eliminate warnings

This eliminates some warnings that semctl() (or other *ctl()) calls
might generate, and some warnings specific to io/sem.t:

- for IPC_STAT and GETALL, the current value of ARG is overwritten
  so making an undefined value warning for it nonsensical, so don't
  use SvPV_force().

- for other calls, ARG is either ignored, or in a behaviour
  introduced in perl 3 (along with the ops), treats the supplied
  value as an integer which is then converted to a pointer.  Rather
  than warning on an undef value which is most likely to be ignored
  we treat the undef as zero without the usual warning.

- always pass a number for SEMNUM in the test code

I didn't try to eliminate warning for non-numeric/undefined SEMNUM,
since while we know it isn't used by SETALL, GETALL, IPC_STAT and
IPC_SET, it may or may not be used by system defined *ctl() operators
such as SEM_INFO and SHM_LOCK on Linux.

fixes #17926

3 years ago*ctl: test that we throw on a code point above 0xff
Tony Cook [Tue, 17 Nov 2020 03:25:36 +0000 (14:25 +1100)]
*ctl: test that we throw on a code point above 0xff

These functions expect a packed structure of some point
representing bytes from the structure in memory.