This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agoparser.t: Suppress warning
Father Chrysostomos [Mon, 5 Sep 2016 05:11:00 +0000 (22:11 -0700)]
parser.t: Suppress warning

7 years agoRegression test for RT #129196
Dan Collins [Sun, 4 Sep 2016 18:43:41 +0000 (14:43 -0400)]
Regression test for RT #129196

7 years ago[perl #129196] Crash/bad read with ‘evalbytes S’
Father Chrysostomos [Mon, 5 Sep 2016 03:24:19 +0000 (20:24 -0700)]
[perl #129196] Crash/bad read with ‘evalbytes S’

5dc13276 added some code to toke.c that did not take into account
that the opnum (‘f’) argument to UNI* could be a negated op number.
PL_last_lop_op must never be negative, since it is used as an offset
into a struct.

Tests for the crash will come in the next commit.

7 years agoinline.h: Declare functions to be inline
Karl Williamson [Sat, 3 Sep 2016 18:17:17 +0000 (12:17 -0600)]
inline.h: Declare functions to be inline

The branch merged with commit 8d19ebbca9eecf219cc453cffe88722722860dd9
forgot to give this hint to the compiler.

7 years agorelease_schedule.pod: Tick off last month
Father Chrysostomos [Sun, 4 Sep 2016 23:02:02 +0000 (16:02 -0700)]
release_schedule.pod: Tick off last month

7 years ago[perl #129073] Assert failure: ${p{};sub p}()
Father Chrysostomos [Sun, 4 Sep 2016 21:22:37 +0000 (14:22 -0700)]
[perl #129073] Assert failure: ${p{};sub p}()

When parsing the special ${var{subscript}} syntax, the lexer notes
that the } matching the ${ will be a fake bracket, and should
be ignored.

In the case of ${p{};sub p}() the first syntax error causes tokens to
be popped, such that the } following the sub declaration ends up being
the one treated as a fake bracket and ignored.

The part of the lexer that deals with sub declarations treats a ( fol-
lowing the sub name as a prototype (which is a single term) if signa-
tures are disabled, but ignores it and allows the rest of the lexer to
treat it as a parenthesis if signatures are enabled.

Hence, the part of the parser (perly.y) that parses signatures knows
that a parenthesis token can only come after a sub if signatures are
enabled, and asserts as much.

In the case of an error and tokens being discarded, a parenthesis may
come after a sub name as far as the parser is concerned, even though
there was a } in between that got discarded.  The sub part of the
lexer, of course did not see the parenthesis because of the interven-
ing brace, and did not treat it as a prototype.  So we get an asser-
tion failure.

The simplest fix is to loosen up the assertion and allow for anomalies
after errors.  It does not hurt to go ahead and parse a signature at
this point, even though the feature is disabled, because there has
been a syntax error already, so the parsed code will never run, and
the parsed sub will not be installed.

7 years agoFix checks for tainted dir in $ENV{PATH}
Father Chrysostomos [Sat, 3 Sep 2016 20:30:22 +0000 (13:30 -0700)]
Fix checks for tainted dir in $ENV{PATH}

$ cat > foo
#!/usr/bin/perl
print "What?!\n"
^D
$ chmod +x foo
$ ./perl -Ilib -Te '$ENV{PATH}="."; exec "foo"'
Insecure directory in $ENV{PATH} while running with -T switch at -e line 1.

That is what I expect to see.  But:

$ ./perl -Ilib -Te '$ENV{PATH}="/\\:."; exec "foo"'
What?!

Perl is allowing the \ to escape the :, but the \ is not treated as an
escape by the system, allowing a relative path in PATH to be consid-
ered safe.

7 years agotaint.t: Set up @INC before using it
Father Chrysostomos [Sat, 3 Sep 2016 17:15:22 +0000 (10:15 -0700)]
taint.t: Set up @INC before using it

The ‘chdir t’ line is useless if we require ./loc_tools.pl before
setting up @INC properly, as loc_tools.pl uses warnings.pm.

7 years agoTry harder to clean up %ENV in 140_proxy.t.
Craig A. Berry [Sat, 3 Sep 2016 15:59:55 +0000 (10:59 -0500)]
Try harder to clean up %ENV in 140_proxy.t.

While the localization earlier in the test *should* leave the
relevent %ENV entries in a good state for the final test, for
some reason this is not happening on VMS.  It may have something
to do with the fact that %ENV has all upper case keys but the
test has previously localized both upper and lower case versions.

In any case, even though it isn't this test's fault, the easiest
and safest way to get it passing is to just do another clean-up.

Awaiting upstream application at:

https://github.com/chansen/p5-http-tiny/pull/95

7 years agoDon't pollute $ENV{LC_ALL} in pod/perlmodlib.PL.
Craig A. Berry [Fri, 2 Sep 2016 20:43:52 +0000 (15:43 -0500)]
Don't pollute $ENV{LC_ALL} in pod/perlmodlib.PL.

Because on VMS, DYNAMIC_ENV_FETCH makes environment settings
persist after program exit, and running a program (e.g. Perl)
does not normally start a separate process.  This was confusing
the inadequate attempt in t/run/locale.t to clear the locale-related
environment variables.

7 years agoDelete localized %ENV entries in t/run/locale.t.
Craig A. Berry [Fri, 2 Sep 2016 19:59:25 +0000 (14:59 -0500)]
Delete localized %ENV entries in t/run/locale.t.

Localizing %ENV entries actually instantiates them with an undef
value, which, at least on VMS, gets propagated to the various
runperl subprocesses where it can trigger locale warnings at start-up
time.  Deleting the localized entries, though, actually removes
them from the localized %ENV:

$ perl -E '{ local $ENV{FOO}; say exists $ENV{FOO} ? 'Y' : 'N'; }'
Y
$ perl -E '{ delete local $ENV{FOO}; say exists $ENV{FOO} ? 'Y' : 'N'; }'
N

but any pre-existing values in outer scope are safely restored when
the local scope exits.

This gets this test passing on VMS again for the first time in a
very long time.  It turns out pod/perlmodlib.PL has been polluting
LC_ALL and this test has not been adequately defending itself.

7 years agoMore stderr suppression in t/run/locale.t.
Craig A. Berry [Fri, 2 Sep 2016 19:17:45 +0000 (14:17 -0500)]
More stderr suppression in t/run/locale.t.

Closing stderr in the parent process doesn't have any effect on
Perl in the subprocess on VMS, so use the facility in the test
infrastructure to suppress stderr there as well.

7 years agoRemove obsolete Test prereq from PathTools
Dagfinn Ilmari Mannsåker [Fri, 2 Sep 2016 15:47:45 +0000 (16:47 +0100)]
Remove obsolete Test prereq from PathTools

It was ported to Test::More in cba09117 in 2011, but the upstream
Makefile.PL that was added in 8e6d3e2b in 2013 took the Makefile.PL from
the last CPAN release which was from 2008.

7 years agoMake PERLLIB_SEP dynamic on VMS.
Craig A. Berry [Thu, 1 Sep 2016 18:30:28 +0000 (13:30 -0500)]
Make PERLLIB_SEP dynamic on VMS.

Because if we're running under a Unix shell, the path separator is
likely to meet the expectations of Unix shell scripts better if it's
the Unix ':' rather than the VMS '|'.  There is no change when
running under DCL.

7 years agoCorrect 'map' documentation to reflect operation on a list.
Dave Cross [Thu, 1 Sep 2016 22:29:58 +0000 (18:29 -0400)]
Correct 'map' documentation to reflect operation on a list.

Rather than on an array.

For: RT #126169.

Dave Cross is now a Perl Author.

7 years agoProvide missing link for one instance of 'eval'.
James E Keenan [Thu, 1 Sep 2016 18:39:16 +0000 (14:39 -0400)]
Provide missing link for one instance of 'eval'.

As originally reported by KES.  See RT #129168.

7 years agoFix is_utf8_valid_partial_char()
Karl Williamson [Thu, 1 Sep 2016 18:07:33 +0000 (12:07 -0600)]
Fix is_utf8_valid_partial_char()

This should have been part of 4dab108fb5e7e21a547733bb00ddb5d8bffd936d,
but when I was rebasing, these changes got moved to an unrelated commit
that hasn't been pushed yet, and I didn't notice immediately.  I will
add som API tests for this in the next few days.

7 years agoAdd C macros for UTF-8 for BOM and REPLACEMENT CHARACTER
Karl Williamson [Sun, 28 Aug 2016 03:17:49 +0000 (21:17 -0600)]
Add C macros for UTF-8 for BOM and REPLACEMENT CHARACTER

This makes it easy for module authors to write XS code that can use
these characters, and be automatically portable to EBCDIC systems.

7 years agoMerge branch for improving API UTF-8 handling into blead
Karl Williamson [Thu, 1 Sep 2016 02:33:21 +0000 (20:33 -0600)]
Merge branch for improving API UTF-8 handling into blead

This set of commits came about to allow XS code to more easily and
quickly check for valid UTF-8 without rolling their own, which could be
lacking in security considerations.

Most of the small UTF-8 handling functions have now been inlined, and
the validity-only checking function has been rewritten to never need to
actually calculate the code point the UTF-8 represents.

The original impetus for this was because of changes in Encode that made
it vulnerable to malformed UTF-8.  These changes were to speed up its
UTF-8 processing.  By changing Encode to use this new stuff, it is
sped up on valid input by over a factor of 5 from the original
implementation, at the expense of slowing down entirely invalid input by
a factor of 4.  Since we are expecting mostly valid input, this is an
overall big win.  The original handrolled Encode changes sped up valid
input handling by about 1.5, without slowing handling of invalid down
appreciably.

7 years agoUse new is_utf8_valid_partial_char()
Karl Williamson [Mon, 29 Aug 2016 04:04:16 +0000 (22:04 -0600)]
Use new is_utf8_valid_partial_char()

This new function can be used in the implementation of the file test
operators, -B and -T, to see if the whole fixed length buffer is valid
UTF-8.  Previously if all bytes were UTF-8 except the bytes at the end
that could have been a partial character, it assumed the whole thing was
UTF-8.  This improves the prediction slightly

7 years agoAdd is_utf8_valid_partial_char()
Karl Williamson [Sun, 28 Aug 2016 16:54:13 +0000 (10:54 -0600)]
Add is_utf8_valid_partial_char()

This new function can test some purported UTF-8 to see if it is
well-formed as far as it goes.  That is there aren't enough bytes for
the character they start, but what is there is legal so far.  This can
be useful in a fixed width buffer, where the final character is split in
the middle, and we want to test without waiting for the next read that
the entire buffer is valid.

7 years agoMake 3 UTF-8 macros API
Karl Williamson [Sun, 28 Aug 2016 02:08:52 +0000 (20:08 -0600)]
Make 3 UTF-8 macros API

These may be useful to various module writers.  They certainly are
useful for Encode.  This makes public API macros to determine if the
input UTF-8 represents (one macro for each category)
    a) a surrogate code point
    b) a non-character code point
    c) a code point that is above Unicode's legal maximum.

The macros are machine generated.  In making them public, I am now using
the string end location parameter to guard against running off the end
of the input.  Previously this parameter was ignored, as their use in
the core could be tightly controlled so that we already knew that the
string was long enough when calling these macros.  But this can't be
guaranteed in the public API.  An optimizing compiler should be able to
remove redundant length checks.

7 years agoutf8.c: Add comments
Karl Williamson [Fri, 26 Aug 2016 22:47:32 +0000 (16:47 -0600)]
utf8.c: Add comments

7 years agois_utf8_string() is now a pure function
Karl Williamson [Fri, 26 Aug 2016 22:53:00 +0000 (16:53 -0600)]
is_utf8_string() is now a pure function

as of the previous commit

7 years agoMove isUTF8_CHAR helper function, and reimplement it
Karl Williamson [Fri, 26 Aug 2016 22:29:54 +0000 (16:29 -0600)]
Move isUTF8_CHAR helper function, and reimplement it

The macro isUTF8_CHAR calls a helper function for code points higher
than it can handle.  That function had been an inlined wrapper around
utf8n_to_uvchr().

The function has been rewritten to not call utf8n_to_uvchr(), so it is
now too big to be effectively inlined.  Instead, it implements a faster
method of checking the validity of the UTF-8 without having to decode
it.  It just checks for valid syntax and now knows where the
few discontinuities are in UTF-8 where overlongs can occur, and uses a
string compare to verify that overflow won't occur.

As a result this is now a pure function.

This also causes a previously generated deprecation warning to not be,
because in printing UTF-8, no longer does it have to be converted to
internal form.  I could add a check for that, but I think it's best not
to.  If you manipulated what is getting printed in any way, the
deprecation message will already have been raised.

This commit also fleshes out the documentation of isUTF8_CHAR.

7 years agoAdd #defines for UTF-8 of highest representable code point
Karl Williamson [Fri, 26 Aug 2016 22:23:24 +0000 (16:23 -0600)]
Add #defines for UTF-8 of highest representable code point

This will allow the next commit to not have to actually try to decode
the UTF-8 string in order to see if it overflows the platform.

7 years agoutf8.h: Add some LIKELY() to help branch prediction
Karl Williamson [Fri, 26 Aug 2016 22:21:25 +0000 (16:21 -0600)]
utf8.h: Add some LIKELY() to help branch prediction

This macro gives the legal UTF-8 byte sequences.  Almost always, the
input will be legal, so help compiler branch prediction for that.

7 years agoutf8.h, utfebcdic.h: Add comments, align white space
Karl Williamson [Fri, 26 Aug 2016 22:07:22 +0000 (16:07 -0600)]
utf8.h, utfebcdic.h: Add comments, align white space

7 years agoInline is_utf8_string() and is_utf8_stringloclen()
Karl Williamson [Fri, 26 Aug 2016 21:53:36 +0000 (15:53 -0600)]
Inline is_utf8_string() and is_utf8_stringloclen()

7 years agoInline utf8_distance(), utf8_hop()
Karl Williamson [Fri, 26 Aug 2016 21:03:52 +0000 (15:03 -0600)]
Inline utf8_distance(), utf8_hop()

7 years agoSlightly simplify utf8_to_uvuni_buf()
Karl Williamson [Fri, 26 Aug 2016 20:47:17 +0000 (14:47 -0600)]
Slightly simplify utf8_to_uvuni_buf()

Use a function that does the same thing.  This also clarifies a related
comment

7 years agoInline is_utf8_invariant_string()
Karl Williamson [Fri, 26 Aug 2016 20:07:50 +0000 (14:07 -0600)]
Inline is_utf8_invariant_string()

7 years agois_utf8_invariant_string is pure
Karl Williamson [Fri, 26 Aug 2016 19:54:51 +0000 (13:54 -0600)]
is_utf8_invariant_string is pure

As are its synonyms.  This also declares the formal parameters 'const'

7 years agoSimplify slightly is_utf8_invariant_string
Karl Williamson [Fri, 26 Aug 2016 19:52:52 +0000 (13:52 -0600)]
Simplify slightly is_utf8_invariant_string

This eliminates an unnecessary branch test in unoptimized code.

7 years agoUse new name 'is_utf8_invariant_string' in core
Karl Williamson [Fri, 26 Aug 2016 19:42:53 +0000 (13:42 -0600)]
Use new name 'is_utf8_invariant_string' in core

This changes the places in the core to use the clearer synonym added by
the previous commit.  It also changes one place that hand-rolled its own
code to use this function instead.

7 years agoAdd new synonym 'is_utf8_invariant_string'
Karl Williamson [Fri, 26 Aug 2016 19:35:28 +0000 (13:35 -0600)]
Add new synonym 'is_utf8_invariant_string'

This is clearer as to its meaning than the existing 'is_ascii_string'
and 'is_invariant_string', which are retained for back compat.  The
thread context variable is removed as it is not used.

7 years agoembed.fnc: Replace blanks by tabs
Karl Williamson [Tue, 23 Aug 2016 19:37:10 +0000 (13:37 -0600)]
embed.fnc: Replace blanks by tabs

In this file, tabs are the more accepted field delimiter, and having
them makes it easier to search for particular patterns in it.

7 years agoutf8.c: Use 'break' instead of 'goto'
Karl Williamson [Mon, 22 Aug 2016 18:28:21 +0000 (12:28 -0600)]
utf8.c: Use 'break' instead of 'goto'

The goto is a relic of a previous implementation; 'break' is preferred
if there isn't a reason to use goto.

7 years agois_utf8_string_loc() param should not be NULL
Karl Williamson [Mon, 22 Aug 2016 18:25:00 +0000 (12:25 -0600)]
is_utf8_string_loc() param should not be NULL

It makes no sense to call this function with a NULL parameter, as the
whole point of using this function is to set what that param points to.
If you don't want this, you should be using the similar function that
doesn't have this parameter.

7 years agoDocument valid_utf8_to_uvchr() and inline it
Karl Williamson [Mon, 22 Aug 2016 18:21:06 +0000 (12:21 -0600)]
Document valid_utf8_to_uvchr() and inline it

This function has been in several releases without problem, and is short
enough that some compilers can inline it.  This commit also notes that
the result should not be ignored, and removes the unused pTHX.  The
function has explicitly been marked as being changeable, and has not
been part of the API until now.

7 years agoutf8.c: Clarify comments for valid_utf8_to_uvchr()
Karl Williamson [Mon, 22 Aug 2016 16:48:55 +0000 (10:48 -0600)]
utf8.c: Clarify comments for valid_utf8_to_uvchr()

7 years agoutf8.c: Join EBCDIC/non-EBCDIC code
Karl Williamson [Mon, 22 Aug 2016 16:59:48 +0000 (10:59 -0600)]
utf8.c: Join EBCDIC/non-EBCDIC code

This was missed in 534752c1d25d7c52c702337927c37e40c4df103d

7 years agoregen/embed.pl: Allow inline funcs to be named Perl_foo
Karl Williamson [Fri, 26 Aug 2016 21:25:20 +0000 (15:25 -0600)]
regen/embed.pl: Allow inline funcs to be named Perl_foo

When inlining an existing public function whose name begins with Perl_,
it's best to keep that name, in case someone is calling it that way.
Prior to this commit, the name had to be changed to S_foo.

7 years agoUpdate outdated man links for strlcpy and strlcat.
Theo Buehler [Sat, 27 Aug 2016 01:36:28 +0000 (03:36 +0200)]
Update outdated man links for strlcpy and strlcat.

7 years agoAdd Theo Buehler to AUTHORS
Karl Williamson [Thu, 1 Sep 2016 00:07:55 +0000 (18:07 -0600)]
Add Theo Buehler to AUTHORS

7 years agoPATCH: [perl #129122] regex sets syntax error
Karl Williamson [Wed, 31 Aug 2016 23:05:45 +0000 (17:05 -0600)]
PATCH: [perl #129122] regex sets syntax error

This was caused by two statements being in the wrong order.  One should
save something on the stack before changing it, not after.

However fixing this led to the discovery of another bug in which an
error case was failed to be detected.

7 years agoregcomp.c: Typo, spacing in comment
Karl Williamson [Wed, 31 Aug 2016 22:57:20 +0000 (16:57 -0600)]
regcomp.c: Typo, spacing in comment

7 years agoPorting/bisect.pl: /usr/sbin/sysctl exists
Karl Williamson [Sun, 24 Jul 2016 00:28:52 +0000 (18:28 -0600)]
Porting/bisect.pl: /usr/sbin/sysctl exists

7 years agoRevert "perlinterp: Use 'e.g' not 'i.e.' for 'for example'"
Karl Williamson [Mon, 29 Aug 2016 23:06:50 +0000 (17:06 -0600)]
Revert "perlinterp: Use 'e.g' not 'i.e.' for 'for example'"

This reverts commit ce66b506fa280c2ede0b0d4a3e81b53d0e31cb48.

I misread the text.  This is an exhaustive list, so "i.e." is proper.

7 years agoPATCH: [perl #129038] Crash with s///l
Karl Williamson [Sun, 28 Aug 2016 01:16:17 +0000 (19:16 -0600)]
PATCH: [perl #129038] Crash with s///l

The cause of this was bad logic.  It thought it was dealing with UTF-8
when it wasn't.

7 years agoperlinterp: Use 'e.g' not 'i.e.' for 'for example'
Karl Williamson [Sun, 28 Aug 2016 15:39:38 +0000 (09:39 -0600)]
perlinterp: Use 'e.g' not 'i.e.' for 'for example'

7 years ago[RT #129069] Perl_yylex: Fix two use-after-free bugs
Dan Collins [Wed, 24 Aug 2016 18:19:09 +0000 (14:19 -0400)]
[RT #129069] Perl_yylex: Fix two use-after-free bugs

Perl_yylex maintains up to two pointers, `s` and `d`, into the parser
buffer at PL_bufptr. It can call skipspace(), which can potentially
grow (and realloc) its argument. This can leave the second pointer
pointing at the old buffer. Under most cases it isn't visible, because
the old buffer isn't reused or zeroed. However, under Valgrind or
libdislocator, this memory management error becomes visible.

This patch saves the location of the second pointer in two locations,
and restores it after the call to skipspace.

7 years ago[perl #125679] Don’t make lvref ops on error
Father Chrysostomos [Sun, 28 Aug 2016 14:21:19 +0000 (07:21 -0700)]
[perl #125679] Don’t make lvref ops on error

When converting an op into an lvref op (the rv2av in \(@_)=... gets
converted while the refgen gets nulled), if we reject the op as a
valid one for refaliasing we should not go ahead and convert it.  It
we do convert it (as we were doing), then we may convert an op that
uses op_targ for auxiliary information into one that uses it as a pad
offset.  When freeing the op, we will then be reading a ‘random’ off-
set in the pad and trying to free the SV.  That pad entry may not even
be within the pad.

In the specific case of entereval, op_targ holds the hints, and the
larger the value of $^H, the more likely it is to crash.  So
BEGIN{$^H=-1}\eval=... will crash.

7 years agoUpgrade to Thread::Semaphore 2.13
jdhedden [Sat, 27 Aug 2016 13:01:40 +0000 (09:01 -0400)]
Upgrade to Thread::Semaphore 2.13

7 years agoIncrease $Filter::Simple::VERSION to 0.93
Father Chrysostomos [Fri, 26 Aug 2016 13:37:05 +0000 (06:37 -0700)]
Increase $Filter::Simple::VERSION to 0.93

7 years ago[perl #107726] Filter::Simple: ‘use’ and then ‘no’
Ricardo SIGNES [Fri, 26 Aug 2016 13:36:09 +0000 (06:36 -0700)]
[perl #107726] Filter::Simple: ‘use’ and then ‘no’

Filter::Simple was erroneously signalling eof if it encountered a
‘no MyFilter’ right after ‘use’:

use MyFilter;
no MyFilter;

In this case it should simply not filter anything.

The reason for the bug was that the ‘while ($status = filter_read())’
loop in Filter::Simple::gen_filter_import was not incrementing $count
(a variable used basically as a boolean to remember whether we are
still getting input from the file) when finding the terminator (no
MyFilter).  So it would conclude after the loop that the file had come
to an end and simply return 0.

[Commit message written by the committer.]

7 years ago[perl #107726] Test for Filter::Simple and ‘no’
Father Chrysostomos [Fri, 26 Aug 2016 13:20:05 +0000 (06:20 -0700)]
[perl #107726] Test for Filter::Simple and ‘no’

use MyFilter;
no MyFilter;

does not work.  A fix is forthcoming.

7 years agoperlinterp.pod: Expand the op tree section
Father Chrysostomos [Thu, 11 Aug 2016 06:43:34 +0000 (23:43 -0700)]
perlinterp.pod: Expand the op tree section

based on things that came up in the thread starting at
<20160808225325.79944d95@shy.leonerd.org.uk>.

7 years agoRemove VMS-specific hacks from showlex.t.
Craig A. Berry [Fri, 26 Aug 2016 02:09:01 +0000 (21:09 -0500)]
Remove VMS-specific hacks from showlex.t.

I added this 15 years ago in d0c1fe9a9931bc27, but it isn't
necessary for any VMS version now supported and it has recently
caused the test to start failing under the test suite but not
when run individually.  So just get rid of it.

7 years agolocale.c: Use my_strlcat()
Karl Williamson [Tue, 23 Aug 2016 19:32:05 +0000 (13:32 -0600)]
locale.c: Use my_strlcat()

strcat() is safe in this context, but some compilers were optimizing
this to strcpy() causing a porting test to fail that looks for unsafe
code.  Rather than fighting this, just use my_strlcat().  The code is
rarely executed.  But at the same time, I used the return value of that
function to know where to start the next cat in the next loop iteration
without having to have the cat code search for the trailing NUL.

7 years agoperlapi: Document returns from my_strlcat, my_strlcpy
Karl Williamson [Tue, 23 Aug 2016 19:30:45 +0000 (13:30 -0600)]
perlapi: Document returns from my_strlcat, my_strlcpy

7 years agoPATCH: [perl #129072]: podspec typo
Karl Williamson [Thu, 25 Aug 2016 16:23:21 +0000 (10:23 -0600)]
PATCH: [perl #129072]: podspec typo

7 years agoPerl_deb_stack_all() - handle CXt_SUBST better
David Mitchell [Wed, 24 Aug 2016 15:28:00 +0000 (16:28 +0100)]
Perl_deb_stack_all() - handle CXt_SUBST better

RT #129029

There's a loop which skips CXt_SUBST context entries - but it
wasn't checking that the *current* cx is that type, but instead
was always checking the base cx and was effectively a noop

Also fixup a few code comments in that function.

7 years agorestore Internals::hv_clear_placeholders for now
Yves Orton [Thu, 25 Aug 2016 10:03:42 +0000 (12:03 +0200)]
restore Internals::hv_clear_placeholders for now

7 years agotmp fix for Bleadperl breaks Variable-Magic
David Mitchell [Wed, 24 Aug 2016 12:57:56 +0000 (13:57 +0100)]
tmp fix for Bleadperl breaks Variable-Magic

RT #128989

Prior to my commit v5.25.3-266-g1d7e644, in the absence of the SVs_RMG
flag, av_fetch() used AvFILL() for -ve keys and AvFILLp() for positive
keys. That commit changed it so they both use AvFILLp. This has broken
Variable::Magic 0.59.

As an interim measure, restore the old behaviour.

7 years agoconcise.t: work with PERL_UNICODE=""
David Mitchell [Wed, 24 Aug 2016 12:41:00 +0000 (13:41 +0100)]
concise.t: work with PERL_UNICODE=""

Fixup some tests I added recently so that they pass with PERL_UNICODE=""
- which causes extra hints bits to be set in nextstate ops.

7 years agore_untuit_start() avoid overshoot with utf8
David Mitchell [Wed, 24 Aug 2016 12:21:04 +0000 (13:21 +0100)]
re_untuit_start() avoid overshoot with utf8

RT #129012

re_untuit_start() is run before doing a "proper" regex match, to either
quickly reject a match or to find the earliest position in a string where
the match could occur. Part of its action is to search within the string
for a known substring which forms a part of the pattern.

If that substring is utf8, with multiple bytes per character, then
the calculation of the highest point in the string where its worth
searching for the substring, could overshoot the end of the string.

It's a (mostly) harmless issue, since apart from the issue of reading a
few bytes beyond the end of a string (which might cause a problem if the
string is memory mapped for example), the only concern is that in theory
(although extremely unlikely) a spurious match for a substring could be
found partly beyond the end of the string, resulting in the full RE engine
being called to (correctly) do the match, when otherwise the match could
have been more quickly rejected.

7 years agotweaks for Win32 VC vs GCC detection makefile code
Daniel Dragan [Mon, 15 Aug 2016 21:00:18 +0000 (17:00 -0400)]
tweaks for Win32 VC vs GCC detection makefile code

-fix issue that CCHOME depends on CCTYPE, which in auto detect mode is
 set after CCHOME so CCHOME uses uninit CCTYPE var
-also fix else vs .ELSE in makefile.mk

7 years agopodcheck.t: Show file name in stderr output
Father Chrysostomos [Tue, 23 Aug 2016 13:27:27 +0000 (06:27 -0700)]
podcheck.t: Show file name in stderr output

So that one does not have to re-run it by hand to find out which
file failed.

7 years agoUpdate that Module-CoreList in Maintainers.pl
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 21:41:55 +0000 (22:41 +0100)]
Update that Module-CoreList in Maintainers.pl

7 years agoPrepare Module-CoreList for v5.25.5
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 21:18:35 +0000 (22:18 +0100)]
Prepare Module-CoreList for v5.25.5

7 years agoBump the perl version in various places for v5.25.5
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 21:07:30 +0000 (22:07 +0100)]
Bump the perl version in various places for v5.25.5

7 years agoNew perldelta
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 21:00:26 +0000 (22:00 +0100)]
New perldelta

7 years agoUpdate epigraphs for v5.25.4
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 20:52:01 +0000 (21:52 +0100)]
Update epigraphs for v5.25.4

7 years agoUpdate perlhist v5.25.4
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 18:40:51 +0000 (19:40 +0100)]
Update perlhist

7 years agoFinalise perldelta
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 18:30:25 +0000 (19:30 +0100)]
Finalise perldelta

7 years agoUpdate Module::CoreList
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 17:43:02 +0000 (18:43 +0100)]
Update Module::CoreList

7 years agoUpdate release date in Module::CoreList
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 17:35:26 +0000 (18:35 +0100)]
Update release date in Module::CoreList

7 years agoperldelta documentation section
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 15:58:31 +0000 (16:58 +0100)]
perldelta documentation section

7 years agoperldelta updates
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 15:52:44 +0000 (16:52 +0100)]
perldelta updates

7 years agoUpdate ExtUtils-MakeMaker to CPAN version 7.24
Chris 'BinGOs' Williams [Sat, 20 Aug 2016 12:39:12 +0000 (13:39 +0100)]
Update ExtUtils-MakeMaker to CPAN version 7.24

  [DELTA]

7.24  Sat Aug 20 13:22:28 BST 2016

    No changes since 7.23_01

7.23_01 Fri Aug 19 10:02:30 BST 2016

    Test fixes:
    - always use the core serializers when testing in core

7 years agopodcheck.t: Send helpful error output to stderr
Father Chrysostomos [Sat, 20 Aug 2016 05:22:21 +0000 (22:22 -0700)]
podcheck.t: Send helpful error output to stderr

While we do try to keep stderr clean for tests, that is for *passing*
tests.  If the diagnostic output goes to stdout instead, then nobody
gets to see it for ‘make test’, which means that the script has to
be re-run by itself just to find out what failed.  Since this is a
long-running test, that is quite inconvenient.

Also mention which .t the output is coming from.

7 years agoperldelta for #128951 / bf8a9a15
Father Chrysostomos [Sat, 20 Aug 2016 05:10:57 +0000 (22:10 -0700)]
perldelta for #128951 / bf8a9a15

7 years agoCorrect a perldelta entry
Father Chrysostomos [Sat, 20 Aug 2016 05:08:14 +0000 (22:08 -0700)]
Correct a perldelta entry

The termcode variable in scan_const, which was an I32 and susceptible
to truncation, is not used to find the closing delimiter, but only to
check for special uses of delimiters such as in qr'...' and m?...? and
‘<’ which is used internally as the ‘closing delimiter’ for here-docs,
it being one that can never occur for other pyoq operators.

Hence, such strings already worked before, but now they work consis-
tently; \x{100000027} no longer suppresses regexep interpolation,
for instance.

7 years agoalways use the core serializers in EUMM for core tests
Karen Etheridge [Thu, 18 Aug 2016 19:47:41 +0000 (12:47 -0700)]
always use the core serializers in EUMM for core tests

7 years agoregenerate META.* using new CPAN::Meta, and always use the core serializers
Karen Etheridge [Thu, 18 Aug 2016 18:35:11 +0000 (11:35 -0700)]
regenerate META.* using new CPAN::Meta, and always use the core serializers

7 years agoChanges manually performed for one file.
Karen Etheridge [Fri, 19 Aug 2016 23:24:49 +0000 (19:24 -0400)]
Changes manually performed for one file.

cpan/CPAN-Meta/Lib/CPAN/Meta.pm was being very naughty when it came to being
the target of 'git am'.  As committer, I extracted the diff for that file from
the patch supplied by the author and attempted to apply it via 'git apply'.
Still no luck.  Hence, I manually edited the source file.

For: RT #128987

7 years agoManually remove file recalcitrant to 'git am'.
James E Keenan [Fri, 19 Aug 2016 23:45:33 +0000 (19:45 -0400)]
Manually remove file recalcitrant to 'git am'.

7 years agoUpgrade CPAN-Meta from 2.150005 -> 2.150010 (Parse-CPAN-Meta now combined into this...
Karen Etheridge [Thu, 18 Aug 2016 17:14:00 +0000 (10:14 -0700)]
Upgrade CPAN-Meta from 2.150005 -> 2.150010 (Parse-CPAN-Meta now combined into this distribution)

    2.150010  2016-08-18 12:10:08-04:00 America/New_York

      [FIXED]

      - the YAML and JSON backend variables are ignored when building/testing the
        perl core itself, where non-core backends are not yet installed.

      [CHANGED]

      - Added "use warnings" to Parse::CPAN::Meta

    2.150009  2016-07-02 21:07:49-04:00 America/New_York (TRIAL RELEASE)

      [FIXED]

      - Fixed used of Encode in Parse::CPAN::Meta::load_json_string
        (Cherry picked from Parse::CPAN::Meta 1.4422)

    2.150008  2016-06-28 17:01:03-04:00 America/New_York (TRIAL RELEASE)

      [ADDED]

      - Merged Parse::CPAN::Meta 1.4420 into this distribution

    2.150007  2016-06-28 03:48:16-04:00 America/New_York (TRIAL RELEASE)

      [FIXED]

      - The cloning routine would raise an error on expected types when it
        previously would stringify.  The old behavior is restored.

    2.150006  2016-06-23 20:05:46-04:00 America/New_York (TRIAL RELEASE)

      [FIXED]

      - CPAN::Meta::Prereqs now fully accepts phases and types starting with 'x_'.
        New 'phases' and 'types_in' interfaces have been added.

      - No longer relies on JSON backend for data structure cloning. This is
        much faster than using JSON::PP.

      [TESTS]

      - The 'extra_mappings' feature for meta merging is now tested and
        documented.

      - During tests, delete new environment variables added by
        Parse::CPAN::Meta 1.4418

      [SPEC]

      - Clarifies acceptable values for booleans

      - Cleaned up text and links of historical specs.

7 years agoperldelta: Updates for 5.24
Karl Williamson [Fri, 19 Aug 2016 20:17:42 +0000 (14:17 -0600)]
perldelta: Updates for 5.24

This constitutes the changes that khw made that he thinks warrant
mention in perldelta.

7 years agoEncode: revert commit that introduces security holes
Karl Williamson [Fri, 19 Aug 2016 20:07:53 +0000 (14:07 -0600)]
Encode: revert commit that introduces security holes

This reverts a portion of commit
0f33e03c7e91f63bcd07b5ddfc00101715fa1fc0 which introduces some security
holes in checking for UTF-8 malformations.  In particular, it allows
overflow in non-strict mode, and overlongs in either mode.

See discussion at https://github.com/dankogai/p5-encode/issues/64

This reversion is to make sure that we don't release even a development
version with known security holes.  A final disposition is still to be
determined

7 years agoDo not show error message if errno = 0 for flush fail on STDOUT
H.Merijn Brand [Fri, 19 Aug 2016 18:44:14 +0000 (20:44 +0200)]
Do not show error message if errno = 0 for flush fail on STDOUT

Somehow (on HP-UX Itanium) the flush fails, but errno is still 0
The lib/warnings.t test then shows

EXPECTED:
Filehandle STDOUT opened only for output at - line 3.
GOT:
Filehandle STDOUT opened only for output at - line 3.
Unable to flush stdout: Error 0

This change suppresses that last line if errno is (still) 0

7 years agoav_fetch(): remove check for freed SV
David Mitchell [Fri, 19 Aug 2016 10:39:20 +0000 (11:39 +0100)]
av_fetch(): remove check for freed SV

Currently av_fetch() has this extra test:

    if (AvREIFY(av) && SvIS_FREED(AvARRAY(av)[key])) {
        /* eg. @_ could have freed elts */
        AvARRAY(av)[key] = NULL;        /* 1/2 reify */

which basically says that if the array has the reify flag set (typically
only @_ has this) and if the element being retrieved in it has been freed,
then replace it with an undef value instead.

This can be triggered with code like:

    sub f {
        $r = 0;
        my $var = $_[0];
    }

    $r = do { my $x; \$x };
    f($$r);

which leaves $var as undef rather than causing a "panic: attempt to copy
freed scalar".

However, code like

    my ($var) = @_;

*won't* get handled specially, and will still trigger the panic.

It was added in 1996 as a result of this thread:

    From: Andreas Koenig <k@anna.in-berlin.de>
    Subject: SEGV with $_[0] and circular references
    Message-Id: <199608131528.RAA25965@anna.in-berlin.de>

That was in the context of getting a SEGV - whereas now we get the
"panic: attempt to copy freed scalar" instead.

It was agreed in this thread that it could be removed:

    http://nntp.perl.org/group/perl.perl5.porters/239082

7 years agoConcise: improve hints decoding
David Mitchell [Fri, 19 Aug 2016 10:30:47 +0000 (11:30 +0100)]
Concise: improve hints decoding

Include the missing HINT_UNI_8_BIT (as 'us'), decode the feature bundle
bits (as fea=7) and display any unrecognised bits in hex rather than
decimal.

This changes a nextstate following 'use feature "signatures"' from, to

    2     <;> nextstate(...) v:%,{,469762048 ->3
    2     <;> nextstate(...) v:%,{,fea=7 ->3

7 years agoConcise: use hex for some large constants
David Mitchell [Fri, 19 Aug 2016 08:04:52 +0000 (09:04 +0100)]
Concise: use hex for some large constants

7 years agotoke.c: Introduce peekspace()
Father Chrysostomos [Fri, 19 Aug 2016 05:27:42 +0000 (22:27 -0700)]
toke.c: Introduce peekspace()

This should make the sites that use LEX_NO_INCLINE a bit less arcane.
This has nothing to do with the erstwhile PEEKSPACE macro that existed
for MADness’ sake.

7 years agotoke.c: Note retval of S_skipspace
Father Chrysostomos [Fri, 19 Aug 2016 05:23:45 +0000 (22:23 -0700)]
toke.c: Note retval of S_skipspace

7 years agotoke.c: Move skipspace closer to S_skipspace
Father Chrysostomos [Fri, 19 Aug 2016 05:22:25 +0000 (22:22 -0700)]
toke.c: Move skipspace closer to S_skipspace

It was added back in 21791330a when we still had MADness.  Back then
there were about four skipspace functions, some of them before
S_update_debugger_info and some after, and I just put the #define
before all of them.  But now the only skipspace function left is
after S_update_debugger_info, so having the #define before it just
makes it harder to see what’s what.

7 years ago[perl #128951] Fix ASan error with @{\327
Father Chrysostomos [Thu, 18 Aug 2016 05:32:23 +0000 (22:32 -0700)]
[perl #128951] Fix ASan error with @{\327

By \327 I mean character number 327 in octal.

Without memory tools like ASan, it produces garbled output.  The added
test fails like this:

# Failed test 18 - @ { \327 \n - used to garble output (or fail asan) [perl \#128951] at ./test.pl line 1058
#      got "Unrecognized character \\xD7; marked by <-- HERE after \x{a0}\x{f6}@3\x{a8}\x{7f}\000\000@{<-- HERE near column -1 at - line 1."
# expected "Unrecognized character \\xD7; marked by <-- HERE after @{<-- HERE near column 3 at - line 1."

Dave Mitchell’s explanation from the RT ticket:
> The src code contains the bytes:
>
>     @ { \327 \n
>
> after seeing "@{" the lexer calls scan_ident(), which sees the \327 as an
> ident, then calls S_skipspace_flags() to skip the spaces following the
> ident.  This moves the current cursor position to the \n, and since that's
> a line boundary, its updates PL_linestart and PL_bufptr to point to \n
> too.
>
> When it finds that the next char isn't a '}', it does this:
>
>             /* Didn't find the closing } at the point we expected, so restore
>                state such that the next thing to process is the opening { and */
>      s = SvPVX(PL_linestr) + bracket; /* let the parser handle it */
>
> i.e. it moves s back to the "{\317" then continues.
>
> However, PL_linestart doesn't get reset, so later when the parser
> encounters the \327 and tries to croak with "Unrecognized character %s ...",
> when it prints out the section of src code in error, since s < PL_linestr,
> negative string lengths and ASAN errors ensue.

This commit fixes it by passing the LEX_NO_INCLINE flag (added by
21791330a), which specifies that we are not trying to read past the
newline but simply peek ahead.  In that case lex_read_space does not
reset PL_linestart.

But that does cause problems with code like:

${;
#line 3

}

because we end up jumping ahead via skipspace without updating the
line number.  So we need to do a skipspace_flags(..., LEX_NO_INCLINE)
first (i.e., peek ahead), and then when we know we don’t need to go
back again we can skipspace(...) for real.

7 years agoperldelta for the many hexfp fixes.
Jarkko Hietaniemi [Thu, 18 Aug 2016 23:19:17 +0000 (19:19 -0400)]
perldelta for the many hexfp fixes.