This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
2 years agofix wrong number of parameters for macro SHIFT_VAR
Alexandr Savca [Mon, 8 Oct 2018 14:32:44 +0000 (17:32 +0300)]
fix wrong number of parameters for macro SHIFT_VAR

2 years agoregcomp.c: Change error reporting mechanism slightly
Karl Williamson [Fri, 2 Mar 2018 11:47:45 +0000 (04:47 -0700)]
regcomp.c: Change error reporting mechanism slightly

There are (rare) constructs which cause regcomp.c to modify the user
input stream (stashing the original), and that is parsed instead before
returning to the continue with the original.  A problem arises if an
error occurs during the parsing of this modified version.  We want to
report the location of the error and context based on the original.
This led to 285b5ca0145796a915dec03e87e0176fd4681041 (fixing #126261).

This new commit simplifies the mechanism so that it is easier to
understand.

2 years agoEliminated 3 '-Wparentheses' warnings detected by g++-8.
James E Keenan [Wed, 26 Sep 2018 16:43:04 +0000 (12:43 -0400)]
Eliminated 3 '-Wparentheses' warnings detected by g++-8.

For: RT # 133557

2 years agoperldelta for 1ed4b7762a85
Tony Cook [Wed, 10 Oct 2018 03:31:44 +0000 (14:31 +1100)]
perldelta for 1ed4b7762a85

2 years ago(perl #126760) adapt sigtrap for layers on STDERR.
Tony Cook [Wed, 26 Sep 2018 01:12:34 +0000 (11:12 +1000)]
(perl #126760) adapt sigtrap for layers on STDERR.

sigtrap defines a signal handler apparently intended to be called
under unsafe signals, since a) the code was written before safe
signals were implemented and b) it uses syswrite() for output and
avoid creating new SVs where it can.

Unfortunately syswrite() doesn't handle PerlIO layers, *and* with
syswrite() being disallowed for :utf8 handlers, throws an exception.

This causes the sigtrap tests to fail if PERL_UNICODE is set and the
current locale is a UTF-8 locale.

I want to avoid allocating new SVs until the point where the code
originally did so, so the code now attempts a syswrite() under
eval, falling back to print, and then at the point where the original
code started allocating SVs uses PerlIO::get_layers() to check if
any layers might make a difference to the output.

2 years ago(perl #125760) fatalize sysread/syswrite/recv/send on :utf8 handles
Tony Cook [Tue, 25 Sep 2018 01:18:40 +0000 (11:18 +1000)]
(perl #125760) fatalize sysread/syswrite/recv/send on :utf8 handles

This includes removing the :utf8 logic from pp_syswrite.  pp_sysread
retains it, since it's also used for read().

Tests that are specifically testing the behaviour against :utf8
handles have been removed (eg in lib/open.t), several other tests
that incidentally used those functions on :utf8 handles have been
adapted to use :raw handles instead (eg. op/readline.t).

Test lib/sigtrap.t fails if STDERR is :utf8, in code from the
original 5.000 commit, which is intended to run in a signal handler

2 years agoRT#133573: $^X fallback when platform-specific technique fails
Aaron Crane [Tue, 9 Oct 2018 13:41:10 +0000 (14:41 +0100)]
RT#133573: $^X fallback when platform-specific technique fails

2 years agofix typos
Alexandr Savca [Tue, 9 Oct 2018 10:26:36 +0000 (13:26 +0300)]
fix typos

Committer: For porting tests: Update $VERSION in 4 files.

Run:
    ./perl -Ilib regen/mk_invlists.pl
    ./perl -Ilib regen/regcharclass.pl

2 years agoregcomp.c: Fix Posix ASCII defins for cased, vert space
Karl Williamson [Sun, 7 Oct 2018 14:56:27 +0000 (08:56 -0600)]
regcomp.c: Fix Posix ASCII defins for cased, vert space

The current definitions are wrong, but not actually used currently.
This fixes them.  cased is the same as alphabetic in the ASCII range,
and set vert space to NULL so that it won't inadvertently get used

2 years agoperl.c: Silence compiler warning
Karl Williamson [Sun, 7 Oct 2018 14:51:38 +0000 (08:51 -0600)]
perl.c: Silence compiler warning

A space is needed in these formats to comply with C++11

2 years agoPOSIX.pod: Mark cuserid() as obsolete
Matthias Bethke [Sat, 6 Oct 2018 04:39:09 +0000 (22:39 -0600)]
POSIX.pod: Mark cuserid() as obsolete

2 years agoAdd Matthias Bethke to AUTHORS
Karl Williamson [Sat, 6 Oct 2018 04:45:06 +0000 (22:45 -0600)]
Add Matthias Bethke to AUTHORS

2 years agomention gmake builds in a few more places.
Tony Cook [Wed, 12 Sep 2018 05:49:25 +0000 (15:49 +1000)]
mention gmake builds in a few more places.

2 years ago(perl #133494) better document CCHOME for GCC builds
Tony Cook [Wed, 12 Sep 2018 05:48:27 +0000 (15:48 +1000)]
(perl #133494) better document CCHOME for GCC builds

2 years agoperldelta for 2273039810f4
Tony Cook [Fri, 5 Oct 2018 04:41:09 +0000 (14:41 +1000)]
perldelta for 2273039810f4

2 years ago(perl #133439) fix -Dm reporting for calloc()
Tony Cook [Thu, 6 Sep 2018 04:05:20 +0000 (14:05 +1000)]
(perl #133439) fix -Dm reporting for calloc()

a) report both the size and count, and the total allocated rather than
   just the count and total allocated, which was displayed in a
   misleading fashion

b) use %zu formatting to match the original types (size_t) and remove
   the casts to long, which can lose information on Win32, where
   long is 32-bits on x64 builds.

2 years agoImplement scheduled fatalization of my() in false conditional
James E Keenan [Tue, 25 Sep 2018 19:28:46 +0000 (15:28 -0400)]
Implement scheduled fatalization of my() in false conditional

op.c: substitute exception for warning.  Move documentation in perldiag
from W to F.  Remove tests for warnings for such statements.

Test for expected error messages for my() in false conditional.  Make
new tests more self-documenting.

For: RT # 133543

2 years agoChange REG_INFTY to 2**16-1, instead of 2**15-1
Karl Williamson [Sun, 30 Sep 2018 18:10:17 +0000 (12:10 -0600)]
Change REG_INFTY to 2**16-1, instead of 2**15-1

This commit doubles the upper limit that unbounded regular expression
quantifiers can match up to.  Things like {m,} "+" and "*" now can match
up to U16_MAX times.

We probably should make this a 32 bit value, but doing this doubling was
easy and has fewer potential implications.

See http://nntp.perl.org/group/perl.perl5.porters/251413 and
followups

2 years agoperlre: Add missing word to fix grammar
Karl Williamson [Sun, 30 Sep 2018 17:27:13 +0000 (11:27 -0600)]
perlre: Add missing word to fix grammar

2 years agoregexec.c: Comments, White-space only
Karl Williamson [Sat, 29 Sep 2018 15:13:03 +0000 (09:13 -0600)]
regexec.c: Comments, White-space only

A few clarifications

2 years agoregexec.c: Remove obsolete comments
Karl Williamson [Sat, 29 Sep 2018 15:07:39 +0000 (09:07 -0600)]
regexec.c: Remove obsolete comments

The first comment listed an item as a TODO that was recommended by
Unicode.  That recommendation is being rescinded in Unicode 12.0 based
on a ticket I filed against Unicode, which in turn was based on feedback
from Asmus Freitag.

The second comment was obsoleted by later code changes.

2 years agoregexec.c: Remove macro use for further clarity
Karl Williamson [Sat, 29 Sep 2018 15:03:12 +0000 (09:03 -0600)]
regexec.c: Remove macro use for further clarity

Commit 4c83fb55d7096a1d0e6a7a8e25d20b186be3281d added a macro for
clarity.  I have since realized that it is even clearer to spell things
as this commit now does.

2 years agore/script_run.t: White-space only
Karl Williamson [Sun, 30 Sep 2018 16:41:04 +0000 (10:41 -0600)]
re/script_run.t: White-space only

2 years agoPATCH: [perl #133547]: script run broken
Karl Williamson [Sun, 30 Sep 2018 16:38:02 +0000 (10:38 -0600)]
PATCH: [perl #133547]: script run broken

All scripts can have the ASCII digits for their numbers.  Scripts with
their own digits can alternatively use those.  Only one of these two
sets can be used in a script run.  The decision as to which set to use
must be deferred until the first digit is encountered, as otherwise we
don't know which set will be used.  Prior to this commit, the decision
was being made prematurely in some cases.  As a result of this change,
the non-ASCII-digits in the Common script need to be special-cased, and
different criteria are used to decide if we need to look up whether a
character is a digit or not.

2 years agoregexec.c: Rename variable
Karl Williamson [Sun, 30 Sep 2018 16:33:22 +0000 (10:33 -0600)]
regexec.c: Rename variable

The new name is clearer as to its meaning, more so after the next
commit.

2 years agouse a buffer for is_cur_LC_category_utf8
Nicolas R [Wed, 26 Sep 2018 22:15:56 +0000 (17:15 -0500)]
use a buffer for is_cur_LC_category_utf8

avoid malloc/free when possible

2 years agoUpdates CPAN.pm to ANDK/CPAN-2.21-TRIAL.tar.gz
Andreas Koenig [Thu, 27 Sep 2018 06:06:34 +0000 (06:06 +0000)]
Updates CPAN.pm to ANDK/CPAN-2.21-TRIAL.tar.gz

2 years agoperldelta for 903b1101f7c2c55545e6cfd3eb5dfd564e1befd2
James E Keenan [Wed, 26 Sep 2018 14:40:55 +0000 (14:40 +0000)]
perldelta for 903b1101f7c2c55545e6cfd3eb5dfd564e1befd2

2 years agoRemove arybase support from B::Deparse
Dagfinn Ilmari Mannsåker [Mon, 4 Dec 2017 11:27:57 +0000 (11:27 +0000)]
Remove arybase support from B::Deparse

2 years agoRemove support for setting $[ to a non-zero value
Dagfinn Ilmari Mannsåker [Wed, 18 Oct 2017 00:01:11 +0000 (01:01 +0100)]
Remove support for setting $[ to a non-zero value

This removes arybase and all its surrounding machinery.

2 years agoperldelta for eda3f954e1ab
Tony Cook [Wed, 26 Sep 2018 05:09:13 +0000 (15:09 +1000)]
perldelta for eda3f954e1ab

2 years ago(perl #130674) don't modify $^H in vars.pm
Tony Cook [Wed, 1 Feb 2017 05:31:02 +0000 (16:31 +1100)]
(perl #130674) don't modify $^H in vars.pm

This could remove non-vars strictness from the caller.

2 years agoRemove perlweb bits from release manager's guide
John SJ Anderson [Tue, 25 Sep 2018 14:15:10 +0000 (07:15 -0700)]
Remove perlweb bits from release manager's guide

See <http://nntp.perl.org/group/perl.perl5.porters/252271> for
contextual detail around this removal.

2 years agoAvoid compiler warning showing up on darwin.
James E Keenan [Tue, 11 Sep 2018 00:30:11 +0000 (20:30 -0400)]
Avoid compiler warning showing up on darwin.

For example, in http://perl5.test-smoke.org/report/69659

2 years agoRemove B::Debug from core distribution.
James E Keenan [Sun, 23 Sep 2018 21:20:32 +0000 (17:20 -0400)]
Remove B::Debug from core distribution.

It continues to exist as a CPAN distribution.

Increment $B::Terse::VERSION and $B::Concise::VERSION due to changes in POD.

Remove internal links to B::Debug within two .pod files.

For: RT #130410

2 years agoamend sisyphus' email in Porting/checkAUTHORS.pl
sisyphus [Mon, 24 Sep 2018 15:03:32 +0000 (01:03 +1000)]
amend sisyphus' email in Porting/checkAUTHORS.pl

Committer: Retain contributor's superseded email address in 2nd column.
Re-alphabetize 1st column of Porting/checkAUTHORS.pl a little.

2 years agoamend sisyphus' email address in AUTHORS
sisyphus [Mon, 24 Sep 2018 15:03:10 +0000 (01:03 +1000)]
amend sisyphus' email address in AUTHORS

2 years agodefine HAS_LDEXPL in win32/config_H.gc
sisyphus [Sat, 22 Sep 2018 00:39:02 +0000 (10:39 +1000)]
define HAS_LDEXPL in win32/config_H.gc

2 years agodefine d_ldexpl in win32/config.gc
sisyphus [Sat, 22 Sep 2018 00:37:22 +0000 (10:37 +1000)]
define d_ldexpl in win32/config.gc

2 years agoregcomp.c: Fix typo in debug stmt
Karl Williamson [Sun, 23 Sep 2018 16:30:47 +0000 (10:30 -0600)]
regcomp.c: Fix typo in debug stmt

The name of the function was misspelled.

2 years agoChooser of the slain
Chris 'BinGOs' Williams [Fri, 21 Sep 2018 16:53:30 +0000 (17:53 +0100)]
Chooser of the slain

2 years agoUpdate Module-CoreList for v5.29.4 (shim)
Chris 'BinGOs' Williams [Fri, 21 Sep 2018 16:44:19 +0000 (17:44 +0100)]
Update Module-CoreList for v5.29.4 (shim)

2 years agot/uni/caller.t should declare its plan at run time
Nicolas R [Thu, 20 Sep 2018 21:06:52 +0000 (15:06 -0600)]
t/uni/caller.t should declare its plan at run time

Unit test should declare their test plan after
compilation when possible.

2 years agoAdjust t/op/stat.t when run from docker
Nicolas R [Thu, 20 Sep 2018 21:25:18 +0000 (15:25 -0600)]
Adjust t/op/stat.t when run from docker

Skipping tty tests on linux containers
like docker.

2 years agoMove the is_linux_container test helper to test.pl
Nicolas R [Thu, 20 Sep 2018 21:21:32 +0000 (15:21 -0600)]
Move the is_linux_container test helper to test.pl

op/getppid.t helper is_linux_container could be used
by other tests. In order to avoid multiple definitions
of that function and take advantage of any future changes
move that helper to test.pl which is used by most tests.

2 years agoperldelta for 12cad9bd9972
Tony Cook [Fri, 21 Sep 2018 05:56:07 +0000 (15:56 +1000)]
perldelta for 12cad9bd9972

2 years agobumping versions to 5.29.4
John SJ Anderson [Fri, 21 Sep 2018 03:35:56 +0000 (20:35 -0700)]
bumping versions to 5.29.4

2 years agonew perldelta for 5.29.4
John SJ Anderson [Fri, 21 Sep 2018 03:29:50 +0000 (20:29 -0700)]
new perldelta for 5.29.4

2 years agoupdate release_schedule for 5.29.3
John SJ Anderson [Fri, 21 Sep 2018 03:20:54 +0000 (20:20 -0700)]
update release_schedule for 5.29.3

2 years ago5.29.3 epigraph
John SJ Anderson [Fri, 21 Sep 2018 03:20:13 +0000 (20:20 -0700)]
5.29.3 epigraph

2 years agoMerge branch 'release-5.29.3' into blead
John SJ Anderson [Fri, 21 Sep 2018 03:12:16 +0000 (20:12 -0700)]
Merge branch 'release-5.29.3' into blead

2 years ago(perl #132655) nul terminate result of unpack "u" of invalid data
Tony Cook [Mon, 20 Aug 2018 06:31:45 +0000 (16:31 +1000)]
(perl #132655) nul terminate result of unpack "u" of invalid data

In the given test case, Perl_atof2() would run off the end of the PV,
producing an error from ASAN.

2 years agoAdd new release to perlhist v5.29.3
John SJ Anderson [Fri, 21 Sep 2018 00:00:21 +0000 (17:00 -0700)]
Add new release to perlhist

2 years agoUpdate Module::Corelist for 5.29.3
John SJ Anderson [Thu, 20 Sep 2018 23:31:10 +0000 (16:31 -0700)]
Update Module::Corelist for 5.29.3

2 years agoUpdate perldelta for 5.29.3
John SJ Anderson [Thu, 20 Sep 2018 22:50:25 +0000 (15:50 -0700)]
Update perldelta for 5.29.3

2 years agohandy.h: Silence compiler warning
Karl Williamson [Wed, 19 Sep 2018 21:38:09 +0000 (15:38 -0600)]
handy.h: Silence compiler warning

This warning was introduced in db54010671d6c27faf667d658073743b14cd9b58.
and is about comparing signed and unsigned results.  This commit casts
both operands to ptrdiff_t which is likely the widest signed type
available on the platform.  This can fail if the one of the operands is
greater than PTRDIFF_MAX.  But lots of other things can fail in that
case as well.  As the reply from Tomasz Konojacki in the thread starting
with http://nntp.perl.org/group/perl.perl5.porters/251541 points out,
compilers are now assuming that no object is larger than PTRDIFF_MAX,
and if they can assume that, so can we.

2 years agoCreate Ptrdiff_t type
Karl Williamson [Wed, 19 Sep 2018 21:31:34 +0000 (15:31 -0600)]
Create Ptrdiff_t type

which evaluates to SSize_t in the unlikely event that there isn't a
ptrdiff_t on the platform.  ptrdiff_t is safer than ssize_t, as the
latter need not contain any negative number besides -1.

2 years agoDon't overallocate space for /[foo]/
Karl Williamson [Wed, 19 Sep 2018 16:02:24 +0000 (10:02 -0600)]
Don't overallocate space for /[foo]/

The ANYOF regnode type (generated by bracketed character classes and
\p{}) was allocating too much space because the argument field was being counted twice

2 years agoBump Devel::PPPort in Changes file
Sawyer X [Wed, 19 Sep 2018 14:42:57 +0000 (17:42 +0300)]
Bump Devel::PPPort in Changes file

2 years agobump Devel::PPPort version from 3.42 to 3.43.
Karen Etheridge [Sat, 15 Sep 2018 23:27:58 +0000 (16:27 -0700)]
bump Devel::PPPort version from 3.42 to 3.43.

Its tests were modified in commit 1ddd2f5f.

2 years agofix grammar in perldelta entry
Karen Etheridge [Sat, 15 Sep 2018 23:18:06 +0000 (16:18 -0700)]
fix grammar in perldelta entry

2 years agoUpgrade perlfaq from version 5.20180605 to 5.0180915.
Karen Etheridge [Sat, 15 Sep 2018 22:31:49 +0000 (15:31 -0700)]
Upgrade perlfaq from version 5.20180605 to 5.0180915.

(Existing blead customizations are no longer needed.)

2 years agomore places where -I. for -MTestInit is needed
Slaven Rezic [Thu, 13 Sep 2018 11:29:27 +0000 (13:29 +0200)]
more places where -I. for -MTestInit is needed

2 years agoUpdate Archive-Tar to CPAN version 2.32
Chris 'BinGOs' Williams [Thu, 13 Sep 2018 09:01:40 +0000 (10:01 +0100)]
Update Archive-Tar to CPAN version 2.32

  [DELTA]

2.32  13/09/2018 (CBERRY)
- Fix absolute path handling on VMS

2 years agoSync dists with CPAN versions
Chris 'BinGOs' Williams [Thu, 13 Sep 2018 09:00:04 +0000 (10:00 +0100)]
Sync dists with CPAN versions

Both these have been released to CPAN recently.

2 years ago(perl #133510) can't use my_vsnprintf() on quadmath/threaded builds
Tony Cook [Thu, 13 Sep 2018 01:45:14 +0000 (11:45 +1000)]
(perl #133510) can't use my_vsnprintf() on quadmath/threaded builds

Since anything with quadmath should be recent enough to have
vsnprintf() I've fallen back to that.

Calls to PerlIO_debug() in core don't include floating point values
and I expect it to be unlikely outside of core - if it is needed
they'll just have to use double formatting/types.

2 years agoMerge branch 'sawyer/data-dumper-changes' into blead
Sawyer X [Wed, 12 Sep 2018 16:22:07 +0000 (19:22 +0300)]
Merge branch 'sawyer/data-dumper-changes' into blead

2 years agoRevised by Aaron Crane
Sawyer X [Wed, 12 Sep 2018 16:21:58 +0000 (19:21 +0300)]
Revised by Aaron Crane

2 years agoBump version of Data::Dumper
Sawyer X [Wed, 12 Sep 2018 15:50:02 +0000 (18:50 +0300)]
Bump version of Data::Dumper

2 years agoUpdate Changes file for Data::Dumper
Sawyer X [Wed, 12 Sep 2018 15:49:17 +0000 (18:49 +0300)]
Update Changes file for Data::Dumper

2 years agoFix preprocessor directive indentation
Dagfinn Ilmari Mannsåker [Fri, 10 Aug 2018 10:03:30 +0000 (11:03 +0100)]
Fix preprocessor directive indentation

2 years ago(perl #133510) use quadmath versions of log10, ldexp and signbit
Tony Cook [Wed, 12 Sep 2018 01:09:52 +0000 (11:09 +1000)]
(perl #133510) use quadmath versions of log10, ldexp and signbit

With -Dquadmath C++ builds, the calls to log10() and ldexp() would
cause ambiguous overloaded function errors, since all of log10(float),
log10(double) and log10(long double) were canidates for a
log10(__float128) call.  Similarly for ldexp().

signbit() had a different problem, two of the tests in ext/POSIX/t/math.t
failed with the default signbit() macro, presumably because the
__float128 was being converted to a long double, since the macro in
math.h didn't special case for __float128.

2 years agoutf8.c: Don't assume UTF-8 sequence has enough space.
Karl Williamson [Tue, 31 Jul 2018 04:09:12 +0000 (22:09 -0600)]
utf8.c: Don't assume UTF-8 sequence has enough space.

Instead use the end pointer passed in.

2 years agoFile::Path: sync with CPAN version 2.16
James E Keenan [Sat, 8 Sep 2018 23:51:26 +0000 (19:51 -0400)]
File::Path: sync with CPAN version 2.16

2 years agoUpdate release schedule
Sawyer X [Sat, 8 Sep 2018 13:38:16 +0000 (16:38 +0300)]
Update release schedule

2 years agoInsert missing 'T' to list of PERL5OPT switches.
James E Keenan [Tue, 4 Sep 2018 13:37:40 +0000 (09:37 -0400)]
Insert missing 'T' to list of PERL5OPT switches.

And, in passing, group upper- and lower-case switches properly.

For: RT 133044.  Thanks to contributor KES.

2 years agoCorrect typo in comment.
James E Keenan [Mon, 3 Sep 2018 22:05:27 +0000 (18:05 -0400)]
Correct typo in comment.

2 years agoThere is no getpw() function in User::grent.
James E Keenan [Mon, 3 Sep 2018 17:58:27 +0000 (13:58 -0400)]
There is no getpw() function in User::grent.

Documentation should refer to getgr(), per report from Elizabeth
Mattijsen.

Increment $VERSION.

For: RT 133217

2 years agoRemove superfluous variable $gr_mem.
James E Keenan [Mon, 3 Sep 2018 17:54:10 +0000 (13:54 -0400)]
Remove superfluous variable $gr_mem.

Per recommendation by Elizabeth Mattijsen.

For: RT 133217

2 years agoCorrect typo reported by Elizabeth Mattijsen
James E Keenan [Mon, 3 Sep 2018 17:52:38 +0000 (13:52 -0400)]
Correct typo reported by Elizabeth Mattijsen

For: RT 133217

2 years agoPATCH: [perl #133488] Fix grammer in perlfunc sysread()
Karl Williamson [Sun, 2 Sep 2018 13:59:45 +0000 (07:59 -0600)]
PATCH: [perl #133488] Fix grammer in perlfunc sysread()

Spotted by Axel Beckert

2 years agoAdd gcc-8 and gcc-9 for FORTIFY_SOURCE
H.Merijn Brand [Sun, 2 Sep 2018 09:00:16 +0000 (11:00 +0200)]
Add gcc-8 and gcc-9 for FORTIFY_SOURCE

2 years ago[perl #133468] Silence compiler warning
Andy Dougherty [Thu, 30 Aug 2018 16:02:22 +0000 (12:02 -0400)]
[perl #133468] Silence compiler warning

Commit 1a69c9a77a no longer uses S_invlist_set_len in ext/re/re_comp.c,
but didn't adjust embed.fnc accordingly.  This patch moves that function
into the #ifndef PERL_EXT_RE_BUILD block in embed.fnc.  It also
includes regenerated embed.h and proto.h files.

2 years agoCan't sing a song that's never been sung
Chris 'BinGOs' Williams [Thu, 30 Aug 2018 07:56:51 +0000 (08:56 +0100)]
Can't sing a song that's never been sung

2 years agoperldelta for 2460a4968c37
Tony Cook [Thu, 30 Aug 2018 05:35:13 +0000 (15:35 +1000)]
perldelta for 2460a4968c37

2 years ago(perl #132683) don't try to convert PL_sv_placeholder into a CV
Tony Cook [Wed, 21 Feb 2018 05:24:08 +0000 (16:24 +1100)]
(perl #132683) don't try to convert PL_sv_placeholder into a CV

Constant folding sets PL_warnhook to PERL_WARNHOOK_FATAL, which is
&PL_sv_placeholder, an undef SV.

If warn() is called while constant folding, invoke_exception_hook()
attempts to use the value of a non-NULL PL_warnhook as a CV, which
caused an undefined value warning.

invoke_exception_hook() now treats a PL_warnhook of PERL_WARNHOOK_FATAL
the same as NULL, falling back to the normal warning handling which
throws an exception to abort constant folding.

2 years agomulticoncat: mutator not seen in (lex = ...) .= ...
David Mitchell [Wed, 29 Aug 2018 13:32:24 +0000 (14:32 +0100)]
multiconcat: mutator not seen in (lex = ...) .= ...

RT #133441

TL;DR:
(($lex = expr1.expr2) .= expr3) was being misinterpreted as
(expr1 . expr2 . expr3) when the ($lex = expr1) subtree had had the
assign op optimised away by the OPpTARGET_MY optimisation.

Full details.

S_maybe_multiconcat() looks for suitable chains of OP_CONCAT to convert
into a single OP_MULTICONCAT.

Part of the code needs to distinguish between (expr . expr) and
(expr .= expr). This didn't used to be easy, as both are just OP_CONCAT
ops, but with the OPf_STACKED set on the second one. But...

perl also used to optimise ($a . $b . $c) into ($a . $b) .= $c, to
reuse the padtmp returned by the $a.$b concat. This meant that an
OP_CONCAT could have the OPf_STACKED flag on even when it was a '.'
rather than a '.='.

I disambiguated these cases by seeing whether the top op in the LHS
expression had the OPf_MOD flag set too - if so, it implies '.='.

This fails in the specific case where the LHS expression is a
sub-expression which is assigned to a lexical variable, e.g.

    ($lex = $a+$b) .= $c.

Initially the top node in the LHS expression above is OP_SASSIGN, with
OPf_MOD set due to the enclosing '.='. Then the OPpTARGET_MY
optimisation kicks in, and the ($lex = $a + $b) part of the optree is
converted from

    sassign sKPRMS
        add[t4] sK
            padsv[a$] s
            padsv[$b] s
        padsv[$lex] s

to
        add[$lex] sK/TARGMY
            padsv[a$] s
            padsv[$b] s

which is all fine and dandy, except that the top node of that optree no
longer has the OPf_MOD flag set, which trips up S_maybe_multiconcat into
no longer spotting that the outer concat is a '.=' rather than a '.'.

Whether the OPpTARGET_MY optimising code should copy the OPf_MOD from
the being-removed sassign op to its successor is an issue I won't
address here. But in the meantime, the good news is that for 5.28.0
I added the OPpCONCAT_NESTED private flag, which is set whenever
($a . $b . $c) is optimised into ($a . $b) .= $c. This means that it's
no longer necessary to inspect the OPf_MOD flag of the first child to
disambiguate the two cases. So the fix is trivial.

2 years agoBumping PathTools from 3.74 to 3.75
Sawyer X [Mon, 27 Aug 2018 20:32:06 +0000 (23:32 +0300)]
Bumping PathTools from 3.74 to 3.75

2 years agofix mkpath call to be compatible with older File::Path
Graham Knop [Mon, 27 Aug 2018 09:12:05 +0000 (11:12 +0200)]
fix mkpath call to be compatible with older File::Path

mkpath can be called multiple ways, but most aren't supported by very
old versions of File::Path.  A prerequisite could be added on a newer
version of the module that that supports the new call signature, but
this introduces a circular dependency.  While theoretically this
dependency should be resolvable, since the File::Spec prereq listed in
File::Path is version 0, some toolchains (in particular older CPAN.pm)
will fail to do so.

There isn't any particular advantage to using the new call signature, so
a simple solution is to adjust the test to use the older style.

2 years ago(perl #133326) fix and clarify handling of recurs_sv.
Tony Cook [Tue, 7 Aug 2018 05:34:06 +0000 (15:34 +1000)]
(perl #133326) fix and clarify handling of recurs_sv.

There were a few problems:

- the purpose of recur_sv wasn't clear, I believe I understand it
  now from looking at where recur_sv was actually being used.
  Frankly the logic of the code itself was hard to follow, apparently
  only counting a level if the recur_sv was equal to the current
  SV.

  Fixed by adding some documentation to recur_sv in the context
  structure.  The logic has been re-worked (see below) to hopefully
  make it more understandable.

- the conditional checks for inc/decrementing recur_depth didn't
  match between the beginnings and ends of the store_array() and
  store_hash() handlers didn't match, since recur_sv was both
  explicitly modified by those functions and implicitly modified
  in their recursive calls to process elements.

  Fixing by storing the starting value of cxt->recur_sv locally
  testing against that instead of against the value that might be
  modified recursively.

- the checks in store_ref(), store_array(), store_l?hash() were
  over complex, obscuring their purpose.

  Fixed by:
   - always count a recursion level in store_ref() and store the
     RV in recur_sv
   - only count a recursion level in the array/hash handlers if
     the SV didn't match.
   - skip the check against cxt->entry, if we're in this code
     we could be recursing, so we want to detect it.

- (after the other changes) the recursion checks in store_hash()/
  store_lhash() only checked the limit if the SV didn't match the
  recur_sv, which horribly broke things.

  Fixed by:
   - Now only make the depth increment conditional, and always
     check against the limit if one is set.

2 years ago[MERGE] various regex capture fixups
David Mitchell [Sun, 26 Aug 2018 20:10:16 +0000 (21:10 +0100)]
[MERGE] various regex capture fixups

Improve the code and macros in S_regmatch() to make opening and closing
captures (groups) more consistent and simpler.

Shouldn't make any changes to behaviour apart from improved debugging
output.

2 years agoImprove docs for lastparen, lastcloseparen
David Mitchell [Sun, 19 Aug 2018 12:55:30 +0000 (13:55 +0100)]
Improve docs for lastparen, lastcloseparen

There's lots of confusion here, especially about lastparen - some of
the docs are just plain wrong.

2 years agoS_regmatch: add debugging to UNWIND_PAREN()
David Mitchell [Sat, 18 Aug 2018 12:21:31 +0000 (13:21 +0100)]
S_regmatch: add debugging to UNWIND_PAREN()

(and tweak the debugging output of CLOSE_CAPTURE())

2 years agoS_rematch(): CLOSE_CAPTURE(): set last(close)paren
David Mitchell [Sat, 18 Aug 2018 11:49:12 +0000 (12:49 +0100)]
S_rematch(): CLOSE_CAPTURE(): set last(close)paren

Every use of the CLOSE_CAPTURE() macro is followed by the setting of
lastparen and lastcloseparen, so include these actions in the macro
itself.

2 years agoS_regmatch(): use CLOSE_CAPTURE() macro more
David Mitchell [Sat, 18 Aug 2018 11:40:08 +0000 (12:40 +0100)]
S_regmatch(): use CLOSE_CAPTURE() macro more

This macro includes debugging output, so by using it rather than
setting rex->offs[paren].start/end directly, you get better debugging.

2 years agoS_regmatch(): parameterise CLOSE_CAPTURE macro
David Mitchell [Sat, 18 Aug 2018 11:28:31 +0000 (12:28 +0100)]
S_regmatch(): parameterise CLOSE_CAPTURE macro

Make its index and start+end values into parameters. This will shortly
allow its use in other places, bringing consistent code and debug logging
to the whole of S_regmatch().

2 years agoS_regmatch(): move CLOSE_CAPTURE macro definition
David Mitchell [Sat, 18 Aug 2018 11:19:16 +0000 (12:19 +0100)]
S_regmatch(): move CLOSE_CAPTURE macro definition

Move this macro to earlier in the file to be with the other functions
and macros which deal with setting and restoring captures.

No changes (functional or textual) apart from the physical moving of the
13 lines.

2 years agoS_regmatch(): handle GOSUB within (.)* specially
David Mitchell [Thu, 16 Aug 2018 19:07:43 +0000 (20:07 +0100)]
S_regmatch(): handle GOSUB within (.)* specially

The (?n) mechanism allows you to 'gosub' to a subpattern delineated by
capture n. For 1-char-width repeats, such as a+, \w*?, (\d)*, then
currently the code checks whether it's in a gosub each time it attempts
to start executing the B part of A*B, regardless of whether the A is
in a capture.

This commit moves the GOSUB check to within the capture-only variant
(CURLYN), which then directly just looks for one instance of A and
returns. This moves the check away from more frequently called code
paths.

2 years agoadd more /(?1)/ tests
David Mitchell [Thu, 16 Aug 2018 18:24:23 +0000 (19:24 +0100)]
add more /(?1)/ tests

specifically, the code path wasn't being exercised where the gosub
goes to a capture which is a 1-char wide *non-greedy* repeat, such as

    / ... (\d)*? ... (?1) ... /

2 years agoS_regmatch(): combine CURLY_B_min/_known states
David Mitchell [Wed, 15 Aug 2018 17:02:53 +0000 (18:02 +0100)]
S_regmatch(): combine CURLY_B_min/_known states

There are currently two similar backtracking states for simple
non-greedy pattern repeats:

    CURLY_B_min
    CURLY_B_min_known

the latter is a variant of the former for when the character which must
follow the repeat is known, e.g.  /(...)*?X.../, which allows quick
skipping to the next viable position.

The code for the two cases:

    case CURLY_B_min_fail:
    case CURLY_B_min_known_fail:

share a lot of similarities. This commit merges the two states into a
single CURLY_B_min state, with an associated single CURLY_B_min_fail
fail state.

That one code block can handle both types, with a single

    if (ST.c1 == CHRTEST_VOID) ...

test to choose between the two variant parts of the code.

This makes the code smaller and more maintainable, at the cost of one
extra test per backtrack.