This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
4 years agopp_(get|set)priority: remove ancient glibc C++ workaround
Dagfinn Ilmari Mannsåker [Tue, 4 Feb 2020 15:24:54 +0000 (15:24 +0000)]
pp_(get|set)priority: remove ancient glibc C++ workaround

Glibc has enum typedefs for some arguments that are defined as `int`
by the X/Open standard.  This is fine in C, but until glibc
2.3 (released in 2002) this was also done for C++, which is not
allowed.

4 years agoDo not ignore non-zero error code from 'make minitest'
James E Keenan [Fri, 31 Jan 2020 03:23:18 +0000 (03:23 +0000)]
Do not ignore non-zero error code from 'make minitest'

In pipelines like:

    $ sh ./Configure -des -Dusedevel && \
        make minitest && make test_harness

... we don't want to run 'make test_harness' unless 'make minitest' has
succeeded.

To test:

    $ echo "exit(1);" >> t/base/cond.t
    $ make minitest && echo "hello world"
    # [note that minitest fails quickly and 'echo' is not reached]

    $ git checkout -- t/base/cond.t
    $ make minitest && echo "hello world"
    # [note that minitest runs and 'echo' is reached]

For: https://github.com/perl/perl5/issues/16160
Originally: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=132139

4 years agoProhibit usage of Test::Simple under 't/'
James E Keenan [Mon, 3 Feb 2020 21:33:19 +0000 (16:33 -0500)]
Prohibit usage of Test::Simple under 't/'

One of the objectives of t/porting/bootstrap.t has been to prohibit use of
testing modules which need to be loaded via 'use MODULE' in test files found
in subdirectories under 't/'.  In those subdirectories, we do not presume that
module loading via 'use MODULE' has been demonstrated to work.  However, the
unit test in bootstrap.t was written solely to spot instances of 'use
Test::More'.  It did not consider the possibility that a test file under 't/'
might 'use Test::Simple'.

There was one such test file which use-d Test::Simple:
t/lib/overload_nomethod.t.  This patch rewrites that file to use 't/test.pl'
(as other t/lib/*.t files customarily do) and adapts t/porting/bootstrap.t to
rule out 'use Test::Simple' as well as 'use Test::More' from '*.t' files
underneath 't/'.

For:  https://github.com/Perl/perl5/issues/13231

4 years agoClarify guidance for usage of Test::More in tests
James E Keenan [Mon, 3 Feb 2020 20:44:50 +0000 (15:44 -0500)]
Clarify guidance for usage of Test::More in tests

As reported by Smylers in RT 119619 (now GH 13231), the guidance
provided in 'perlhack' for usage of Test::More is misleading.  In
practice, we do not use Test::More in test files in the
subdirectories underneath 't/'.  In these directories we test
Perl 5's "pre-modular" functionality -- functionality which does not
depend on our having demonstrated that we can load code via 'use
MODULE'.  Usage of 'use MODULE' in 't/*/*.t' files has been largely
prohibited by a unit test in t/porting/bootstrap.t.

This patch clarifies that guidance.

POD correction per Tony Cook

For:  https://github.com/Perl/perl5/issues/13231

4 years agomulticoncat: keep assign for 'local $foo = "..."'
David Mitchell [Tue, 4 Feb 2020 12:23:26 +0000 (12:23 +0000)]
multiconcat: keep assign for 'local $foo = "..."'

In something like

    local $~ = "$~X";

i.e. where localising a magic variable whose previous value should be
used as part of a string concat on the RHS, don't fold the assign into
the multiconcat op. Otherwise the code execution path looks a bit like:

    local($~) = undef;
    multiconcat($~, $~, "X");

[ where multiconcat's args are (target, arg1, arg2,....) ]
and thus multiconcat sees an undef arg.

By leaving the assign out of the multiconcat, code execution now looks
like
    my $targ;
    multiconcat($targ, $~, "X");
    local($~) = $targ;

See http://nntp.perl.org/group/perl.perl5.porters/256898,
    "Bug in format introduced in 5.27.6".

Although the bug only appears with magic vars, this patch pessimises
all forms of 'local $foo = "..."', 'local $foo{bar} = "..."' etc.
Strictly speaking the bug occurs because with 'local' you end up with
two SVs (the saved one and the one currently in the glob) which both
have the same container magic and where mg_set()ing one changes the
mg_get() value of the other. Thus, vars like $!. One of the two SVs
becomes an arg of multiconcat, the other becomes its target. Part of
localising the target SV (before multiconcat is called) wipes the value
of the arg SV.

4 years agopp_sort.c: Tinker with pp_sort to untickle mingw bug
Yves Orton [Sun, 2 Feb 2020 13:15:18 +0000 (14:15 +0100)]
pp_sort.c: Tinker with pp_sort to untickle mingw bug

4 years agopp_crypt(): reindent CPP directives
David Mitchell [Mon, 3 Feb 2020 14:44:55 +0000 (14:44 +0000)]
pp_crypt(): reindent CPP directives

They were all over the place.

Whitespace-only.

4 years agoB::perlstring - add support for \e (Fix #17526)
Yves Orton [Tue, 4 Feb 2020 08:02:47 +0000 (09:02 +0100)]
B::perlstring - add support for \e (Fix #17526)

In daf6caf1ef25ff48f871fa1e53adcefc11bf1d08 karl made pv_uni_display()
use the available mnemonic escapes instead of using \x{} style escapes.

This broke B::perlstring() which has an exclusion list of such escapes
to passthrough, and it did not know about \e, so it produced "\\e"
instead of "\e", which of course does not round trip.

This in turn broke Sub::Quote, which in turn breaks Moo, which breaks
a lot of stuff. :-)

Unfortunately B::perlstring() had no tests to detect this, so we only
found out when we got a BBC report that happened to also ticklet this
bug.

This patch adds 'e' to the exclusion list, and also adds tests to see
that the the first 1024 unicode codepoints and all 255 non-unicode
codepoints can round trip through B::perlstring().

This should resolve #17526 and indirectly help us close #17245.

With this patch we bump B.pm to v1.80

4 years agoSupport Unicode properties Identifier_(Status|Type)
Karl Williamson [Mon, 3 Feb 2020 23:20:03 +0000 (16:20 -0700)]
Support Unicode properties Identifier_(Status|Type)

These non-UCD properties are now being asked to be supported by the
Unicode regular expression specification, UTS #18

These have a slightly different header syntax for giving the version
than UCD files.  In this commit, I modify these to fit, but will
probably have to generalize at some point the parsing of versions in
mktables.

4 years agoAdd Unicode UTS #39 files
Karl Williamson [Mon, 3 Feb 2020 23:19:26 +0000 (16:19 -0700)]
Add Unicode UTS #39 files

The Unicode regular expression specification, UTS #18 is being revised
to require properties that aren't part of the strict Unicode character
database.  This commit adds the first two that are being asked for.

4 years agomktables: Generalize the scx property handling
Karl Williamson [Mon, 3 Feb 2020 21:49:44 +0000 (14:49 -0700)]
mktables: Generalize the scx property handling

Until now, this property was unique in that it specifies a set of
possible values for scripts that a character can be in, rather than a
single script.  That multiplicity has been handled specially.  But the
next couple of commits will introduce another property that has similar
characteristics.  This commit makes the scx handling more general, so as
to also be usable for the new property.

4 years agomktables: Improve warning msg
Karl Williamson [Mon, 3 Feb 2020 21:01:56 +0000 (14:01 -0700)]
mktables: Improve warning msg

4 years agomktables: Add capability to override match directory
Karl Williamson [Mon, 3 Feb 2020 20:44:44 +0000 (13:44 -0700)]
mktables: Add capability to override match directory

This is because this is still supposed to work on DOS 8.3 filesystems,
and future commits will use non-Unicode-Character-Database tables which
don't have shorter names.

4 years agopp_crypt(): remove ancient glibc bug workaround
David Mitchell [Mon, 3 Feb 2020 12:37:15 +0000 (12:37 +0000)]
pp_crypt(): remove ancient glibc bug workaround

GH #16552

In 2003 a fix was added to workaround a bug in glibc's crypt_r()
implementation (which involved tweaking a private undocumented field
within the crypt_data struct). This bug has long since been fixed, but
the workaround remained. This commit finally removes that workaround.

See also v5.27.11-33-ge9c9cf5759.

4 years agoTie::File: use unique tmp filename in 29a_upcopy.t
David Mitchell [Mon, 3 Feb 2020 12:15:54 +0000 (12:15 +0000)]
Tie::File: use unique tmp filename in 29a_upcopy.t

This is a followup to v5.31.7-92-g0a1552bada which made each Tie::File
test script use a separate prefix for its test file names. However,
there are two test files with prefixes 29_ and 29a_, and that commit
made them both use "29" for the temp file. Make it "29a" instead.

4 years agotoke.c: fix Multidimensional array heuristic to ignore function calls
Yves Orton [Fri, 31 Jan 2020 14:02:46 +0000 (15:02 +0100)]
toke.c: fix Multidimensional array heuristic to ignore function calls

Fix issue #16535 - $t[index $x, $y] should not throw Multidimensional
array warnings.

The heuristic for detecting lists in array subscripts is implemented
in toke.c, which means it is not particularly reliable. There are
lots of ways that code might return a list in an array subscript.

So for instance $t[do{ $x, $y }] should throw a warning but doesn't.

On the other hand, we can make this warning less likely to happen
by being a touch more careful about how we parse the inside of the
square brackets so we do not throw an exception from $t[index $x,$y].

Really this should be moved to the parser so we do not need to rely
on fallable heuristics, and also into the runtime so that if we have

    $t[f()]

and f() returns a list we can also warn there. But for now this
improves things somewhat.

4 years agoop.c: hoist first-pass logic out of loop in pmtrans()
Hugo van der Sanden [Sat, 1 Feb 2020 12:20:42 +0000 (12:20 +0000)]
op.c: hoist first-pass logic out of loop in pmtrans()

Mainly to avoid gcc warnings that found the logic too complex to follow.

4 years agoop.c: balance braces in #if 0 section
Hugo van der Sanden [Sat, 1 Feb 2020 12:11:07 +0000 (12:11 +0000)]
op.c: balance braces in #if 0 section

Balance the braces so we can bounce to matching braces for the rest
of S_pmtrans.

4 years agopp_sort.c: fix fencepost error in call to av_extend()
Yves Orton [Fri, 31 Jan 2020 14:34:48 +0000 (15:34 +0100)]
pp_sort.c: fix fencepost error in call to av_extend()

In [rt.cpan.org #39196] issue #17496 there is a report
that Tie::File produced spurious blank lines in the file
after

    @tied= sort @tied;

it turns out that this is because Tie::File treats
EXTEND similarly to STORESIZE (which is arguably not
entirely correct, but also not that weird) coupled
with an off by one error in the calls to av_extend()
in pp_sort.

This patch fixes the fencepost error, adds some comments
to av_extend() to make it clear what it is doing, and
adds a test that EXTEND is called by this code with
correct argument.

4 years agoperltie.pod: rework example code so EXTEND is a no-op
Yves Orton [Thu, 30 Jan 2020 08:36:37 +0000 (09:36 +0100)]
perltie.pod: rework example code so EXTEND is a no-op

Most tied array implementations can and should NO-OP the EXTEND
method, and the sample code should not conflate EXTEND with STORESIZE.

EXTEND is actually less usefully used by the core than it could be
as AvMAX() does not have an equivalent tied method. So we cannot
check if we need to extend for a tied array.

This is related to [rt.cpan.org #39196] / Issue #17496.

4 years agoUse Unicode 13.0 (beta)
Unicode Consortium [Tue, 28 Jan 2020 17:36:44 +0000 (10:36 -0700)]
Use Unicode 13.0 (beta)

Unicode has changed its yearly release cycle so that the final version
is not available until early March of the year.  This year it is March
10, 2020.

However, all changes planned were finalized in early January, and the
actual computer files have been updated to their presumably final
substantive versions.  The release has been authorized without further
review needed.

The release is awaiting final documentation additions, and soak time of
the beta to verify there are no glitches.  This commit causes Perl to
participate in that soak.

I don't anticipate any problems, and likely the only substantive change
upon the official release will be to update perldelta.  Comments in the
files supplied by Unicode will likely also change to indicate these are
no longer beta.

There were very few changes affecting existing characters; most of the
changes involved adding new characters, including emoji.  The break
characteristics of some existing characters were changed (GCB, LB, WB,
and SB properties).  The only perl code I really had to change to cope
with the new release was about rules in the Line Break property, dealing
around ellipses (...) and certain East Asian characters next to opening
parentheses.

If there are problems, we can revert this at any time, and ship with
12.0.

4 years agoChange Unicode property abbrev to upcoming official
Karl Williamson [Thu, 30 Jan 2020 20:20:53 +0000 (13:20 -0700)]
Change Unicode property abbrev to upcoming official

Unicode 12.0 used a new property file that was not from the Unicode
Character Database.  It only had a long property name.  I incorporated
it into our data, and rather than use the very long name all the time, I
created my own short name, since there was no official one.

Now, the upcoming 13.0 has moved the file to the UCD, and come up with a
short name that differs from the one I had.  This commit converts to use
Unicode's name.  This property is not exposed to user or XS space, so
there is no user impact.

4 years agoregen/mk_invlists.pl: Sort generated tables alphabetically
Karl Williamson [Thu, 30 Jan 2020 20:02:19 +0000 (13:02 -0700)]
regen/mk_invlists.pl: Sort generated tables alphabetically

This change causes certain tables to be sorted so their row and column
headings appear alphabetically, which makes them easier to read.

4 years agoregen/mk_invlists.pl: Clarify comment in output .h
Karl Williamson [Thu, 30 Jan 2020 19:52:30 +0000 (12:52 -0700)]
regen/mk_invlists.pl: Clarify comment in output .h

4 years agoregen/mk_invlists.pl: Do sort caselessly in places
Karl Williamson [Thu, 30 Jan 2020 19:39:12 +0000 (12:39 -0700)]
regen/mk_invlists.pl: Do sort caselessly in places

This makes things more like dictionary order

4 years agoregen/mk_invlists.pl; White space, comments only
Karl Williamson [Thu, 30 Jan 2020 18:11:58 +0000 (11:11 -0700)]
regen/mk_invlists.pl; White space, comments only

4 years agoperldelta for commit 92e3396ae2
James E Keenan [Wed, 29 Jan 2020 18:49:23 +0000 (13:49 -0500)]
perldelta for commit 92e3396ae2

4 years agoFix minor grammar nit in threads docs
Paul Johnson [Wed, 29 Jan 2020 17:02:02 +0000 (18:02 +0100)]
Fix minor grammar nit in threads docs

Committer: Increment $VERSION.

4 years agoLocal variable 'o' hides a parameter of the same name
James E Keenan [Mon, 27 Jan 2020 20:22:54 +0000 (15:22 -0500)]
Local variable 'o' hides a parameter of the same name

LGTM static code analysis identified declaration of 'o' in a scope where
a variable of the same name had already been declared in an enclosing
scope.

Simply renaming the variable within the inner scope did not work
(extensive segfaults).  Tony Cook identified problem:  In inner scope we
were using macro cLISTOPo, which implicitly modifies 'o'.  Since
cLISTOPo is nothing more than macro cLISTOPx() with 'o' provided as the
argument, we can resolve the problem by using cLISTOPx() with a better
named variable -- in this case, 'child'.

Reference:  https://lgtm.com/projects/g/Perl/perl5/snapshot/9b2028e54156e4dbcc7a57bbd72e1b00a2e0ce39/files/op.c?sort=name&dir=ASC&mode=heatmap#x9b0ebeab3d026530:1

4 years agoHarmonize whitespace.
James E Keenan [Mon, 27 Jan 2020 20:02:46 +0000 (15:02 -0500)]
Harmonize whitespace.

4 years agoCorrect misleading entries in SYNOPSIS
James E Keenan [Wed, 29 Jan 2020 03:05:49 +0000 (22:05 -0500)]
Correct misleading entries in SYNOPSIS

Correct documentation as per suggestion from T.E. Hofmann.  Add a new test file demonstrating correctness of the synopsis.

For: GH 17499

Originally reported 2004-03-30 by T.E. Hofmann in Tie-File RT queue:
https://rt.cpan.org/Ticket/Display.html?id=5837

4 years agoperldelta for 6212a44b69c4, 8e30fd6e957f
Tony Cook [Tue, 28 Jan 2020 23:31:20 +0000 (10:31 +1100)]
perldelta for 6212a44b69c48e30fd6e957f

4 years agobump $IO::VERSION
Tony Cook [Tue, 21 Jan 2020 04:29:13 +0000 (15:29 +1100)]
bump $IO::VERSION

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