This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
4 years agoNetBSD, Darwin, Cygwin don't appear to support SO_PROTOCOL
Tony Cook [Tue, 21 Jan 2020 04:17:30 +0000 (15:17 +1100)]
NetBSD, Darwin, Cygwin don't appear to support SO_PROTOCOL

at least on AF_UNIX sockets.

We supply zero for protocol when creating AF_UNIX sockets, and
we no longer cache that incorrect value.  On systems such as NetBSD
that don't implement SO_PROTOCOL this means we can't fetch
the protocol and the protocol() method will hence return undef.

The same applies to Darwin and Cygwin.

4 years agoOnly cache io_socket_proto if protocol is truthy
Andrew Hewus Fresh [Mon, 23 Sep 2019 00:36:47 +0000 (17:36 -0700)]
Only cache io_socket_proto if protocol is truthy

According to socket(2):

    A value of 0 for protocol will let the system select an appropriate
    protocol for the requested socket type.

While linux, and possibly others, return 0 for this, OpenBSD recently
got support for SO_PROTOCOL in getsockopt(2) and instead of returning
0, indicating it will choose the correct protocol, it instead returns
the protocol that was chosen.  That means caching "0" as the chosen
protocol means that what $sock->protocol returns is not the same as what
getsockopt($sock, SOL_SOCKET, SO_PROTOCOL) returns.

While there is ongoing discussion about whether returning 0 vs something
else is correct, the current situation shows that this value is
implementation specific and we should not cache something that might not
be right.

4 years agoMore descriptive variable name
James E Keenan [Tue, 28 Jan 2020 20:33:15 +0000 (15:33 -0500)]
More descriptive variable name

Per discussion with Tony Cook, rename one variable used in commit
5162664ad5f (p.r. 17368) on Dec 16 2019.

4 years agoUpdate links to perlrun to link to specific items
Dan Book [Mon, 13 Jan 2020 21:22:49 +0000 (16:22 -0500)]
Update links to perlrun to link to specific items

4 years agoadd support for E<sol> and E<verbar> to diagnostics.pm
Tony Cook [Tue, 28 Jan 2020 00:19:41 +0000 (11:19 +1100)]
add support for E<sol> and E<verbar> to diagnostics.pm

perlpod says:

        *   "E<lt>" -- a literal < (less than)

        *   "E<gt>" -- a literal > (greater than)

        *   "E<verbar>" -- a literal | (*ver*tical *bar*)

        *   "E<sol>" -- a literal / (*sol*idus)

            The above four are optional except in other formatting codes,
            notably "L<...>", and when preceded by a capital letter.

so those two were the only ones missing from diagnostics.pm's
escape translation tables.

4 years agoperldelta for 719b7c2b26e2, a04fd069805e
Tony Cook [Mon, 27 Jan 2020 23:33:27 +0000 (10:33 +1100)]
perldelta for 719b7c2b26e2a04fd069805e

4 years agoonly install ExtUtils::XSSymSet man page on VMS
Tony Cook [Mon, 20 Jan 2020 03:47:38 +0000 (14:47 +1100)]
only install ExtUtils::XSSymSet man page on VMS

This module is only installed on VMS, so there's not much point in
installing the man page.

An alternative would be to install the module on VMS, but it tries
to use configuration only set on VMS.

fixes #17424

4 years agorun/switches.t: allocate the in-place edit test directory with tempfile
Tony Cook [Thu, 16 Jan 2020 03:32:51 +0000 (14:32 +1100)]
run/switches.t: allocate the in-place edit test directory with tempfile

Previously it used a static tmpinplace/ directory, which could
cause the "trash left behind" test to fail if a previous run
was aborted for some reason.

fixes #17423

4 years agoBump version on Tie::File to 1.05
Todd Rinaldo [Mon, 27 Jan 2020 07:18:23 +0000 (01:18 -0600)]
Bump version on Tie::File to 1.05

4 years agoRemove silly version change test for Tie::File
Todd Rinaldo [Mon, 27 Jan 2020 06:55:01 +0000 (00:55 -0600)]
Remove silly version change test for Tie::File

The only thing that t/00_version.t seems to do is require you to change
it when VERSION is updated.

Also corrected spaces not tabs in MANIFEST.

4 years agoCorrect typo in MAINFEST for new file in Tie::File
Todd Rinaldo [Mon, 27 Jan 2020 06:15:16 +0000 (00:15 -0600)]
Correct typo in MAINFEST for new file in Tie::File

4 years agoAdd Changelog to Tie::File to make CPAN updates easier.
Todd Rinaldo [Mon, 27 Jan 2020 06:09:20 +0000 (00:09 -0600)]
Add Changelog to Tie::File to make CPAN updates easier.

4 years agoperldelta for af6880c950
Hugo van der Sanden [Mon, 27 Jan 2020 03:40:50 +0000 (03:40 +0000)]
perldelta for af6880c950

4 years agoregexec: don't increment recursion counter for non-postponed EVAL
Hugo van der Sanden [Sun, 26 Jan 2020 18:28:43 +0000 (18:28 +0000)]
regexec: don't increment recursion counter for non-postponed EVAL

It wasn't intended to be part of the recursion logic, and doesn't get
decremented again (GH 17490).

4 years agoperldelta for c92273b390a1, 2d572b086e2
Tony Cook [Mon, 27 Jan 2020 03:21:56 +0000 (14:21 +1100)]
perldelta for c92273b390a12d572b086e2

4 years agobump $Storable::VERSION and update ChangeLog
Tony Cook [Mon, 27 Jan 2020 00:31:56 +0000 (11:31 +1100)]
bump $Storable::VERSION and update ChangeLog

4 years agoStorable/t/recurse.t: note may not be available
Tony Cook [Wed, 22 Jan 2020 00:18:21 +0000 (11:18 +1100)]
Storable/t/recurse.t: note may not be available

If this wasn't a trivial change, I'd just drop support for 5.6.2,
but 5.6.2 has a Test::More without note() and modern Test::More
depends on Storable, so ensure we work without note().

partial fix for #17422

4 years agoStorable/Makefile.PL: fix dependencies
Tony Cook [Wed, 22 Jan 2020 00:16:14 +0000 (11:16 +1100)]
Storable/Makefile.PL: fix dependencies

partial fix for #17422

4 years agoperldelta for 4b004c43ef2
Tony Cook [Sun, 26 Jan 2020 23:47:57 +0000 (10:47 +1100)]
perldelta for 4b004c43ef2

4 years agoalways treat undef in %INC as a failed require
Tony Cook [Tue, 21 Jan 2020 05:12:44 +0000 (16:12 +1100)]
always treat undef in %INC as a failed require

Previously require would check for the specific \&PL_sv_undef
SV in %INC, this meant that if %INC was copied, or undef
assigned to a member the entry would erroneously be treated as if
a previous require of that file was successful.

So check for SvOK() instead, with appropriate magic tests.

fixes #17428

4 years agotest case for GH #17428, an interaction between undef in %INC and require
Tony Cook [Tue, 21 Jan 2020 04:57:32 +0000 (15:57 +1100)]
test case for GH #17428, an interaction between undef in %INC and require

4 years agoperlio.c: make :unix close method call underlaying layers as well
Leon Timmermans [Fri, 24 Jan 2020 23:51:44 +0000 (00:51 +0100)]
perlio.c: make :unix close method call underlaying layers as well

4 years agoUpdate perlfaq to CPAN version 5.20200125
Karen Etheridge [Sat, 25 Jan 2020 19:13:27 +0000 (11:13 -0800)]
Update perlfaq to CPAN version 5.20200125

  [DELTA]

5.20200125  2020-01-25 19:11:04Z
  * remove references to smartmatch in perlfaq4; replace use of
    List::Util::first with any (PR#85, Dan Book)
  * add links to plackperl.org (#66)

4 years agoregcomp.c: restore {} braces to DEBUG_PARSE_r multi-statements
Yves Orton [Sat, 25 Jan 2020 02:55:39 +0000 (03:55 +0100)]
regcomp.c: restore {} braces to DEBUG_PARSE_r multi-statements

In 15cab4d7052 the if (!SIZE_ONLY) logic was removed from regcomp.c,
but in a few places this was excessively zealous, as the braces were
removed from multiline constructs inside of DEBUG_PARSE_r macros.

EG:

    DEBUG_PARSE_r(if (!SIZE_ONLY) {
        stuff1;
        stuff2;
        stuff3;
    });

was turned into

    DEBUG_PARSE_r(
        stuff1;
        stuff2;
        stuff3;
    );

Which means that ONLY the first statement in the block was covered
by the DEBUG_PARSE_r() conditional logic. The conversion should have
been:

    DEBUG_PARSE_r({
        stuff1;
        stuff2;
        stuff3;
    });

IOW, it was necessary to preserve the {} braces in the macro call.

This silences various forms of debugging that should not be visible
in a plain

    use re 'debug';

and should only be visible with something like

    use re Debug => 'ALL';

Eg in:

    $ ./perl -Ilib -Mre=debug -le'/(foo|bar|baz)/'
    Compiling REx "(foo|bar|baz)"
    ~ tying lastbr BRANCH (9) to ender CLOSE1 (12) offset 3
    ~ tying lastbr OPEN1 (1) to ender END (14) offset 13
    Final program:
       1: OPEN1 (3)
       3:   TRIE-EXACT[bf] (12)
            <foo>
            <bar>
            <baz>
      12: CLOSE1 (14)
      14: END (0)
    stclass AHOCORASICK-EXACT[bf] minlen 3
    Freeing REx: "(foo|bar|baz)"

The "~ tying lastbr" lines are of interest pretty much only to
someone working on or maintaining the regex engine and should not
be visible to a casual user, not only because they are ugly but
also because the context to understand them is missing and they
do not help understanding how the regex operates.

4 years agoXS-APItest: add tests for U8TO64_LE() and other hashing macros and code
Yves Orton [Tue, 5 Nov 2019 23:12:49 +0000 (00:12 +0100)]
XS-APItest: add tests for U8TO64_LE() and other hashing macros and code

Includes testing siphash24 and siphash13 properly, especially
testing against the SipHash 2-4 reference test vector,
see https://131002.net/siphash/siphash24.c

See also #17244 where we originally discovered there were no
tests for the internals of the hashing code and that because
of it we let slip in a very broken patch to the code.

Thanks to James E Keenan, Tony Cook and Hugo Van der Sanden
for support putting this together.

XS-APItest: fixup issues with # directives

for some reason the indentation of the #if clauses broke things
under some builds, but not all. Possibly a ccache issue.

4 years agohv_func.h: tweak how we deal with 64 bit Siphash
Yves Orton [Fri, 24 Jan 2020 15:08:35 +0000 (16:08 +0100)]
hv_func.h: tweak how we deal with 64 bit Siphash

This slightly modifies how we apply Siphash in our code
so that instead of taking the low 32 bits of the hash
we return the xor of the high and low 32 bits.

This also adds /* FALLTHROUGH */ statements to some of
the related code so that picky compilers don't get upset
as it is not a mistake.

Lastly this allows our test code to access both the
"real" 64 bit Siphash, and also the reduced 32 bit version.

Most of this is in preparation for adding tests for
some of our hash related code. See next commit.

4 years agowin32: don't set the base address of perl5xx.dll
Tomasz Konojacki [Thu, 23 Jan 2020 01:06:17 +0000 (02:06 +0100)]
win32: don't set the base address of perl5xx.dll

It was causing LNK4281 warning on modern Visual C++ versions. Also,
-base is a security risk because it opt-outs from ASLR.

That switch was added as an optimization 20 years ago, but I don't
think the potential benefits are worth the trouble.

4 years agogrok_bin_oct_hex: Add some branch predictions
Karl Williamson [Wed, 22 Jan 2020 23:06:32 +0000 (16:06 -0700)]
grok_bin_oct_hex: Add some branch predictions

This led to about a 7% improvement, number of branches went 2.3kk->1.9kk
in perf, thanks to Sergey Aleynikov.  cachegrind shows:

Key:
    Ir   Instruction read
    Dr   Data read
    Dw   Data write
    COND conditional branches
    IND  indirect branches
    _m   branch predict miss

The numbers represent raw counts per loop iteration.

eight_hex_digits
87654321

       blead latest Ratio %
       ----- ------ -------
    Ir 306.0  297.0   103.0
    Dr  76.0   76.0   100.0
    Dw  41.0   39.0   105.1
  COND  26.0   26.0   100.0
   IND   2.0    2.0   100.0

COND_m   0.1    0.0     Inf
 IND_m   3.0    3.0   100.0

4 years agogrok_bin_oct_hex: Fix overflow approximation
Karl Williamson [Wed, 22 Jan 2020 19:15:38 +0000 (12:15 -0700)]
grok_bin_oct_hex: Fix overflow approximation

The multiplcation factor was itself overflowing, so need to change it to
an NV.  Also, the first time through this factor is not needed as what
it is multiplying is 0, so set it to 0.

4 years agoMerge branch 'false_warning' into blead
Karl Williamson [Thu, 23 Jan 2020 22:48:02 +0000 (15:48 -0700)]
Merge branch 'false_warning' into blead

This branch regularizes the warnings and errors generated when a hex or
octal character constant contains an illegal character, and when such a
constant evaluates to something that won't fit into a 32 bit word.

It unifies where the text is generated, leading to a uniform syntax that
no longer has slight spelling variances.  And some messages previously
gave outright false information.  Some cases of a too-high code point
weren't caught immediately; this is fixed.

During pattern compilation, some messages could have become truncated or
garbled.  This is fixed.

This resolves GH #17340 False warning that character is ignored

4 years agoregcomp.c: Add an explanatory comment
Karl Williamson [Wed, 22 Jan 2020 17:39:26 +0000 (10:39 -0700)]
regcomp.c: Add an explanatory comment

4 years agoregcomp.c: Use grok_hex in expanding \N{U+...}
Karl Williamson [Wed, 22 Jan 2020 17:10:23 +0000 (10:10 -0700)]
regcomp.c: Use grok_hex in expanding \N{U+...}

Now that grok_hex has sufficient flags to do what this code wants, it
doesn't have to roll its own, and can use grok_hex directly.  Doing so
ensures consistent handling, and somewhat less code to maintain.

4 years agotoke.c: Don't accept illegal code points
Karl Williamson [Wed, 22 Jan 2020 16:29:19 +0000 (09:29 -0700)]
toke.c: Don't accept illegal code points

This now croaks if the input is an illegal code point.  Before, it
likely would eventually croak if that code point was actually used in
some manner.

4 years agoutf8.c: Use common fcn for error message
Karl Williamson [Wed, 22 Jan 2020 16:25:26 +0000 (09:25 -0700)]
utf8.c: Use common fcn for error message

There is now a function that generates this error message.  This is so
that it is always the same from wherever generated.

4 years agoregcomp.c: Use uc to print hex A-F in err msg
Karl Williamson [Tue, 21 Jan 2020 04:56:38 +0000 (21:56 -0700)]
regcomp.c: Use uc to print hex A-F in err msg

The same message is used in utf8.c with upper case, so in preparation
for unifying the two instances, this makes them all consistent.  I don't
think there are any cases in CPAN that rely on the old spelling.

4 years agopv_uni_display: Use common fcn; \b mnemonic
Karl Williamson [Thu, 16 Jan 2020 23:14:40 +0000 (16:14 -0700)]
pv_uni_display: Use common fcn; \b mnemonic

This removes the (almost) duplicate code in this function to display
mnemonics for control characters that have them.  The reason the two
pieces of code aren't precisely the same is that the other function also
uses \b as a mnemonic for backspace.  Using all possible mnemonics is
desirable, so a flag is added for pv_uni_display to now use \b.  This is
now by default enabled in double-quoted strings, but not regex patterns
(as \b there means something quite different except in character classes).
B.pm is changed to expect \b.

4 years agoMove cntrl_to_mnemonic() to util.c from regcomp.c
Karl Williamson [Thu, 16 Jan 2020 23:09:39 +0000 (16:09 -0700)]
Move cntrl_to_mnemonic() to util.c from regcomp.c

This is in preparation for it being used elsewhere, to reduce
duplication of code.

4 years agoChange return type of regcurly to bool
Karl Williamson [Thu, 16 Jan 2020 23:07:12 +0000 (16:07 -0700)]
Change return type of regcurly to bool

This internal function is more properly bool, not I32.

4 years agoRemove dquote_inline.h
Karl Williamson [Thu, 16 Jan 2020 22:33:44 +0000 (15:33 -0700)]
Remove dquote_inline.h

The remaining function in this file is moved to inline.h, just to not
have an extra file lying around with hardly anything in it.

4 years ago(toke|regcomp).c: Use common fcn to handle \0 problems
Karl Williamson [Thu, 16 Jan 2020 21:42:35 +0000 (14:42 -0700)]
(toke|regcomp).c: Use common fcn to handle \0 problems

This changes warning messages for too short \0 octal constants to use
the function introduced in the previous commit.  This function assures a
consistent and clear warning message, which is slightly different than
the one this commit replaces.  I know of no CPAN code which depends on
this warning's wording.

4 years agoregcomp.c: Code points above 255 are portable
Karl Williamson [Thu, 16 Jan 2020 21:02:53 +0000 (14:02 -0700)]
regcomp.c: Code points above 255 are portable

These tests are to generate warnings that the affected code is not
portable between ASCII and EBCDIC systems.  But, it was being too picky.
Code points above 255 are the same on both systems, so the warning
shouldn't be generated for those.

4 years agoRevise \o{ missing '}' error message
Karl Williamson [Thu, 23 Jan 2020 21:17:37 +0000 (14:17 -0700)]
Revise \o{ missing '}' error message

All the other messages raised when a construct is expecting a
terminating '}' but none is found include the '}' in the message.  '\o{'
did not.  Since these diagnostics are getting revised anyway, and I
didn't find any CPAN modules relying on the wording, this commit makes
the messages consistent by adding the '}' to the \o message.

4 years agoRestructure grok_bslash_[ox]
Karl Williamson [Thu, 16 Jan 2020 20:17:32 +0000 (13:17 -0700)]
Restructure grok_bslash_[ox]

This commit causes these functions to allow a caller to request any
messages generated to be returned to the caller, instead of always being
handled within these functions.  The messages are somewhat changed from
previously to be clearer.  I did not find any code in CPAN that relied
on the previous message text.

Like the previous commit for grok_bslash_c, here are two reasons to do
this, repeated here.

1) In pattern compilation this brings these messages into conformity
   with the other ones that get generated in pattern compilation, where
   there is a particular syntax, including marking the exact position in
   the parse  where the problem occurred.

2) These could generate truncated messages due to the (mostly)
   single-pass nature of pattern compilation that is now in effect.  It
   keeps track of where during a parse a message has been output, and
   won't output it again if a second parsing pass turns out to be
   necessary.  Prior to this commit, it had to assume that a message
   from one of these functions did get output, and this caused some
   out-of-bounds reads when a subparse (using a constructed pattern) was
   executed.  The possibility of those went away in commit 5d894ca5213,
   which guarantees it won't try to read outside bounds, but that may
   still mean it is outputting text from the wrong parse, giving
   meaningless results.  This commit should stop that possibility.

4 years agoRestructure grok_bslash_c
Karl Williamson [Wed, 15 Jan 2020 17:48:05 +0000 (10:48 -0700)]
Restructure grok_bslash_c

This commit causes this function to allow a caller to request any
messages generated to be returned to the caller, instead of always being
handled within this function.

Like the previous commit for grok_bslash_c, here are two reasons to do
this, repeated here.

1) In pattern compilation this brings these messages into conformity
   with the other ones that get generated in pattern compilation, where
   there is a particular syntax, including marking the exact position in
   the parse where the problem occurred.

2) The messages could be truncated due to the (mostly) single-pass
   nature of pattern compilation that is now in effect.  It keeps track
   of where during a parse a message has been output, and won't output
   it again if a second parsing pass turns out to be necessary.  Prior
   to this commit, it had to assume that a message from one of these
   functions did get output, and this caused some out-of-bounds reads
   when a subparse (using a constructed pattern) was executed.  The
   possibility of those went away in commit 5d894ca5213, which
   guarantees it won't try to read outside bounds, but that may still
   mean it is outputting text from the wrong parse, giving meaningless
   results.  This commit should stop that possibility.

4 years agoregcomp.c: Add parameter to macro
Karl Williamson [Wed, 15 Jan 2020 11:46:47 +0000 (04:46 -0700)]
regcomp.c: Add parameter to macro

This is to generalize it for future commits.

4 years agodquote.c: Change parameter name
Karl Williamson [Wed, 15 Jan 2020 16:56:07 +0000 (09:56 -0700)]
dquote.c: Change parameter name

In two functions, future commits will generalize this parameter to be
possibly a warning message instead of only an error message.  Change its
name to reflect the added meaning.

4 years agoHoist code point portability warnings
Karl Williamson [Sun, 12 Jan 2020 11:05:59 +0000 (04:05 -0700)]
Hoist code point portability warnings

4 years agoutf8.c: Make global a warning msg text
Karl Williamson [Wed, 15 Jan 2020 12:13:20 +0000 (05:13 -0700)]
utf8.c: Make global a warning msg text

This is in preparation for it to be raised in other files

4 years agoWarn on too high a code point if portable warn enabled
Karl Williamson [Sat, 11 Jan 2020 17:00:32 +0000 (10:00 -0700)]
Warn on too high a code point if portable warn enabled

"use warnings 'portable'" is supposed to warn if a value won't fit on a
32 bit platform.  For the UTF-8 conversion functions it wasn't.  This is
still overridden if the flags to these functions call for no warnings to
be generated, but this commit changes it so that if the portable
category is enabled, but not the non_unicode category, warnings are
generated for the code points that won't work on a 32-bit platform.

4 years agoTest that a leading '_' is ok in \x{}, \o{}
Karl Williamson [Wed, 22 Jan 2020 21:47:00 +0000 (14:47 -0700)]
Test that a leading '_' is ok in \x{}, \o{}

These are ok perhaps accidentally, but shouldn't accidentally become not
ok

4 years agoAdd two more flags to grok_bin_oct_hex
Karl Williamson [Mon, 20 Jan 2020 03:08:42 +0000 (20:08 -0700)]
Add two more flags to grok_bin_oct_hex

These add enough functionality so that other code that rolled its own
version of this can call it instead and get the desired functionality.

One flag silences warnings about overflow.  It would be more consistent
to use the existing flag that gets set when overflow is detected to
silence the warnings if set on input.  But that would be a change in
(undocumented) behavior, and I thought it better to not chance breaking
something.

The other flag forbids an initial underscore when medial underscores are
allowed.  I wasn't aware until I examined the code and documentation
carefully that the flag that I thought allowed  single underscores
between digits, actually also allows for an initial underscore.  I can't
imagine why that was the case, but \N{U+...} never allowed initial
underscores, and adding a flag to grok_hex to allow just medial
underscores allows \N{} in a future commit  to change to use grok_hex()
without changing behavior.

Neither flag is currently exposed outside of the core or extensions

4 years agoperldelta for 6568ef8216f93
Craig A. Berry [Thu, 23 Jan 2020 15:10:11 +0000 (09:10 -0600)]
perldelta for 6568ef8216f93

4 years agoDetect "new" C99 features in configure.com.
Craig A. Berry [Wed, 22 Jan 2020 00:54:35 +0000 (18:54 -0600)]
Detect "new" C99 features in configure.com.

VSI has released a patch kit that finally completes C99 support on
VMS, including stdint.h and assorted math functions.  With this
commit, configure.com now detects and uses the recently-released
but two decades late features that Perl uses based on anything
that Configure would detect on other platforms.

4 years agoperldelta for c23f766f6c2
Tony Cook [Tue, 21 Jan 2020 23:34:30 +0000 (10:34 +1100)]
perldelta for c23f766f6c2

4 years agoChange various search.cpan.org references to metacpan.org and www.cpan.org
Dan Book [Thu, 26 Dec 2019 23:53:54 +0000 (18:53 -0500)]
Change various search.cpan.org references to metacpan.org and cpan.org

4 years agoConfigure: avoid here-doc in eval-ed snippet
Dagfinn Ilmari Mannsåker [Tue, 21 Jan 2020 18:04:32 +0000 (18:04 +0000)]
Configure: avoid here-doc in eval-ed snippet

Some versions of bash, ksh and dash warn or error, complaining about
unterminated here-docs, while some versions complain about syntax
errors in unrelated parts of the script.

This partially reverts commit 52635202f174c9387aa422c4aa32d12f754d8a33.

4 years agoAdapt Configure to GCC version 10
Petr Písař [Tue, 12 Nov 2019 08:19:18 +0000 (09:19 +0100)]
Adapt Configure to GCC version 10

I got a notice from Jeff Law <law@redhat.com>:

    Your particular package fails its testsuite. This was ultimately
    tracked down to a Configure problem. The perl configure script treated
    gcc-10 as gcc-1 and turned on -fpcc-struct-return. This is an ABI
    changing flag and caused Perl to not be able to interact properly with
    the dbm libraries on the system leading to a segfault.

His proposed patch corrected only this one instance of the version
mismatch. Reading the Configure script revealed more issues. This
patch fixes all of them I found.

Please note I do not have GCC 10 available, I tested it by faking the version
with:

--- a/Configure
+++ b/Configure
@@ -4672,7 +4672,7 @@ $cat >try.c <<EOM
 int main() {
 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
 #ifdef __VERSION__
-       printf("%s\n", __VERSION__);
+       printf("%s\n", "10.0.0");
 #else
        printf("%s\n", "1");
 #endif

(cherry picked from commit 6bd6308fcea3541e505651bf8e8127a4a03d22cd, which
was accidentally reverted by commit e849841dca2a8b11119997585f795647c52cdcdf)

4 years agohints/solaris_2.sh: g++ needs same treatment as gcc
Karl Williamson [Tue, 21 Jan 2020 16:38:06 +0000 (09:38 -0700)]
hints/solaris_2.sh: g++ needs same treatment as gcc

This had a test for gcc, which also applies to g++, and it was causing
load failures on solaris built with g++.

Thanks to Dagfinn Ilmari Mannsåker for diagnosing this problem.

4 years agoRegen after backport syncing
H.Merijn Brand [Tue, 21 Jan 2020 16:29:41 +0000 (17:29 +0100)]
Regen after backport syncing

4 years agoperl.h: Add EXTERN_C for flock()
Karl Williamson [Tue, 14 Jan 2020 16:30:13 +0000 (09:30 -0700)]
perl.h: Add EXTERN_C for flock()

This was failing to load on Solaris with g++

Thanks to Dagfinn Ilmari Mannsåker for figuring this out.

4 years agoCBuilder is synced
Chris 'BinGOs' Williams [Tue, 21 Jan 2020 13:46:32 +0000 (13:46 +0000)]
CBuilder is synced

4 years agoUpdate ExtUtils-CBuilder to 0.280234
Alberto Simoes [Tue, 21 Jan 2020 10:53:49 +0000 (10:53 +0000)]
Update ExtUtils-CBuilder to 0.280234

4 years agoMind the gap
Chris 'BinGOs' Williams [Mon, 20 Jan 2020 18:42:28 +0000 (18:42 +0000)]
Mind the gap

4 years agoUpdate Module::CoreList for 5.31.9
Matthew Horsfall [Mon, 20 Jan 2020 18:03:47 +0000 (13:03 -0500)]
Update Module::CoreList for 5.31.9

4 years agoBump the perl version in various places for 5.31.9
Matthew Horsfall [Mon, 20 Jan 2020 17:59:47 +0000 (12:59 -0500)]
Bump the perl version in various places for 5.31.9

4 years agonew perldelta for 5.31.9
Matthew Horsfall [Mon, 20 Jan 2020 17:50:43 +0000 (12:50 -0500)]
new perldelta for 5.31.9

4 years agoTick off 5.31.8 in the release schedule
Matthew Horsfall [Mon, 20 Jan 2020 17:44:46 +0000 (12:44 -0500)]
Tick off 5.31.8 in the release schedule

4 years agoUpdate epigraphs.pod for 5.31.8 release email
Matthew Horsfall [Mon, 20 Jan 2020 17:38:52 +0000 (12:38 -0500)]
Update epigraphs.pod for 5.31.8 release email

4 years agostudy_chunk: panic on unknown REGNODE_VARIES node
Hugo van der Sanden [Mon, 20 Jan 2020 15:37:42 +0000 (15:37 +0000)]
study_chunk: panic on unknown REGNODE_VARIES node

This has panicked on DEBUGGING builds since 56fcde2d6ae (August 2013);
as far as I know we've never seen the panic. It is easy to verify the
possible node types with "grep -P '\bV\b' regcomp.sym".

If you ever see this, it'll be because you just changed something wrongly,
or runaway corruption has occurred.

4 years agoMerge branch 'release-5.31.8' into blead
Matthew Horsfall [Mon, 20 Jan 2020 17:19:59 +0000 (12:19 -0500)]
Merge branch 'release-5.31.8' into blead

4 years agoperldelta: missing angle
Hugo van der Sanden [Mon, 20 Jan 2020 16:38:06 +0000 (16:38 +0000)]
perldelta: missing angle

4 years agoAdd new release to perlhist v5.31.8
Matthew Horsfall [Mon, 20 Jan 2020 16:29:59 +0000 (11:29 -0500)]
Add new release to perlhist

4 years agoperldelta: Fill in New/Updated modules and finalize for release
Matthew Horsfall [Mon, 20 Jan 2020 16:21:24 +0000 (11:21 -0500)]
perldelta: Fill in New/Updated modules and finalize for release

4 years agoUpdate perldelta - add acknowledgements for v5.31.8
Matthew Horsfall [Mon, 20 Jan 2020 16:15:14 +0000 (11:15 -0500)]
Update perldelta - add acknowledgements for v5.31.8

4 years agoFix error in perldelta, forgot to close a C<> sequence
Matthew Horsfall [Mon, 20 Jan 2020 16:13:46 +0000 (11:13 -0500)]
Fix error in perldelta, forgot to close a C<> sequence

4 years agoUpdate Module::CoreList for v5.31.8 release
Matthew Horsfall [Mon, 20 Jan 2020 16:06:41 +0000 (11:06 -0500)]
Update Module::CoreList for v5.31.8 release

4 years agoFix up and cleanup perldelta for v5.31.8
Matthew Horsfall [Mon, 20 Jan 2020 15:52:41 +0000 (10:52 -0500)]
Fix up and cleanup perldelta for v5.31.8

4 years agoUpdate perldelta for all changes from v5.31.7 to v5.31.8
Matthew Horsfall [Mon, 20 Jan 2020 15:39:19 +0000 (10:39 -0500)]
Update perldelta for all changes from v5.31.7 to v5.31.8

4 years agoUpdate autodie to CPAN version 2.32
Chris 'BinGOs' Williams [Mon, 20 Jan 2020 11:22:51 +0000 (11:22 +0000)]
Update autodie to CPAN version 2.32

  [DELTA]

2.32      2020-01-16 11:40:52-06:00 America/Chicago

        * Update automated tests to include soft dependencies.

        * Remove Test::Perl::Critic as a testing requirement.

        * Update README.md to show github actions status
          not Travis.

4 years agoMaintainers.pl should be in sync with CPAN versions now
Chris 'BinGOs' Williams [Mon, 20 Jan 2020 11:21:52 +0000 (11:21 +0000)]
Maintainers.pl should be in sync with CPAN versions now

4 years agoUpdate dist/IO after release to CPAN
Todd Rinaldo [Mon, 20 Jan 2020 07:18:14 +0000 (01:18 -0600)]
Update dist/IO after release to CPAN

Bugtracker and repo now point at perl/perl5. Hopefully this will
encourage people to report IO bugs there.

4 years agoUpdate Changelog for Locale::Maketext after 1.29 release to CPAN
Todd Rinaldo [Mon, 20 Jan 2020 07:10:25 +0000 (01:10 -0600)]
Update Changelog for Locale::Maketext after 1.29 release to CPAN

Also update RT link in the changelog to point to its new location

4 years agoperl.h: Fix false comment about grok_FOO flags
Karl Williamson [Mon, 20 Jan 2020 03:01:14 +0000 (20:01 -0700)]
perl.h: Fix false comment about grok_FOO flags

It is currently impossible to say that you don't want an overflow
message if those warnings are enabled.

4 years agoSkip the new open pragma tests for no ":utf8" under PERL_UNICODE.
Nicholas Clark [Sun, 19 Jan 2020 20:56:02 +0000 (21:56 +0100)]
Skip the new open pragma tests for no ":utf8" under PERL_UNICODE.

PERL_UNICODE can implement an implicit use open ":utf8", which defeats the
intent of what we're testing here.

4 years agoIO: update ChangeLog for new trial release
Ricardo Signes [Mon, 16 Dec 2019 15:53:16 +0000 (10:53 -0500)]
IO: update ChangeLog for new trial release

4 years agoLoading IO is now threadsafe, avoiding the core bug reported as GH #14816.
Nicholas Clark [Mon, 4 Nov 2019 15:58:03 +0000 (16:58 +0100)]
Loading IO is now threadsafe, avoiding the core bug reported as GH #14816.

Re-implement getline() and getlines() as XS code.

The underlying problem that we're trying to solve here is making
getline() and getlines() in IO::Handle respect the open pragma.

That bug was first addressed in Sept 2011 by commit 986a805c4b258067:
    Make IO::Handle::getline(s) respect the open pragma

However, that fix introduced a more subtle bug, hence this reworking.
Including the entirety of the rest of that commit message because it
explains both the bug the previous approach:

    See <https://rt.cpan.org/Ticket/Display.html?id=66474>.  Also, this
    came up in <https://rt.perl.org/rt3/Ticket/Display.html?id=92728>.

    The <> operator, when reading from the magic ARGV handle, automatic-
    ally opens the next file.  Layers set by the lexical open pragma are
    applied, if they are in scope at the point where <> is used.

    This works almost all the time, because the common convention is:

        use open ":utf8";

        while(<>) {
            ...
        }

    IO::Handle’s getline and getlines methods are Perl subroutines
    that call <> themselves.  But that happens within the scope of
    IO/Handle.pm, so the caller’s I/O layer settings are ignored.  That
    means that these two expressions are not equivalent within in a
    ‘use open’ scope:

        <>
        *ARGV->getline

    The latter will open the next file with no layers applied.

    This commit solves that by putting PL_check hooks in place in
    IO::Handle before compiling the getline and getlines subroutines.
    Those hooks cause every state op (nextstate, or dbstate under the
    debugger) to have a custom pp function that saves the previous value
    of PL_curcop, calls the default pp function, and then restores
    PL_curcop.

    That means that getline and getlines run with the caller’s compile-
    time hints.  Another way to see it is that getline and getlines’s own
    lexical hints are never activated.

    (A state op carries all the lexical pragmata.  Every statement
    has one.  When any op executes, it’s ‘pp’ function is called.
    pp_nextstate and pp_dbstate both set PL_curcop to the op itself.  Any
    code that checks hints looks at PL_curcop, which contains the current
    run-time hints.)

The problem with this approach is that the (current) design and implementation
of PL_check hooks is actually not threadsafe. There's one array (as a global),
which is used by all interpreters in the process. But as the code added to
IO.xs demonstrates, realistically it needs to be possible to change the hook
just for this interpreter.

GH #14816 has a fix for that bug for blead. However, it will be tricky (to
impossible) to backport to earlier perl versions.

Hence it's also worthwhile to change IO.xs to use a different approach to
solve the original bug. As described above, the bug is fixed by having the
readline OP (that implements getline() and getlines()) see the caller's
lexical state, not their "own". Unlike Perl subroutines, XS subroutines don't
have any lexical hints of their own. getline() and getlines() are very
simple, mostly parameter checking, ending with a one line that maps to
a single core OP, whose values are directly returned.

Hence "all" we need to do re-implement the Perl code as XS. This might look
easy, but turns out to be trickier than expected. There isn't any API to be
called for the OP in question, pp_readline(). The body of the OP inspects
interpreter state, it directly calls pp_rv2gv() which also inspects state,
and then it tail calls Perl_do_readline(), which inspects state.

The easiest approach seems to be to set up enough state, and then call
pp_readline() directly. This leaves us very tightly coupled to the
internals, but so do all other approaches to try to tackle this bug.

The current implementation of PL_check (and possibly other arrays) still
needs to be addressed.

4 years agoAdd tests for IO::Handle getline() and getlines().
Nicholas Clark [Sun, 3 Nov 2019 10:06:59 +0000 (11:06 +0100)]
Add tests for IO::Handle getline() and getlines().

Extend the tests for <> and the open pragma to verify that the behaviour
changes with/without the open pragma.

4 years agonumeric.c: White-space only
Karl Williamson [Wed, 15 Jan 2020 12:07:10 +0000 (05:07 -0700)]
numeric.c: White-space only

Indent code that the previous commit added an enclosing block
surrounding it.

And vertically align some comments

4 years agogrok_bin_oct_hex: Add two output flags
Karl Williamson [Wed, 15 Jan 2020 12:05:42 +0000 (05:05 -0700)]
grok_bin_oct_hex: Add two output flags

This commit adds two output flags returned from this function to the one
previously existing, so that the caller can be informed of the problems
found and take its own action.

This involves the behavior of two existing flags, whose being set
suppresses the warning if particular conditions exist in the input being
parsed.  Both flags were currently always cleared upon return.

One of those flags is non-public.  I changed it so that it isn't cleared
upon return if the condition it describes is found.

The other flag is public.  I thought that some existing code, though
unlikely,  might be relying on the flag being always cleared.  So I
added a completely new flag from a previously unused bit that, if clear
on input there is no change in behavior; but if set on input, it will
remain set on output if the condition is met; otherwise cleared.  The
only code that could possibly be affected is that which sets this unused
bit, but expects it to be cleared after the return.  This is very
unlikely.

4 years agore/pat.t: Fix failure on some systems
Karl Williamson [Fri, 17 Jan 2020 04:18:49 +0000 (21:18 -0700)]
re/pat.t: Fix failure on some systems

This appears to be a difference in how shells run.  On many of H. Merijn
Brand's  boxes, this a test is failing.  By avoiding the shell by using
fresh_perl instead of runperl, it succeeds there, without breaking
elsewhere.

4 years agoembed.fnc: grok_bin_oct_hex() isn't documented
Karl Williamson [Fri, 17 Jan 2020 00:36:58 +0000 (17:36 -0700)]
embed.fnc: grok_bin_oct_hex() isn't documented

So, don't claim that it is.  It is an internal function, common to
grok_bin, et. al.

4 years agot/test.pl: Add comments about runperl vs fresh_perl
Karl Williamson [Fri, 17 Jan 2020 16:00:05 +0000 (09:00 -0700)]
t/test.pl: Add comments about runperl vs fresh_perl

4 years agot/test.pl: fresh_perl has only 2 args
Karl Williamson [Fri, 17 Jan 2020 15:39:39 +0000 (08:39 -0700)]
t/test.pl: fresh_perl has only 2 args

So referring to the "third" is wrong.

4 years agoperlapi sv_setpvn: Note UTF-8 flag not affected
Karl Williamson [Thu, 16 Jan 2020 20:38:18 +0000 (13:38 -0700)]
perlapi sv_setpvn: Note UTF-8 flag not affected

4 years agogrok_bin_oct_hex: Unroll loop one more iteration
Karl Williamson [Thu, 16 Jan 2020 18:57:04 +0000 (11:57 -0700)]
grok_bin_oct_hex: Unroll loop one more iteration

Earlier I was confused when I thought that 7 hex digits were the max
before we needed to start worrying about overflow.  That's true for
signed results where everything above 7FFF_FFFF won't fit in a 32-bit
signed integer.  But these functions return unsigned, and so any 8
digits will fit in a 32-bit word.

4 years agoutf8.c: Use already-computed variable
Karl Williamson [Sat, 11 Jan 2020 04:46:33 +0000 (21:46 -0700)]
utf8.c: Use already-computed variable

instead of doing it a second time

4 years agoRefactor grok_number_flags to speed it up
Karl Williamson [Fri, 17 Jan 2020 18:51:32 +0000 (11:51 -0700)]
Refactor grok_number_flags to speed it up

This uses a variety of techniques to improve the performance.

The chief one is to switch on the input length for the unrolled part of
the loop, like is done in grok_bin_oct_hex().  This eliminates having to
check if we are at the end of the string each time we process and
advance a digit through it.

Explicit branch predictions were added.  One assumes that the input
won't have a sign more frequently than it does have one.

Some setup conditionals were eliminated.  One way is that this ignores
leading spaces.  Previously, it just advanced through any and then
checked if we are at the end of the string after having done so.  That
check can be eliminated if we didn't advance.

Also, I check for a sign with a single conditional, eliminating a check
for minus, then, if not found, one for plus.  Instead, if it is a sign,
there is an extra check for which one.  Thus it rewards unsigned input,
and penalizes signed, by a single conditional each way.

4 years agoperldelta for commit 9c952fa3
James E Keenan [Sat, 18 Jan 2020 14:13:09 +0000 (09:13 -0500)]
perldelta for commit 9c952fa3

4 years agoSync with CPAN version 5.01 of Term::ANSIColor
Russ Allbery [Sat, 18 Jan 2020 14:11:44 +0000 (09:11 -0500)]
Sync with CPAN version 5.01 of Term::ANSIColor

4 years agoCreate crosslinks betwen perlrun sections
Dan Book [Mon, 13 Jan 2020 21:49:05 +0000 (16:49 -0500)]
Create crosslinks betwen perlrun sections