This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
4 years agoperldelta for 4829a1eae86e
Tony Cook [Tue, 22 Jan 2019 03:58:59 +0000 (14:58 +1100)]
perldelta for 4829a1eae86e

4 years ago(perl #133751) qr// is already blessed
Tony Cook [Tue, 15 Jan 2019 22:42:16 +0000 (09:42 +1100)]
(perl #133751) qr// is already blessed

4 years agoperldelta for 5d4636a3aa0b
Tony Cook [Tue, 22 Jan 2019 03:26:47 +0000 (14:26 +1100)]
perldelta for 5d4636a3aa0b

4 years ago(perl #130367) separate error for push etc on hash/glob
Tony Cook [Sun, 18 Dec 2016 23:49:27 +0000 (10:49 +1100)]
(perl #130367) separate error for push etc on hash/glob

4 years agoTest file in Encode is no longer customised
Chris 'BinGOs' Williams [Mon, 21 Jan 2019 14:42:56 +0000 (14:42 +0000)]
Test file in Encode is no longer customised

4 years agoEncode: synch with CPAN version 2.99
Dan Kogai [Mon, 21 Jan 2019 14:25:18 +0000 (09:25 -0500)]
Encode: synch with CPAN version 2.99

4 years ago(perl #131562) correct large line numbers copying eval lines on #line
Tony Cook [Wed, 23 Aug 2017 04:18:26 +0000 (14:18 +1000)]
(perl #131562) correct large line numbers copying eval lines on #line

Previously this used I32 for line numbers, which takes half the range
of line_t and folds it into negative numbers, leading to trying to store
the lines at negative indexes.

The while loop was also modified to stop storing if/when the line number
no longer fits into cop_line, or no longer fits into SSize_t (as a
positive number) since the index parameter to av_store() is a SSize_t.

4 years agoProvide defined value for $TODO only where test should not run.
James E Keenan [Sun, 20 Jan 2019 20:48:19 +0000 (15:48 -0500)]
Provide defined value for $TODO only where test should not run.

Some tests should not be run on older perls.  To indicate that, provide
an undef rather than a defined but false value.

This reflects Test::Builder synch with CPAN for upstream bug fix:
https://github.com/Test-More/test-more/commit/9c269ff6e2b8a7be223ef1df7a254a09ec4dad2d

Note that these should really be SKIPs rather than TODOs (but we can handle that later).

4 years agoProvide defined value for $TODO only where test is still failing.
James E Keenan [Sun, 20 Jan 2019 20:23:13 +0000 (15:23 -0500)]
Provide defined value for $TODO only where test is still failing.

Reflecting Test::Builder synch with CPAN for upstream bug fix:
https://github.com/Test-More/test-more/commit/9c269ff6e2b8a7be223ef1df7a254a09ec4dad2d

Provide description for previously TODO-ed test.

4 years agoHere be unicorns
Chris 'BinGOs' Williams [Sun, 20 Jan 2019 10:27:10 +0000 (10:27 +0000)]
Here be unicorns

4 years agofix version in delta
Karen Etheridge [Sun, 20 Jan 2019 03:58:31 +0000 (19:58 -0800)]
fix version in delta

It was also misstated in the commit message for 928a385c.

4 years agoUpdate Module::CoreList for 5.29.8
Abigail [Sun, 20 Jan 2019 03:25:23 +0000 (04:25 +0100)]
Update Module::CoreList for 5.29.8

4 years agoBump the perl version in various places for 5.29.8
Abigail [Sun, 20 Jan 2019 03:12:20 +0000 (04:12 +0100)]
Bump the perl version in various places for 5.29.8

4 years agoNew perldelta for 5.29.8
Abigail [Sun, 20 Jan 2019 02:57:56 +0000 (03:57 +0100)]
New perldelta for 5.29.8

4 years agoTick!
Abigail [Sun, 20 Jan 2019 02:46:30 +0000 (03:46 +0100)]
Tick!

Ticked of the 5.29.7 release from the release schedule.

4 years agoEpigraph for 5.29.7
Abigail [Sun, 20 Jan 2019 02:44:48 +0000 (03:44 +0100)]
Epigraph for 5.29.7

4 years agoPorting/makerel: fix progress message.
Abigail [Sun, 20 Jan 2019 01:27:21 +0000 (02:27 +0100)]
Porting/makerel: fix progress message.

The message emitted just before creating the .xz file was identical
to the message emitted just before creating the .gz file. Which
didn't make much sense.

4 years agoAnd 5.29.7 release to pod/perlhist v5.29.7
Abigail [Sun, 20 Jan 2019 00:43:01 +0000 (01:43 +0100)]
And 5.29.7 release to pod/perlhist

4 years agoBump copyright to 2019 in perl.c and README.
Abigail [Sun, 20 Jan 2019 00:40:50 +0000 (01:40 +0100)]
Bump copyright to 2019 in perl.c and README.

4 years agoNew/Update Modules section for perldelta
Abigail [Sat, 19 Jan 2019 23:59:42 +0000 (00:59 +0100)]
New/Update Modules section for perldelta

4 years agoPerldelta acknowledgements for 5.29.7.
Abigail [Sat, 19 Jan 2019 23:45:10 +0000 (00:45 +0100)]
Perldelta acknowledgements for 5.29.7.

4 years agoUpdate Module::CoreList for 5.29.7
Abigail [Sat, 19 Jan 2019 23:34:53 +0000 (00:34 +0100)]
Update Module::CoreList for 5.29.7

4 years agoPerldelta: Link to each ticket.
Abigail [Sat, 19 Jan 2019 22:09:59 +0000 (23:09 +0100)]
Perldelta: Link to each ticket.

This was an automated process, turning any '[perl #NNNN]' into a
linke to the corresponding ticket on rt.perl.org.

4 years agoPerldelta: spell out '2nd'.
Abigail [Sat, 19 Jan 2019 22:04:19 +0000 (23:04 +0100)]
Perldelta: spell out '2nd'.

4 years agoPerldelta: Document changes leading up to 5.29.7.
Abigail [Sat, 19 Jan 2019 19:21:32 +0000 (20:21 +0100)]
Perldelta: Document changes leading up to 5.29.7.

4 years agoUpdate Test-Simple to CPAN version 1.302160
Chris 'BinGOs' Williams [Sat, 19 Jan 2019 10:42:35 +0000 (10:42 +0000)]
Update Test-Simple to CPAN version 1.302160

  [DELTA]

1.302160  2019-01-18 11:44:33-08:00 America/Los_Angeles

    - No Changes since last trial release

1.302159  2019-01-09 13:21:37-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Add table support to ctx->fail and ctx->fail_and_return
    - Fix Instance.t on haiku-os

1.302158  2019-01-08 15:36:24-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix TAP test on windows
    - Fix math errors in table indentation
    - Devel requires Term::Table

1.302157  2019-01-08 14:10:29-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix minor typos and missing doc sections
    - Add table support in info facet and TAP formatter

1.302156  2019-01-07 11:13:07-08:00 America/Los_Angeles

    - No changes from last trial

1.302155  2019-01-04 11:25:17-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix test not to fail in non-english locales

1.302154  2019-01-04 10:20:54-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix SHM pid checking for some platforms in Instance.t
    - Add SHM errno/msg to warning about SHM going away

1.302153  2019-01-03 08:39:42-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Improve SHM verification and state awareness

1.302152  2018-12-26 12:21:32-08:00 America/Los_Angeles (TRIAL RELEASE)

    - More Instance.t improvements
    - Add trace to SHM error when possible

1.302151  2018-12-20 11:05:47-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix another locale error in Instance.t

1.302150  2018-12-20 10:57:09-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix locale error in Instance.t
    - Windows test fixes
    - perl 5.6 test fixes

1.302149  2018-12-20 09:47:31-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Even more SHM error improvements

1.302148  2018-12-17 13:08:23-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Further Improve SHM error message

1.302147  2018-12-17 12:59:14-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Improve SHM error message

1.302146  2018-12-17 09:06:44-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix SHM test to work on machines without SHM

1.302145  2018-12-12 11:26:32-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix localization error in new test (#820)

1.302144  2018-12-12 09:51:25-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Add tests for shmwrite fix (#815)

1.302143  2018-12-11 19:10:37-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix failure to check error code on shmwrite (#815)

1.302142  2018-12-11 11:55:22-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix #814 Windows fork+test failure
    - Fix #819 Documentation updates
    - Fix #810 Verbose TAP newline regression
    - Fix #817 local $TODO bug
    - Fix #812 Another local $TODO bug
    - Fix #815 shm read warning
    - Merge doc fix PR's from magnolia-k (thanks!)

4 years agomy_atof3() Fix uncommon bug where it wrongly fails
Karl Williamson [Fri, 18 Jan 2019 18:30:00 +0000 (11:30 -0700)]
my_atof3() Fix uncommon bug where it wrongly fails

This bug showed up only on -Dusemymalloc without Debugging, and without
various other common Configure options.

It causes my_atof3() to return failure where in fact success was
achieved.  It apparently got triggered due to slight differences in
malloc behaviors.

The bug is that it changed a string pointer to new memory and forgot to
change it back to the original value when that memory got freed.  The
test that fails is an equal/not equal of two pointers, and usually two
pointers aren't the same, meaning the bug doesn't appear.

The only case where my_atof3() is called is in parsing certain
\p{nv=...} where "..." is not a rational number.  So the scope of this
bug is limited.

Spotted by Ryan Voots.

4 years agoUpdate Math-BigInt-FastCalc to CPAN version 0.5008
Chris 'BinGOs' Williams [Fri, 18 Jan 2019 19:29:35 +0000 (19:29 +0000)]
Update Math-BigInt-FastCalc to CPAN version 0.5008

  [DELTA]

0.5008 2018-10-09

 * Update MANIFEST.SKIP.

 * Sync test files with Math-BigInt.

 * Better Makefile.PL.

4 years agoUpdate Math-BigInt to CPAN version 1.999816
Chris 'BinGOs' Williams [Fri, 18 Jan 2019 19:28:07 +0000 (19:28 +0000)]
Update Math-BigInt to CPAN version 1.999816

  [DELTA]

1.999816 2018-10-26

 * bnok() for Math::BigInt and Math::BigFloat now support the full Kronenburg
   extension. The behaviour is identical to the behaviour of the Maple and
   Mathematica function for negative integers n, k. Add tests. This closes CPAN
   RT #95628.

 * Fix POD errors. This closes CPAN RT #125141.

1.999815 2018-10-19

 * Move bitwise operators signed and, signed or, and signed xor from
   lib/Math/BigInt/CalcEmu.pm into lib/Math/BigInt/Lib.pm. The file
   lib/Math/BigInt/CalcEmu.pm is no longer needed and thus removed.

1.999814 2018-10-01

 * Add to_base() and from_base() to Math::BigInt and corresponding library
   methods _to_base() and _from_base() to Math::BigInt::Lib. This was inspired
   by CPAN RT #122681.

 * Fix Makefile.PL to reflect that Test::More is only needed for testing, not
   for building.

 * In the documentation for each of the to_(bin|hex|oct|bytes) methods, add a
   reference to the corresponding from_(bin|hex|oct|bytes) method.

4 years agoUpdate Unicode-Collate to CPAN version 1.27
Chris 'BinGOs' Williams [Thu, 17 Jan 2019 18:39:59 +0000 (18:39 +0000)]
Update Unicode-Collate to CPAN version 1.27

  [DELTA]

1.27  Wed Jan  2 19:42:56 2019
    - DUCET is updated (for Unicode 10.0.0) as Collate/allkeys.txt.
    - The default UCA_Version is 36.
    - Locale/*.pl and CJK/Korean.pm are updated.

1.26  Mon Dec 31 14:32:07 2018
    - U::C::Locale newly supports locale: cu.
    - tailoring Cyrillic YI as BYELORUSSIAN-UKRAINIAN I with DIAERESIS.
      (affected locale: kk)
    - added loc_cu.t in t.

4 years agoUpdate File-Temp to CPAN version 0.2309
Chris 'BinGOs' Williams [Thu, 17 Jan 2019 18:38:27 +0000 (18:38 +0000)]
Update File-Temp to CPAN version 0.2309

  [DELTA]

0.2309    2019-01-06 20:29:15Z
          - fix longstanding pod formatting error (issue #19, RT#109526)

4 years agoUpdate IO-Compress to CPAN version 2.084
Chris 'BinGOs' Williams [Thu, 17 Jan 2019 18:08:33 +0000 (18:08 +0000)]
Update IO-Compress to CPAN version 2.084

  [DELTA]

  2.084 5 January 2019

      * IO::Uncompress::AnyUncompress.pm
        Added support for IO::Uncompress::Zstd and IO::Uncompress::UnLzip

  2.083 30 December 2018

      * IO::Compress::*
      * IO::Uncompress::*
        The BinModeIn and BinModeOut options in are now no-ops.
        ALL files will be read/written in binmode.

      * IO::Uncompress::Unzip
        Fixed issue with unziping a member from a streamed zip file.
        Issue triggered by a libreoffice document.
        Test added to 105oneshot-zip-only.t
        Thanks to Fabrizio Pivari for the bug report.

      * Added U64::isZero

      * bin/zipdetails
        Added 'Data Stream Alignment' (tag 0xa11e) to extra fields.
        Field sourced from https://support.pkware.com/display/PKZIP/Proposed+ZIP+Format+Specification+Additions

      * Compress::Zlib.pm
        #125140: Tiny POD error in Compress::Zlib

4 years agoUpdate Compress-Raw-Bzip2 to CPAN version 2.084
Chris 'BinGOs' Williams [Thu, 17 Jan 2019 18:06:41 +0000 (18:06 +0000)]
Update Compress-Raw-Bzip2 to CPAN version 2.084

  [DELTA]

  2.084 5 January 2019

      * No Changes

  2.083 30 December 2018

      * No Changes

4 years agoUpdate Compress-Raw-Zlib to CPAN version 2.084
Chris 'BinGOs' Williams [Thu, 17 Jan 2019 18:05:01 +0000 (18:05 +0000)]
Update Compress-Raw-Zlib to CPAN version 2.084

  [DELTA]

  2.084 5 January 2019

      * No Changes

  2.083 30 December 2018

      * No Changes

4 years ago(perl #133755) link back to readpipe from the qx// docs
Tony Cook [Mon, 14 Jan 2019 23:59:36 +0000 (10:59 +1100)]
(perl #133755) link back to readpipe from the qx// docs

4 years agobump version numbers for PathTools
Tony Cook [Mon, 14 Jan 2019 01:06:57 +0000 (12:06 +1100)]
bump version numbers for PathTools

4 years ago(perl #123724) don't translate ... to ..\.. on Win32
Tony Cook [Thu, 1 Nov 2018 02:43:17 +0000 (13:43 +1100)]
(perl #123724) don't translate ... to ..\.. on Win32

Apparently this was a command.com thing that Win32 doesn't support.

4 years agoPATCH: [perl #133756] Failure to match properly
Karl Williamson [Fri, 11 Jan 2019 03:59:31 +0000 (20:59 -0700)]
PATCH: [perl #133756] Failure to match properly

This was caused by a counting error.

An EXACTFish regnode has a finite length it can hold for the string
being matched.  If that length is exceeded, a 2nd node is used for the
next segment of the string, for as many regnodes as are needed.

A problem occurs if a regnode ends with one of the 22 characters in
Unicode 11 that occur in non-final positions of a multi-character fold.
The design of the pattern matching engine doesn't allow matches across
regnodes.  Consider, for example if a node ended in the letter 'f' and
the next node begins with the letter 'i'.  That sequence should match,
under /i, the ligature "fi" (U+FB01).  But it wouldn't because the
pattern splits them across nodes.  The solution I adopted was to forbid
a node to end with one of those 22 characters if there is another string
node that follows it.  This is not fool proof, for example, if the
entire node consisted of only these characters, one would have to split
it at some position (In that case, we just take as much of the string as
will fit.) But for real life applications, it is good enough.

What happens if a node ends with one of the 22, is that the node is
shortened so that those are instead placed at the beginning of the
following node.  When the code encounters this situation, it backs off
until it finds a character that isn't a non-final fold one, and closes
the node with that one.

A /i node is filled with the fold of the input, for several reasons.
The most obvious is that it saves time, you can skip folding the pattern
at runtime.  But there are reasons based on the design of the optimzer
as well, which I won't go into here, but are documented in regcomp.c.
When we back out the final characters in a node, we also have to back
out the corresponding unfolded characters in the input, so that those
can be (folded) into the following node.  Since the number of characters
in the fold may not be the same as unfolded, there is not an easily
discernable correspondence between the input and the folded output.
That means that generally, what has to be done is that the input is
reparsed from the beginning of the node, but the permitted length has
been shortened (we know precisely how much to shorten it to) so that it
will end with something other than the 22.  But, the code saves the
previous input character's position (for other reasons), so if we only
have to backup one character, we can just use that and not have to
reparse.

This bug was that the code thought a two character backup was really a
one character one, and did not reparse the node, creating an off-by-one
error, and a character was simply omitted in the pattern (that should
have started the following node).  And the input had two of the 22
characters adjacent to each other in just the right positions that the
node was split.  The bisect showed that when the node size was changed
the bug went away, at least for this particular input string.  But a
different, longer, string would have triggered the bug, and this commit
fixes that.

This bug is actually very unlikely to occur in most real world
applications.  That is because other changes in the regex compiler have
caused nodes to be split so that things that don't particpate in folds
at all are separated out into EXACT nodes.  (The reason for that is it
allows the optimizer things to grab on to under /i that it wouldn't
otherwise have known about.)  That means that anything like this string
would never cause the bug to happen because blanks and commas, etc.
would be in separate nodes, and so no node would ever get large enough
to fill the 238 available byte slots in a node (235 on EBCDIC).  Only a
long string without punctuation would trigger it.  I have artificially
constructed such a string in the tests added by this commit.

One of the 22 characters is 't', so long strings of DNA "ACTG" could
trigger this bug.  I find it somewhat amusing that this is something
like a DNA transcription error, which occurs in nature at very low
rates, but selection, it is believed, will make sure the error rate is
above zero.

4 years agoregcomp.c: Fix wrong comment
Karl Williamson [Fri, 11 Jan 2019 03:58:00 +0000 (20:58 -0700)]
regcomp.c: Fix wrong comment

4 years agoDelay fatalization of deprecation of unsafe UTF-8 macros from XS
Karl Williamson [Wed, 9 Jan 2019 04:04:36 +0000 (21:04 -0700)]
Delay fatalization of deprecation of unsafe UTF-8 macros from XS

Trying to earlier make this fatal led to some issues in primarily Tk,
which I haven't had a chance to address, and it's getting to late in the
development cycle to do it now.

4 years agoShorten test descriptions
James E Keenan [Tue, 1 Jan 2019 15:27:13 +0000 (10:27 -0500)]
Shorten test descriptions

Per recommendation by Tony Cook in RT 133740.

4 years agoConduct tests of IO::Dir in temporary directory
James E Keenan [Sat, 29 Dec 2018 04:05:19 +0000 (23:05 -0500)]
Conduct tests of IO::Dir in temporary directory

For RT # 133740:  After the release of perl-5.29.5, smoke tests
intermittently began to report failures in dist/IO/t/io_dir.t.

In preceding  months, similar intermittent failures had been reported
for files testing File::Find (RT 133658) and GDBM_File (RT 133664).  In
those cases the problem was diagnosed as race conditions under parallel
testing where test files and directories were being created in or
underneath the current working directory without resort to tempdirs or
tempfiles.

The testing in dist/IO/t/io_dir.t presumes the existence of a stable set
of files and subdirectories in dist/IO/.  If additional files or
subdirectories are created while this file is being run, that
presumption is no longer met.

The dist/IO/t/ directory was therefore inspected for test files which,
for testing purposes, would create files or directories underneath the
dist/IO/.  The following test files do so:

    io_file.t
    io_linenum.t
    io_taint.t
    io_tell.t
    io_unix.t
    io_utf8argv.t
    io_utf8.t
    io_xs.t

Of the above, only io_xs.t takes the precaution of using
IO::File->new_tmpfile().

Using File::Temp::tempdir in this file should mitigate the problem.

In addition, all tests in io_dir.t now have descriptions.

4 years ago(perl #133575) prevent set/longjmp clobbering locals in S_fold_constants
Tony Cook [Wed, 2 Jan 2019 23:48:05 +0000 (10:48 +1100)]
(perl #133575) prevent set/longjmp clobbering locals in S_fold_constants

My original approach moved the whole switch into the new function,
but that was a lot messier, and I don't think it's necessary.

pad_swipe() can throw, but only for panics, and in DESTROY if
refadjust is true, which isn't the case here.

CLEAR_ERRSV() might throw if the code called by CALLRUNOPS()
puts an object that dies in DESTROY in $@, but I think that
might cause an infinite loop in the original code.

4 years agoRemove one superfluous word in sysseek documentation.
James E Keenan [Sun, 6 Jan 2019 01:16:30 +0000 (20:16 -0500)]
Remove one superfluous word in sysseek documentation.

4 years agoregen/warnings.pl: Fix undefined C behavior
Karl Williamson [Mon, 31 Dec 2018 04:29:07 +0000 (21:29 -0700)]
regen/warnings.pl: Fix undefined C behavior

This fixes compiler warnings "performing pointer arithmetic on a null
pointer has undefined behavior"

There are several ways to fix this.  This one was suggested by
Tomasz Konojacki++.  Instead of trying to point to address 1 and 2, two
variables are created, and we point to them.  const is cast away.

4 years agoUse same mixture of hard-tabs and spaces for indent
James E Keenan [Sat, 5 Jan 2019 14:38:07 +0000 (09:38 -0500)]
Use same mixture of hard-tabs and spaces for indent

... as in other ifdefs within S_Internals_V(pTHX_ CV *cv).

4 years agoperlapi: Fix improper formal param name
Karl Williamson [Fri, 4 Jan 2019 20:35:01 +0000 (13:35 -0700)]
perlapi: Fix improper formal param name

4 years agoregen/mk_invlists.pl: Rmv extraneous tab in output
Karl Williamson [Fri, 4 Jan 2019 20:34:08 +0000 (13:34 -0700)]
regen/mk_invlists.pl: Rmv extraneous tab in output

4 years agoperldelta for 817480137a8b
Tony Cook [Thu, 3 Jan 2019 04:40:22 +0000 (15:40 +1100)]
perldelta for 817480137a8b

4 years agosimplify the error reporting from the #125351 fix
Tony Cook [Tue, 28 Aug 2018 05:02:32 +0000 (15:02 +1000)]
simplify the error reporting from the #125351 fix

4 years ago(perl #132158) abort compilation if we see an error compiling a form
Tony Cook [Tue, 28 Aug 2018 04:11:10 +0000 (14:11 +1000)]
(perl #132158) abort compilation if we see an error compiling a form

4 years agobump $lib::VERSION
Tony Cook [Thu, 3 Jan 2019 03:42:18 +0000 (14:42 +1100)]
bump $lib::VERSION

4 years agoHint about $dir/$version is checked by lib.pm and deleted from @INC
Eugen Konkov [Tue, 18 Sep 2018 07:19:46 +0000 (10:19 +0300)]
Hint about $dir/$version is checked by lib.pm and deleted from @INC

FIXES RT#133522

There is not clear from documentation that $dir/$version and
$dir/$version/$archname are checked and deleted from @INC when 'no lib $dir'
is used

4 years agoperldelta for b4e880f3b5c8, eb699a9c8fb7
Tony Cook [Wed, 2 Jan 2019 01:15:12 +0000 (12:15 +1100)]
perldelta for b4e880f3b5c8eb699a9c8fb7

4 years agoFirst "eof" should return true
Hauke D [Wed, 12 Dec 2018 21:26:26 +0000 (22:26 +0100)]
First "eof" should return true

When no file has previously been opened, "eof" should return true. This
behavior was broken by 32e653230c7ccc (see also [#60978]).

4 years ago[perl #133721] TODO test for eof with no ${^LAST_FH}
Tony Cook [Wed, 2 Jan 2019 00:49:47 +0000 (11:49 +1100)]
[perl #133721] TODO test for eof with no ${^LAST_FH}

4 years agoperldelta for 7122d783e33c
Tony Cook [Wed, 2 Jan 2019 00:28:23 +0000 (11:28 +1100)]
perldelta for 7122d783e33c

4 years ago[perl #133524] report line number for Prototype not terminated
Tony Cook [Wed, 2 Jan 2019 00:20:34 +0000 (11:20 +1100)]
[perl #133524] report line number for Prototype not terminated

Previously COPLINE was updated (to the end of the file) before
reporting the error, which wasn't useful.

4 years agoregcomp.c: Rmv null function calls
Karl Williamson [Tue, 1 Jan 2019 22:36:20 +0000 (15:36 -0700)]
regcomp.c: Rmv null function calls

These were relics from the removal of the sizing pass.  I did a global
substitute, and missed that these cases promptly took the inverse
function of the function I just added.  In other words, if g() is the
inverse of f(), then g(f(x)) is always x, and we can omit both g() and
f().

4 years agoRevert "regen/mk_invlists.pl: Fix bug when 2 ident tables"
Karl Williamson [Tue, 1 Jan 2019 03:19:30 +0000 (20:19 -0700)]
Revert "regen/mk_invlists.pl: Fix bug when 2 ident tables"

This reverts commit 7e9b4fe4d85e9b669993bf96a7e33ffff3197e20, with
additional changes to get things to compile

It turns out I was wrong about the underlying cause that commit
addressed, and it is easier to just use the existing constants that get
generated.

4 years agoperl.h: Fix typo in comment
Karl Williamson [Tue, 1 Jan 2019 02:42:32 +0000 (19:42 -0700)]
perl.h: Fix typo in comment

4 years agoperlvars.h: A variable was being initialized unnecessarily
Karl Williamson [Mon, 31 Dec 2018 04:13:35 +0000 (21:13 -0700)]
perlvars.h: A variable was being initialized unnecessarily

4 years agoperlre: Note /i multi-char fold lookbehind assertions don't work
Karl Williamson [Sun, 30 Dec 2018 17:57:59 +0000 (10:57 -0700)]
perlre: Note /i multi-char fold lookbehind assertions don't work

4 years agoregcomp.sym: Note specialized use of 'flags' in 2 OPs
Karl Williamson [Sun, 30 Dec 2018 17:18:43 +0000 (10:18 -0700)]
regcomp.sym: Note specialized use of 'flags' in 2 OPs

4 years agoperlre: Note that lookbehind is up to 255 chars
Karl Williamson [Sun, 30 Dec 2018 17:01:38 +0000 (10:01 -0700)]
perlre: Note that lookbehind is up to 255 chars

4 years agoCorrect spelling error.
James E Keenan [Sat, 29 Dec 2018 23:34:10 +0000 (18:34 -0500)]
Correct spelling error.

4 years agoregcomp.c: Refactor \b{} parsing code
Karl Williamson [Thu, 27 Dec 2018 20:12:29 +0000 (13:12 -0700)]
regcomp.c: Refactor \b{} parsing code

This just moves things around so that the information is kept in local
variables and the regnode not created until all that info has been
completely determined.  I believe it is clearer to read, but the impetus
came from the fact that prior to this commit, use of \b{} always
restarted the parse unnecessarily because the order of things made it
appear that a real /d op had appeared, whereas it was just the one
currently being constructed

4 years agoregcomp.c: White-space only
Karl Williamson [Fri, 28 Dec 2018 02:35:01 +0000 (19:35 -0700)]
regcomp.c: White-space only

Indent the block added by the previous commit

4 years agoregcomp.c: Avoid reading out-of-bounds memory
Karl Williamson [Fri, 28 Dec 2018 02:31:18 +0000 (19:31 -0700)]
regcomp.c: Avoid reading out-of-bounds memory

Recent commit c316b824875fdd5ce52338f301fb0255d843dfec introduced an
out-of-bounds memory read.  This commit fixes it.  An ANYOFH regnode
doesn't have a bitmap, so don't try to read it.

4 years agoregen/mk_invlists.pl: Rmv outdated code
Karl Williamson [Sun, 23 Dec 2018 01:36:27 +0000 (18:36 -0700)]
regen/mk_invlists.pl: Rmv outdated code

Before the GCB property handling got more complicated, it was possible
to represent its vagaries with a boolean table on early Unicode
releases.  Now there are more complicated rules, and even though early
releases only use 0 or 1, the rules exist and lead to compilation
errors.  Just remove the special handling, and let the table be U8.

4 years agoregen/mph.pl: Remove unused variable
Karl Williamson [Sun, 23 Dec 2018 00:22:42 +0000 (17:22 -0700)]
regen/mph.pl: Remove unused variable

4 years agoChange length-1 ASCII fold pairs to ANYOFM regnodes
Karl Williamson [Sat, 8 Dec 2018 22:39:24 +0000 (15:39 -0700)]
Change length-1 ASCII fold pairs to ANYOFM regnodes

A node that matches only 'A' and 'a', for example, can be turned into an
ANYOFM node, which is faster to execute.  This is done after joining of
adjacent EXACTFish nodes, as longer nodes are better than shorter ones,
including because they lessen the number of bugs with multi-char folds
not matching because of node boundaries.

But if a length 1 node remains, ANYOFM is better.

4 years agoregcomp.c: White-space only
Karl Williamson [Sat, 8 Dec 2018 14:08:25 +0000 (07:08 -0700)]
regcomp.c: White-space only

Indent newly formed block in previous commit

4 years agoAdd new regnode: ANYOFH, without a bitmap
Karl Williamson [Fri, 7 Dec 2018 00:18:25 +0000 (17:18 -0700)]
Add new regnode: ANYOFH, without a bitmap

This commit adds a regnode for the case where nothing in the bit map has
matches.  This allows the bitmap to be omitted, saving 32 bytes of
otherwise wasted space per node.  Many non-Latin Unicode properties have
this characteristic.  Further, since this node applies only to code
points above 255, which are representable only in UTF-8, we can
trivially fail a match where the target string isn't in UTF-8.  Time
savings also accrue from skipping the bitmap look-up.  When swashes are
removed, even more time will be saved.

4 years agoRevamp qr/[...]/ optimizations
Karl Williamson [Wed, 26 Dec 2018 05:56:48 +0000 (22:56 -0700)]
Revamp qr/[...]/ optimizations

This commit extensively changes the optimizations for ANYOF regnodes
that represent bracketed character classes.

The removal of the regex compilation pass now makes these feasible and
desirable.  Compilation now tries hard to optimize an ANYOF node into
something smaller and/or faster when feasible.

Now, qr/[X]/ for any single character or POSIX class X, and any
modifiers like /d, /i, etc, should be the same as qr/X/ for the same
modifiers, unless it would require the pattern to be upgraded from
non-UTF-8 to UTF-8, unless not doing so could introduce bugs.

These changes fix some issues with multi-character /i folding.

4 years agoregcomp.c: Rename a variable
Karl Williamson [Wed, 26 Dec 2018 05:53:37 +0000 (22:53 -0700)]
regcomp.c: Rename a variable

This is to distinguish it from another similar variable being introduced
in the next commit.

4 years agoregcomp.c: White-space, comments only
Karl Williamson [Wed, 28 Nov 2018 15:40:29 +0000 (08:40 -0700)]
regcomp.c: White-space, comments only

4 years agoregcomp.c: Refactor 3 variables into flags of 1
Karl Williamson [Wed, 28 Nov 2018 15:13:31 +0000 (08:13 -0700)]
regcomp.c: Refactor 3 variables into flags of 1

This makes the code easier to read, as it summarizes the purposes of the
three, and makes it easy to find which reason it is.

4 years agoregcomp.c: White space only
Karl Williamson [Tue, 27 Nov 2018 19:15:56 +0000 (12:15 -0700)]
regcomp.c: White space only

Indent after the previous commit created a new outer loop

4 years agoregcomp.c: Refactor looking for POSIX optimizations
Karl Williamson [Tue, 27 Nov 2018 18:59:03 +0000 (11:59 -0700)]
regcomp.c: Refactor looking for POSIX optimizations

Instead of repeating the code, slightly modified, this uses a loop.
This is in preparation for a future commit where a third instance would
have been required

4 years agoregcomp.c: Rename a variable
Karl Williamson [Tue, 27 Nov 2018 18:20:56 +0000 (11:20 -0700)]
regcomp.c: Rename a variable

The new name more accurately expresses the usage, as what gets generated
may not actually be an ANYOFD.

4 years agoregcomp.c: Remove no longer used static function
Karl Williamson [Sun, 2 Dec 2018 20:53:20 +0000 (13:53 -0700)]
regcomp.c: Remove no longer used static function

4 years agoregcomp.c: Remove remaining use of static function
Karl Williamson [Wed, 26 Dec 2018 19:28:45 +0000 (12:28 -0700)]
regcomp.c: Remove remaining use of static function

Commit 13dfc48da5322166f9d64a7349e3434c070ead88 removed one of two uses
of this function.  This removes the remaining one.  Commits in between
removed the need for most of the guts of the function.

4 years agoregcomp.c: Consolidate common code
Karl Williamson [Tue, 27 Nov 2018 18:12:15 +0000 (11:12 -0700)]
regcomp.c: Consolidate common code

These flags can be set in one place, rather than in multiple ones.

4 years agoregcomp.c: Simplify ANYOFM node generation
Karl Williamson [Tue, 27 Nov 2018 18:05:34 +0000 (11:05 -0700)]
regcomp.c: Simplify ANYOFM node generation

This refactors the code somewhat.  When we discover a deal-breaker code
point we can just break out of the loop (using a goto) instead of
setting a flag, continuing, and later testing it.

4 years agoregcomp.c: Don't zap larger scope variables
Karl Williamson [Tue, 27 Nov 2018 17:51:46 +0000 (10:51 -0700)]
regcomp.c: Don't zap larger scope variables

It doesn't matter currently, but it's best to declare more limited scope
variables for doing limited scope work, rather than using the more
global variable, which someday might want to be used later, outside the
block that zapped it, and would lead to a surprise.

4 years agoRemove ASCII/NASCII regnodes
Karl Williamson [Sat, 17 Nov 2018 19:45:24 +0000 (12:45 -0700)]
Remove ASCII/NASCII regnodes

The ANYOFM/NANYOFM regnodes are generalizations of these.  They have
more masks and shifts than the removed nodes, but not more branches, so
are effectively the same speed.  Remove the ASCII/NASCII nodes in favor
of having less code to maintain.

4 years agoregcomp.c: Prefer ANYOF/NANYOFM regnodes
Karl Williamson [Wed, 21 Nov 2018 05:22:56 +0000 (22:22 -0700)]
regcomp.c: Prefer ANYOF/NANYOFM regnodes

These two regnodes are faster than regular /[[:posix:]]/ ones, and some
of the latter are equivalent to some of the former.  So try the faster
optimizations first.

This commit just swaps the two blocks of code, and outdents
appropriately

4 years agoregcomp.c: Refactor some /[foo]/ code
Karl Williamson [Wed, 21 Nov 2018 04:49:16 +0000 (21:49 -0700)]
regcomp.c: Refactor some /[foo]/ code

This refactors the code that sees about optimizing bracketed character
classes into something else, so that the creating of the other regnode
is done closer to its determination, and only the really common code
actually is done in the common place, moved to the end of the function.
This removes the need for some 'elses' and 'ifs'

4 years agoregcomp.c: Simplify handling of EXACTFish nodes with 's' at edge
Karl Williamson [Thu, 20 Dec 2018 09:09:09 +0000 (02:09 -0700)]
regcomp.c: Simplify handling of EXACTFish nodes with 's' at edge

Commit 8a100c918ec81926c0536594df8ee1fcccb171da created node types for
handling an 's' at the leading edge, at the trailing edge, and at both
edges for nodes under /di that there is nothing else in that would
prevent them from being EXACTFU nodes.  If two of these get joined, it
could create an 'ss' sequence which can't be an EXACTFU node, for U+DF
would match them unconditionally.  Instead, under /di it should match
if and only if the target string is UTF-8 encoded.

I realized later that having three types becomes harder to deal with
when adding yet more node types, so this commit turns the three into
just one node type, indicating that at least one edge of the node is an
's'.

It also simplifies the parsing of the pattern and determining which node
to use.

4 years agoregexec.c: Avoid unnecessary folding
Karl Williamson [Wed, 19 Dec 2018 19:19:27 +0000 (12:19 -0700)]
regexec.c: Avoid unnecessary folding

Previous commits caused the pattern under /i to be folded as much as
possible.  This commit takes advantage of this by not folding when we
know it already has been folded.

4 years agoCollapse regnode EXACTFU_SS into EXACTFUP
Karl Williamson [Wed, 19 Dec 2018 18:21:28 +0000 (11:21 -0700)]
Collapse regnode EXACTFU_SS into EXACTFUP

EXACTFUP was created by the previous commit to handle a problematic case
in which not all the code points in an EXACTFU node are /i foldable at
compile time.  Doing so will allow a future commit to use the pre-folded
EXACTFU nodes (done in a prior commit), saving execution time for the
common case.  The only problematic code point is the MICRO SIGN.  Most
patterns don't use this character.

EXACTFU_SS is problematic in a different way.  It contains the sequence
'ss' which is folded to by LATIN SMALL LETTER SHARP S, but everything in
it can be pre-folded (unless it also contains a MICRO SIGN).  The reason
this is problematic is that it is the only non-UTF-8 node where the
length in folding can change.  To process it at runtime, the more
general fold equivalence function is used that is capable of handling
length disparities, but is slower than the functions otherwise used for
non-UTF-8.

What I've chosen to do for now is to make a single node type for all the
problematic cases (which at this time means just the two aforementioned
ones).  If we didn't do this, we'd have to add a third node type for
patterns that contain both 'ss' and MICRO.  Or artificially split the
pattern so the two never were in the same node, but we can't do that
because it can cause bugs in handling multi-character folds.  If more
special handling is found to be needed, there'd be a combinatorial
explosion of additional node types to handle all possible combinations.

What this effectively means is that the slower, more general foldEQ
function is used for portions of patterns containing the MICRO sign when
the pattern isn't in UTF-8, even though there is no inherent reason to
do so for non-UTF-8 strings that don't also contain the 'ss' sequence.

4 years agoAdd regnode EXACTFUP, for problematic
Karl Williamson [Sun, 23 Dec 2018 20:33:07 +0000 (13:33 -0700)]
Add regnode EXACTFUP, for problematic

If a non-UTF-8 pattern contains a MICRO SIGN, this special node is now
created.  This character is the only one not needing UTF-8 to represent,
but its fold does need UTF-8, which causes some issues, so it has to be
specially handled.  When matching against a non-UTF-8 target string, the
pattern is effectively folded, but not if the target is UTF-8.  By
creating this node, we can remove the special handling required for the
nodes that don't have a MICRO SIGN, in a future commit.

4 years agoregexec.c: Most /iaa nodes are now pre-folded
Karl Williamson [Sun, 23 Dec 2018 20:10:09 +0000 (13:10 -0700)]
regexec.c: Most /iaa nodes are now pre-folded

So, we don't have to re-fold them.

Previous commits have caused any EXACTFAA nodes to be pre-folded, and we
now have the infrastructure in regexec.c to take advantage of this,
including in non-UTF-8 patterns.  This commit changes to do this.

The only non-pre-folded EXACTFAA nodes are those that are not UTF-8, but
the target string is.  The reason is that the MICRO SIGN folds to
something representable only in UTF-8, so if you have both non-UTF-8, it
effectively is folded, and if you have the pattern in UTF-8, it gets
folded to the proper character.

In order for non-UTF-8 /iaa nodes to always be fully folded, there would
need to be a separate node for ones that contain the MICRO SIGN, and
then only that one wouldn't be considered folded when the target is
UTF-8.  I don't think it's worth it, as the only gain would be in
matching a non-UTF-8 /iaa node against a UTF-8 target string.  I suspect
/iaa will be used mostly in non-UTF8 target strings.  Comments have been
added to point this out in case someone thinks it should be implemented.

4 years agoregexec.c: Add function to compare /i Latin1, pre-folded
Karl Williamson [Wed, 19 Dec 2018 18:14:58 +0000 (11:14 -0700)]
regexec.c: Add function to compare /i Latin1, pre-folded

This adds a function like Perl_foldEQ_latin1(), but the second string is
assumed to be pre-folded.  I made it a static function in the only file
that uses it, regexec.c, to take advantage of the C optimizer.

More traditionally would be to make a new API function which takes a
flags parameter.  But the whole purpose of this is speed, and so I chose
not to go that route.

4 years agoregcomp.c: Fold characters in non-UTF-8 EXACTFish nodes
Karl Williamson [Sun, 23 Dec 2018 18:51:03 +0000 (11:51 -0700)]
regcomp.c: Fold characters in non-UTF-8 EXACTFish nodes

Prior to this commit, only in isolated circumstances were characters
folded at compile time in non-UTF-8 nodes.  By folding them here,
somewhat fewer instructions need be done at match time.  A future commit
will implement that.

4 years agoregcomp.c: Generate EXACTFU_SS only for non-UTF8
Karl Williamson [Sun, 16 Dec 2018 04:10:44 +0000 (21:10 -0700)]
regcomp.c: Generate EXACTFU_SS only for non-UTF8

It turns out that now, the regular methods for handling multi-character
folds work for the ones involving LATIN SMALL LETTER SHARP S when the
pattern is in UTF-8.  So the special code for handling this case can be
removed, and a regular EXACTFU node is generated.  This has the
advantage of being trie-able, and requiring fewer operations at run
time, as the pattern is pre-folded at compile time, and doesn't have to
be re-folded during each backtracking at run-time.

This means that the EXACTFU_SS node type will only be generated for
non-UTF-8 patterns, and the handling of it is unchanged in these cases.

4 years agoregcomp.c: Avoid duplicate work
Karl Williamson [Tue, 25 Dec 2018 19:17:08 +0000 (12:17 -0700)]
regcomp.c: Avoid duplicate work

By setting a variable, we can place some subsequent code into an else,
avoiding duplication of work.  (Perhaps the compiler optimizers already
figure this out.)

4 years agoregcomp.c: Rationalize use of two variables
Karl Williamson [Tue, 25 Dec 2018 19:20:25 +0000 (12:20 -0700)]
regcomp.c: Rationalize use of two variables

I didn't fully understand the use of two variables that deal with /u in
regular expression pattern compilation when I commited
1a26cbcb0358334c3eb1941a919ffdb57eb4fe7e.

RExC_uni_semantics is used to say that there is something in the pattern
that indicates it is supposed to use /u if /d would otherwise be
selected.  Once set, it cannot be cleared.

UNI_SEMANTICS means if we are operating under /u.  Code forbids /d to be
selected if RExC_uni_semantics is set, but we could select /l, /a, or
/aa, so we don't have to be in /u (and hence UNI_SEMANTICS) if
RExC_uni_semantics is set.  We just can't be in /d.

This commit adds comments, and fixes things to match the above
description.

4 years agot/re/anyof.t: Sort tests; remove dups
Karl Williamson [Wed, 26 Dec 2018 17:46:45 +0000 (10:46 -0700)]
t/re/anyof.t: Sort tests; remove dups

This makes it easier to add new tests without duplicating, as witnessed
by the duplicate ones this commit removes