This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tony Cook [Mon, 7 Mar 2016 03:58:38 +0000 (14:58 +1100)]
avoid reading/writing beyond the end of RExC_(open|close)_parens
Partly reverts
d5a00e4af, which added this change:
- for ( paren=0 ; paren < RExC_npar ; paren++ ) {
+ for ( paren=0 ; paren <= RExC_npar ; paren++ ) {
but RExC_(open|close)_parens are both allocated with RExC_npar entries,
making this a read/write buffer overflow.
This caused crashes during the build with GCC on Win32, and was
detectable with valgrind and -fsanitize=address on Linux.
With the change, passes all tests with -fsanitize=address -DDEBUGGING
on Linux and finishes the build with GCC on Win32.
Tony Cook [Mon, 7 Mar 2016 00:43:51 +0000 (11:43 +1100)]
Lukas Mai [Thu, 3 Mar 2016 23:21:27 +0000 (00:21 +0100)]
make building without memcpy work (RT #127619)
Lukas Mai [Mon, 29 Feb 2016 07:45:12 +0000 (08:45 +0100)]
util.c: make my_mem*/my_b* prototypes more like the originals
Karl Williamson [Mon, 10 Aug 2015 03:40:21 +0000 (21:40 -0600)]
Update bytes.pm doc
The one legitimate use of this pragma is for debugging. This changes to
say so, and other minor changes.
Yves Orton [Sun, 6 Mar 2016 16:32:35 +0000 (17:32 +0100)]
regcomp.c: fix Perl #126405, segfault regex
There was a flaw in how we scan regexes for triable sequences.
It is possible that the end of a branch points *past* the tail of
the branch sequences, which was resulting in us constructing
tries when we shouldn't. This patch changes equivalency tests for
an inequality test, which prevents this problem.
I am not sure how to test for this problem as it doesn't actually
segfault for me, but I can see the illegal read in valgrind.
Yves Orton [Sun, 6 Mar 2016 16:31:14 +0000 (17:31 +0100)]
regcomp.c: improve diagnostics for TRIE construction
Yves Orton [Sun, 6 Mar 2016 12:56:44 +0000 (13:56 +0100)]
fix Perl #126182, out of memory due to infinite pattern recursion
The way we tracked if pattern recursion was infinite did not work
properly. A pattern like
"a"=~/(.(?2))((?<=(?=(?1)).))/
would loop forever, slowly eat up all available ram as it added
pattern recursion stack frames.
This patch changes the rules for recursion so that recursively
entering a given pattern "subroutine" twice from the same position
fails the match. This means that where previously we might have
seen fatal exception we will now simply fail. This means that
"aaabbb"=~/a(?R)?b/
succeeds with $& equal to "aaabbb".
Yves Orton [Sat, 5 Mar 2016 21:04:28 +0000 (22:04 +0100)]
Unify GOSTART and GOSUB
GOSTART is a special case of GOSUB, we can remove a lot of offset twiddling,
and other special casing by unifying them, at pretty much no cost.
GOSUB has 2 arguments, ARG() and ARG2L(), which are interpreted as
a U32 and an I32 respectively. ARG() holds the "parno" we will recurse
into. ARG2L() holds a signed offset to the relevant start node for the
recursion.
Prior to this patch the argument to GOSUB would always be >=, and unlike
other parts of our logic we would not use 0 to represent "start/end" of
pattern, as GOSTART would be used for "recurse to beginning of pattern",
after this patch we use 0 to represent "start/end", and a lot of
complexity "goes away" along with GOSTART regops.
Yves Orton [Sat, 5 Mar 2016 22:09:19 +0000 (23:09 +0100)]
rename RExC_opend RExC_end_op for clarity
Yves Orton [Sat, 5 Mar 2016 19:40:36 +0000 (20:40 +0100)]
first step cleaning up regexp recursion "return" logic
When we do a GOSUB/GOSTART we need to know where the recursion
"returns" to the previous position in the pattern. Currently
this is done by comparing cur_eval->u.eval.close_paren to the
the argument of CLOSE parens, and within END blocks (for GOSTART).
However, there is a problem. The state machinery for GOSUB/GOSTART
is shared with EVAL ( implementing /(??{ ... })/ ), which also sets
cur_eval->u.eval.close_paren to 0. This for instance breaks /(?(R)YES|NO)/
by making it return true within a /(??{ ... })/ when arguably it
shouldn't. It also is confusing.
So we change the meaning of close_paren so that 0 means "from EVAL",
and that otherwise the value is "+1", so 1 means GOSTART (trigger for
END), and 2 means "CLOSE1", etc. In order to make this transparent
this patch adds the EVAL_CLOSE_PAREN_IS( cur_eval, EXPR ) macro which
does the right thing:
( cur_eval && cur_eval->u.eval.close_paren &&
( ( cur_eval->u.eval.close_paren - 1 ) == EXPR ) )
Karl Williamson [Sun, 6 Mar 2016 03:22:44 +0000 (20:22 -0700)]
perlebcdic: Update for 5.24
Fix some typos, and most importantly remove the now-fixed items from the
BUGS section
Jarkko Hietaniemi [Sat, 5 Mar 2016 21:34:31 +0000 (16:34 -0500)]
Time-HiRes: record latest changes
Assuming that at some point a CPAN release of the new! shinier!
Time-HiRes might be a good thing.
The version bump to 1.9731 was done already in
1625f1d3. Leave the
day of month open in case more changes come in, no need to constantly
bump the version.
Ricardo Signes [Sat, 5 Mar 2016 19:22:30 +0000 (14:22 -0500)]
PathTools: import Changes file from CPAN
Andy Broad [Sat, 5 Mar 2016 18:18:08 +0000 (13:18 -0500)]
amigaos4: execvp() and popen() enhancements
myexecvp()
Replaces alloca() in execvp() with IExec->AllocVecTags() with the memory
type explicitly set to MEMF_SHARED (alloca allocating on the stack which is
MEMF_PRIVATE and in theory at least you can't share that with the sub
process (in practice this isn't enforced yet, too much old software would
break, but one of these days)).
amigaos_popen()
Alters file opening order to ensure that the write end of the pipe is always
opened first.
Now attempts to pass Input() out Output() (stdin or stout) to the non-pipe
file handles rather than NIL: reverting to NIL: if the above can't be
DupFileHandled() (say if they were redirected to a file opened with an
exclusive lock).
Karl Williamson [Sat, 5 Mar 2016 00:05:09 +0000 (17:05 -0700)]
PATCH: [perl #127262] assertion fail on malformed UTF8
Add a guard against malformed UTF-8.
Jarkko Hietaniemi [Fri, 4 Mar 2016 02:20:55 +0000 (21:20 -0500)]
Time-HiRes: refactor also nanosleep init
Jarkko Hietaniemi [Fri, 4 Mar 2016 02:11:38 +0000 (21:11 -0500)]
Time-HiRes: avoid going negative on struct timespec
Jarkko Hietaniemi [Fri, 4 Mar 2016 02:25:30 +0000 (21:25 -0500)]
Time-HiRes: refactor common timespec subtraction code
Jarkko Hietaniemi [Thu, 3 Mar 2016 23:23:52 +0000 (18:23 -0500)]
Time-HiRes: for nanosleeps, zero is success
Testing for zero makes it slightly less odd-looking than bang.
Jarkko Hietaniemi [Thu, 3 Mar 2016 23:21:42 +0000 (18:21 -0500)]
Time-HiRes: use NV_1E6 and NV_1E9 consistently
Jarkko Hietaniemi [Thu, 3 Mar 2016 22:29:58 +0000 (17:29 -0500)]
Time-HiRes: initialize the unslept timespec
Found by clang scan-build.
David Mitchell [Fri, 4 Mar 2016 17:36:57 +0000 (17:36 +0000)]
threads.xs: create new static fn S_jmpenv_run()
S_jmpenv_run() replaces 3 similar pieces of code that do
JMPENV_PUSH(); ... stuff ...; JMPENV_POP().
As a side effect of this commit, it gets rid of this annoying warning
under g++:
warning: variable ‘my_perl’ might be clobbered by ‘longjmp’
David Mitchell [Fri, 4 Mar 2016 10:59:21 +0000 (10:59 +0000)]
rpeep(): eliminate compiler warning
op.c: In function ‘Perl_rpeep’:
op.c:13692:37: warning: comparison is always false due to limited
range of data type [-Wtype-limits]
? base : 0) >
^
replace the '0' with something that still always fails to match but
hopefully won't warn.
David Mitchell [Thu, 3 Mar 2016 10:59:57 +0000 (10:59 +0000)]
Simplify _MEM_WRAP_NEEDS_RUNTIME_CHECK()
And at the same time hopefully avoid some false-positive compiler warnings
on HP-UX
Karl Williamson [Fri, 4 Mar 2016 20:14:30 +0000 (13:14 -0700)]
PATCH: [perl #126141]: qr/]]]]][\\/ fails to raise error
This was due to the trailing \ trying to look at the next character
without verifying that one actually existed.
Karl Williamson [Fri, 4 Mar 2016 18:59:18 +0000 (11:59 -0700)]
regcomp.c: Fix a memory leak
This revises
5751998882d1db1c0f62a32a0b16e58176928a35 so that it works
if a called function fails to return (it was failing if there was
illegal tainting going on).
Karl Williamson [Fri, 4 Mar 2016 17:12:43 +0000 (10:12 -0700)]
locale.c: Avoid a leak
This reorders things to allow a free to be done. The cause was spotted
by Tony Cook.
Karl Williamson [Fri, 4 Mar 2016 16:34:40 +0000 (09:34 -0700)]
POSIX.xs: Avoid a leak in setlocale()
Tony Cook suggested this fix.
Karl Williamson [Mon, 22 Feb 2016 18:27:50 +0000 (11:27 -0700)]
TODO or skip certain failing locale tests on cygwin
This is a known problem which cygwin has fixed in 2.5
Tony Cook tested this and found and fixed several bugs in it before this
final version was made.
Karl Williamson [Thu, 3 Mar 2016 21:21:05 +0000 (14:21 -0700)]
regcomp.c: Revise, add comments, white-space changes
Karl Williamson [Thu, 3 Mar 2016 16:56:41 +0000 (09:56 -0700)]
regcomp.c: Avoid a memory leak
The croak is using heap storage for an argument. Making that
SAVEFREEPV() will make sure it gets freed.
Karl Williamson [Thu, 3 Mar 2016 16:40:55 +0000 (09:40 -0700)]
regcomp.c: White-space only
Outdent and reflow comments because the previous commit removed a
surrounding block.
Karl Williamson [Thu, 3 Mar 2016 05:10:58 +0000 (22:10 -0700)]
Reinstate "PATCH: {perl #127582] Over eager warning for /[.foo.]/""
This reverts commit
ab9a4aa72166b26d6c3556107c19ba08ee956a88 which
itself reverted commit
a9149dfda17b511d34bb2af869948b677be52fbc, thus
reinstating the original. But this new commit also adds a check to
avoid going off the end of a buffer, the absence of which was the cause
for the failure of the original commit with address sanitizer.
Karl Williamson [Thu, 3 Mar 2016 16:14:13 +0000 (09:14 -0700)]
locale.c: Silence HP-UX compiler warning
Cast this flag value to a bool, which is what we want anyway here.
Jarkko Hietaniemi [Thu, 3 Mar 2016 14:01:05 +0000 (09:01 -0500)]
Warn of the "else syndrome".
Not that anyone ever reads perlport.
Jarkko Hietaniemi [Thu, 3 Mar 2016 13:57:32 +0000 (08:57 -0500)]
Clarify what AmigaOS version was broken by 5.8.0
Jarkko Hietaniemi [Thu, 3 Mar 2016 01:11:23 +0000 (20:11 -0500)]
perl5db.pl version bump
Jarkko Hietaniemi [Wed, 2 Mar 2016 23:49:18 +0000 (18:49 -0500)]
Defaulting to VMS is probably not right.
Andy Broad [Wed, 2 Mar 2016 23:45:52 +0000 (18:45 -0500)]
amigaos4: use CONSOLE:, not VMS sys$command
Andy Broad [Wed, 2 Mar 2016 23:43:44 +0000 (18:43 -0500)]
amigaos4: clean up older style / deprecated AmigaOS calls
Tony Cook [Wed, 2 Mar 2016 05:19:43 +0000 (16:19 +1100)]
reduce number of calls to add_cp_to_invlist()
Both S_get_ANYOF_cp_list_for_ssc() and S_put_charclass_bitmap_innards()
have tight loops that iterate over a bitmap and calls add_cp_to_invlist()
for each bit set.
add_cp_to_invlist() is a fairly wrapper around _add_range_to_invlist()
which create a new invlist to hold the range and then calls
_invlist_union() to perform the add. This is moderately expensive.
Instead of indirectly calling _add_range_to_invlist(), where it's
simple to do so, instead look for ranges of bits set in the bitmaps
and call _add_range_to_invlist() directly.
This changed the cachegrind output from running:
./perl -e 'qr/_?[\W_]/;'
from:
==23406== I refs: 1,752,149
==23406== I1 misses: 5,405
==23406== LLi misses: 3,588
==23406== I1 miss rate: 0.30%
==23406== LLi miss rate: 0.20%
==23406==
==23406== D refs: 683,242 (414,061 rd + 269,181 wr)
==23406== D1 misses: 13,370 ( 7,646 rd + 5,724 wr)
==23406== LLd misses: 7,025 ( 3,417 rd + 3,608 wr)
==23406== D1 miss rate: 1.9% ( 1.8% + 2.1% )
==23406== LLd miss rate: 1.0% ( 0.8% + 1.3% )
==23406==
==23406== LL refs: 18,775 ( 13,051 rd + 5,724 wr)
==23406== LL misses: 10,613 ( 7,005 rd + 3,608 wr)
==23406== LL miss rate: 0.4% ( 0.3% + 1.3% )
to:
==25041== I refs: 1,189,412
==25041== I1 misses: 5,218
==25041== LLi misses: 3,598
==25041== I1 miss rate: 0.43%
==25041== LLi miss rate: 0.30%
==25041==
==25041== D refs: 440,339 (283,047 rd + 157,292 wr)
==25041== D1 misses: 11,872 ( 7,257 rd + 4,615 wr)
==25041== LLd misses: 7,024 ( 3,417 rd + 3,607 wr)
==25041== D1 miss rate: 2.6% ( 2.5% + 2.9% )
==25041== LLd miss rate: 1.5% ( 1.2% + 2.2% )
==25041==
==25041== LL refs: 17,090 ( 12,475 rd + 4,615 wr)
==25041== LL misses: 10,622 ( 7,015 rd + 3,607 wr)
==25041== LL miss rate: 0.6% ( 0.4% + 2.2% )
ie. from 1.75 million instructions to 1.19 million instructions.
Karl Williamson [Wed, 2 Mar 2016 17:50:01 +0000 (10:50 -0700)]
PATCH: [perl #127599] Fix regcomp.c assertion
I added this assertion in
cfbef7dc3. It asserts that we have more to
parse. The code in this function is quite complicated, and assumes in a
number of places that there is more to parse. When we don't have more
to parse, 900 lines later, it throws an error. It may be that you can't
get to the places where it assumes there is more to parse if this
assertion is false (I don't remember now from my tedious audit of this
code), but even if so, it is fragile to assume so, given the large
distance to where the error is thrown. So throw the error right away
and avoid any existing or future breakage.
David Mitchell [Wed, 2 Mar 2016 17:29:31 +0000 (17:29 +0000)]
document args of Perl_do_sv_dump()
Jarkko Hietaniemi [Wed, 2 Mar 2016 00:56:04 +0000 (19:56 -0500)]
amigaos4: no sigaction, no si fields
David Mitchell [Wed, 2 Mar 2016 11:23:54 +0000 (11:23 +0000)]
pp_subst(): rename local var
make it clear that is_cow represents the original COW state (which may not
be the current state when checked later), by renaming it to was_cow.
David Mitchell [Wed, 2 Mar 2016 10:25:32 +0000 (10:25 +0000)]
pp_subst: fix typo
David Mitchell [Wed, 2 Mar 2016 10:23:43 +0000 (10:23 +0000)]
use cBOOL() in pp_subst()
Now that we have that macro, use it.
David Mitchell [Wed, 2 Mar 2016 09:16:34 +0000 (09:16 +0000)]
S_regmatch(): remove dead code
The 'sayNO'; follows a croak, so can never be reached.
David Mitchell [Wed, 2 Mar 2016 09:08:48 +0000 (09:08 +0000)]
remove some duplicate /* NOTREACHED */
In regexec.c there were several occurrences of
/* NOTREACHED */
NOT_REACHED; /* NOTREACHED */
where the first line isn't needed.
Karl Williamson [Wed, 2 Mar 2016 05:42:46 +0000 (22:42 -0700)]
Revert "PATCH: {perl #127582] Over eager warning for /[.foo.]/"
This reverts commit
a9149dfda17b511d34bb2af869948b677be52fbc.
This is causing failures in blead under clang, so I'm reverting it until
I can work out why.
Karl Williamson [Wed, 2 Mar 2016 05:41:59 +0000 (22:41 -0700)]
Revert "regcomp.c: White-space only"
This reverts commit
7511771ceb229ce97939f643c6de73c6b1a371be, so that
the next commit can be cleanly reverted
Tony Cook [Wed, 2 Mar 2016 04:52:06 +0000 (15:52 +1100)]
bump $strict::VERSION and $warnings::VERSION
Aristotle Pagaltzis [Wed, 2 Mar 2016 02:30:30 +0000 (03:30 +0100)]
narrow the filename check in strict.pm/warnings.pm
• The code previously assumed that any filename basename besides
`strict.pm` meant that the user mistyped `use strict` (e.g. as
`use Strict`). But that could just mean the file was not loaded
from the filesystem, e.g. due to naïve fatpacking.
This is fixed by adding a guard to check that an unexpected value
really is a mis-capitalised variant of `strict.pm`.
• The code previously insisted on either slash or backslash as the
directory separator, which is not strictly portable (though nobody
noticed in years; apparently nobody has tried to run a recent-ish
on a MacOS Classic or RiscOS system).
This is fixed by switching to \b as a best effort, to avoid going
down the rabbit hole of platform-specific separators.
• The code previously used an `unless` statement, declared lexical
variables inside its block, and used ${\EXPR} to interpolate the
__PACKAGE__ constant into the regexp. Each of these increases the
size of the optree, which is only ever executed once, then sticks
around wasting some hundred(s) bytes in almost every single Perl
program in the world.
This is fixed for warnings.pm by rewriting the code with no use of
any temporary variables and single-quoted strings instead of regexp
literals. In strict.pm, we can do even better by moving the code to
the BEGIN block, since BEGIN CVs are freed after running. (We do not
add one to warnings.pm since BEGIN blocks have a creation cost.)
Karl Williamson [Tue, 1 Mar 2016 22:19:49 +0000 (15:19 -0700)]
regcomp.c: Avoid an empty [] in -Dr output
Karl Williamson [Tue, 1 Mar 2016 18:26:49 +0000 (11:26 -0700)]
regcomp.c: White-space only
Outdent and reflow comments because the previous commit removed a
surrounding block.
Karl Williamson [Tue, 1 Mar 2016 18:03:04 +0000 (11:03 -0700)]
PATCH: {perl #127582] Over eager warning for /[.foo.]/
This fixes the issue by severely restricting what we recognize as the
interior of the [. .] and [= =] constructs, as suggested by Tony Cook.
I find the POSIX documentation very unclear, but it appears to me that
just about anything can be in the interior, and that is how I originally
wrote the code, and which led to this bug. But weird interiors would
only arise with really weird locales and only when the pattern is being
compiled under locale qr//l rules. A portable pattern would use the
restricted interior characters that this commit adopts.
Karl Williamson [Tue, 1 Mar 2016 20:07:45 +0000 (13:07 -0700)]
regexec.c: Fix failure to match problem
This bug has shown up only under EBCDIC so far, but could affect other
code.
Commit
dcf88e3433dcd5bc25811f9769e82d04c61a1d5a fixed a bug in which a
macro parameter needed to be dereferenced. Until then, the failure to
dereference meant some code that turned out to be faulty, was
effectively always skipped. So that commit, while correct in and of
itself, exposed a pre-existing bug.
It was hard for me to believe at first that a change of simply adding a
missing '*' could have broken things this way. But the clue was that
the only characters that were affected were the set of C1 controls, and
only when the target matched string was in UTF-8, and only on EBCDIC
systems. The difference between EBCDIC and ASCII platforms in this
regard is that the C1 controls under UTF-8 are represented by a single
byte on EBCDIC systems, and two bytes on ASCII. The test that adding
the dereference to is looking for characters that are single bytes under
both UTF-8 and not, and hence would give different results on EBCDIC and
ASCII platforms for exactly the set of C1 controls.
The code in question looks up an input code point to see if it is
matched by an ANYOF node, the kind generated for bracketed character
classes. The first N code points are stored in a bit vector. (N is
generally 256, but perl can be compiled to make that larger.) If there
are no complications, the answer can be found directly by just looking
up the code point in the vector. But if there are complications, a
function is called to sort them all out. The macro looks for
complications, and calls the function if needed, but does the lookup
directly if not. One of those complications is that the input needs to
be decoded to its actual code point value if the target is UTF-8 and the
code point isn't a single byte then. After the dereference fix, the
caller of the macro knew correctly that this was a single byte, and so
was calling the macro, But it turns out that the macro, as commented,
was expecting to be called only if the target was not-UTF-8, and so
unconditionally said to the function that it wasn't UTF-8, and so the
function didn't work properly.
The solution is to simply call the function in the macros with the
correct value of whether the target string is UTF-8 or not.
Karl Williamson [Tue, 1 Mar 2016 01:57:18 +0000 (18:57 -0700)]
embed.fnc: Fcn should have been within an #ifdef
Karl Williamson [Tue, 1 Mar 2016 01:39:20 +0000 (18:39 -0700)]
PATCH: [perl #127581] Spurious warning about posix class
Karl Williamson [Sun, 28 Feb 2016 16:53:09 +0000 (09:53 -0700)]
regcomp.c: revise comments, white-space
David Mitchell [Tue, 1 Mar 2016 16:04:36 +0000 (16:04 +0000)]
installman: don't warn about missing pod
Currently it spits out about 80 lines like the following to stderr:
no documentation in lib/Archive/Tar/Constant.pm
no documentation in lib/CPAN/Author.pm
no documentation in lib/CPAN/Bundle.pm
Since this is not actually an error condition, spit to stdout instead,
and only under --verbose.
See http://nntp.perl.org/group/perl.perl5.porters/234436.
Craig A. Berry [Sat, 13 Feb 2016 14:12:01 +0000 (09:12 -0500)]
VMS patch for duplicate env entries
Tony Cook [Wed, 27 Jan 2016 00:52:15 +0000 (11:52 +1100)]
remove duplicate environment variables from environ
If we see duplicate environment variables while iterating over
environ[]:
a) make sure we use the same value in %ENV that getenv() returns.
Previously on a duplicate, %ENV would have the last entry for the name
from environ[], but a typical getenv() would return the first entry.
Rather than assuming all getenv() implementations return the first entry
explicitly call getenv() to ensure they agree.
b) remove duplicate entries from environ
Previously if there was a duplicate definition for a name in environ[]
setting that name in %ENV could result in an unsafe value being passed
to a child process, so ensure environ[] has no duplicates.
CVE-2016-2381
Karl Williamson [Tue, 1 Mar 2016 04:12:59 +0000 (21:12 -0700)]
perldelta: Fix typo
Spotted by Andrew Rodland
Karl Williamson [Tue, 1 Mar 2016 04:12:59 +0000 (21:12 -0700)]
re/regexp_unicode_prop.t: Fix loop statement
This was doing an extra shift, which doesn't matter currently because
there's only one element in the array, but could cause future problems.
Karl Williamson [Tue, 1 Mar 2016 04:12:12 +0000 (21:12 -0700)]
regexp_unicode_prop.t: Clarify comment
Karl Williamson [Mon, 15 Feb 2016 18:25:35 +0000 (11:25 -0700)]
Fix /\p{pkg::User-defined}/i
Prior to this commit, the parsing code got confused if a user-defined
property whose definition was not known at pattern compilation time, was
specified with an explicit package name, under /i.
Tony Cook [Mon, 29 Feb 2016 23:41:46 +0000 (10:41 +1100)]
[perl #127635] s///r with -DPERL_NO_COW attempts to modify source SV
based on work done by bulk88, per his notes below:
I found pp_subst with a -DPERL_NO_COW build on an experimental perl branch
would die in ../dist/SelfLoader/t/03taint.t in this line
"my $file = __FILE__ =~ s/[\w.]+\z/01SelfLoader.t/r;" with a attempt to
modify since sv_force_normal_flags checks for readonlyness. The
-DPERL_NO_COW exclusive logic seems faulty, since the COW branch right
above stores the cow status and doesn't call sv_force_normal_flags until
it actually wants to modify the source SV, and pp_subst wont modify the
source SV if PMf_NONDESTRUCT is on.
So fix the die by only de-COWing if !PMf_NONDESTRUCT. Do not deCOW the
source SV if PMf_NONDESTRUCT. The
"my $file = __FILE__ =~ s/[\w.]+\z/01SelfLoader.t/r;" fatal die can not be
reproduced in blead perl with -DPERL_NO_COW, only in my experimental branch
so I rewrote the test to use a const sub that is folded to a
HEK COW RO SV * instead of the __FILE__ token which is not a HEK COW on
blead perl. The subst.t test only fails if perl is compiled with
-DPERL_NO_COW. To avoid an extra !(rpm->op_pmflags & PMf_NONDESTRUCT) check
on a NO_COW build, restructure the logic so
!(rpm->op_pmflags & PMf_NONDESTRUCT) is tested only once. Filed as
[perl #127635].
Jarkko Hietaniemi [Mon, 29 Feb 2016 13:47:54 +0000 (08:47 -0500)]
Scalar-List-Utils customization bump
Jarkko Hietaniemi [Mon, 29 Feb 2016 13:43:51 +0000 (08:43 -0500)]
Scalar-List-Utils version bump
Jarkko Hietaniemi [Mon, 29 Feb 2016 13:39:02 +0000 (08:39 -0500)]
product() with zero IV crash/hang
CID 104785: Division or modulo by zero (DIVIDE_BY_ZERO)
238. divide_by_zero: In expression 9223372036854775807L / retiv, division by expression retiv which may be zero has undefined behavior.
215 if(!SvNOK(sv) && SvIOK(sv) && (SvIV(sv) < IV_MAX / retiv)) {
Cherry-pick of the changes in
https://rt.cpan.org/Public/Bug/Display.html?id=105415
Jarkko Hietaniemi [Mon, 29 Feb 2016 12:16:59 +0000 (07:16 -0500)]
Socket customization bump
Jarkko Hietaniemi [Mon, 29 Feb 2016 12:15:08 +0000 (07:15 -0500)]
Socket version bump
Jarkko Hietaniemi [Mon, 29 Feb 2016 11:50:58 +0000 (06:50 -0500)]
Check for max length before derefing by length.
Coverity CID 135025 (#1 of 1): Out-of-bounds read (OVERRUN)
29. overrun-local: Overrunning array addr.sun_path of 108 bytes at byte offset 108 using index addr_len (which evaluates to 108).
864 for (addr_len = 0; addr.sun_path[addr_len]
28. incr: Incrementing addr_len. The value of addr_len may now be up to 108.
865 && addr_len < maxlen; addr_len++);
Reported upstream as
https://rt.cpan.org/Ticket/Display.html?id=111707
Daniel Dragan [Mon, 29 Feb 2016 03:44:18 +0000 (22:44 -0500)]
teach makedef.pl an alternate macro for PERL_COPY_ON_WRITE
otherwise a -DPERL_NO_COW perl win32 build fails during linking perl523.dll
with missing Perl_sv_setsv_cow
Lukas Mai [Sun, 28 Feb 2016 22:10:50 +0000 (23:10 +0100)]
perlport: use italics instead of colon in "don't":s (RT #127627)
Dagfinn Ilmari Mannsåker [Mon, 29 Feb 2016 13:55:41 +0000 (13:55 +0000)]
Improve wording of perldelta entry for
ae146f5496e
Alex Vandiver [Mon, 23 Mar 2015 03:44:11 +0000 (23:44 -0400)]
Adjust callsites that use UTF8SKIP without checking UTF
Assuming UTF-8 semantics and advancing character-by-character when 'use
utf8' is not enabled is not as problematic as the inverse. However,
properly UTF8SKIP should only be used when UTF8 semantics are explicitly
asked for.
Change the three occurrences of UTF8SKIP that are not protected by UTF
checks.
Tony Cook [Sun, 28 Feb 2016 22:59:16 +0000 (09:59 +1100)]
perldelta for
ae146f5496e
Daniel Dragan [Sun, 28 Feb 2016 22:52:56 +0000 (09:52 +1100)]
[perl #127584] using Win32 32b gmake with 64b gcc caused wrong archname
Using a 32 bit Win32 gmake, with a GCC that produces 64 bit binaries, made
a perl with PTRSIZE 64 bits, and 64 bit machine code, but archname IDed
that build as "x86" not "x64", which is very wrong. Perl's
win32/GNUMakefile autodetects the bitness of the GCC and sets things up
accordingly. Fixes [perl #127584]. This bug might be a regression
introduced in commit
745dedb9b5 or the GNUMakefile parallel build branch.
Jarkko Hietaniemi [Sun, 28 Feb 2016 22:35:33 +0000 (17:35 -0500)]
Upgrade to IPC-SysV 2.06.
Fixing an oopsie of yours truly from 2.05.
Daniel Dragan [Fri, 26 Feb 2016 20:35:28 +0000 (15:35 -0500)]
static funcs in HiRes.xs
Less indirection on ELF.
Chris 'BinGOs' Williams [Sun, 28 Feb 2016 15:53:56 +0000 (15:53 +0000)]
[perl #127624] corelist: wrong Digest::SHA version in 5.18.4
A bit of sleuthing showed that it was actually version bumped for
the v5.18.3 release.
Also noticed that Config hadn't been updated as well, sorted that
out too.
Karl Williamson [Sat, 27 Feb 2016 22:07:09 +0000 (15:07 -0700)]
regcomp.c: Use less peak memory
This continues the process started in
accb4364d92e26c20e6a538fc04d1af52a8b94e2 of lowering memory use by not
creating unnecessary mortal SVs.
This changes the inversion union and intersection functions to avoid
entirely the creation of new mortals.
Karl Williamson [Sat, 27 Feb 2016 22:05:09 +0000 (15:05 -0700)]
regcomp.c: Modify an assert
This newly-added assert could fail, but hasn't so far. Fix it.
Karl Williamson [Sat, 27 Feb 2016 22:01:43 +0000 (15:01 -0700)]
regcomp.c: Avoid an unnecessary mortal SV
In some paths, an SV was created mortal, and immediately thrown away.
Karl Williamson [Sat, 27 Feb 2016 21:59:47 +0000 (14:59 -0700)]
regcomp.c: Improve free-ing up unused inversion list space
The invlist_trim() function wasn't freeing up space if the new space
needed was small. This now frees up all but the required minimum.
Karl Williamson [Sat, 27 Feb 2016 20:54:51 +0000 (13:54 -0700)]
regcomp.c: Add new static inline convenience function
Karl Williamson [Wed, 24 Feb 2016 17:06:34 +0000 (10:06 -0700)]
regcomp.c: Change variable names, white-space
A future commit will make more sense if these names are changed. This
reindents some code so that it doesn't overflow 79 columns
Karl Williamson [Sat, 27 Feb 2016 19:36:37 +0000 (12:36 -0700)]
regcomp.c: Change name of static function
I found myself using this function, forgetting that it zapped one of the
parameters, so change the name so that can't be forgotten.
Lukas Mai [Sat, 27 Feb 2016 04:17:57 +0000 (05:17 +0100)]
perlfunc overhaul
- remove trailing whitespace
- consistently refer to builtins as C<foo>, not foo() or C<foo()>
- hyperlink each C<foo> builtin to its section in perlfunc
- replace some occurrences of -w with a reference to the warnings pragma
- refer to listy comma as "list concatenation" because that's what it
does
- consistently hyperlink references to external programs (L<touch(1)>),
system calls (L<fork(2)>), and library functions (L<fdopen(3)>)
- hyperlink variables to their section in perlvar
- hyperlink the names of modules/pragmas
- hyperlink names of functions provided by modules (where possible)
- consistently use "pragmas", not "pragmata" (there were only two of
those)
- use the same wording for all conditional builtins / features
- -T and -B are file tests, not switches
- remove "see L</open>" (regarding the ':encoding' layer) from
description of binmode because I don't see why it was there
- refer to variables as C<$foo>, not $foo
- hyperlink some error messages to perldiag
- remove & from subroutine calls
- grammar: write "if X, Y" with a comma and "Y if X" without
- use 'my' in examples when introducing new variables
- 'while (', not 'while('
- don't capitalize the next word after a semicolon
- consistently start error messages (die/warn) with "Can't" (not
"can't", "Cannot", or "cannot")
- replace bareword filehandles by normal variables in examples
- add missing ')'
- fix module names: IPC::SysV::Msg -> IPC::Msg, IPC::SysV::Semaphore ->
IPC::Semaphore
- 'open': replace note about binmode with equivalent paragraph from
'binmode' (the one in 'open' claimed unix systems don't need binmode,
which is not true with encodings)
- 'open': delete overly clever example of generating filehandle names in
a recursive function (this is a non-issue with lexical filehandles)
- 'open': instead of running 'perl -V' and looking for the useperlio
line, you can just run 'perl -V:useperlio'
- 'open': mention shell feature of 'yourscript.pl <( other command )',
which makes the only remaining use of 2-arg open redundant
- 'open': sysopen uses different modes than open; they're not "subtly
different" and there's no "may" about it
- 'open': use $fh->autoflush(1) instead of select/$| dance (especially
since the example already loads IO::Handle for no reason)
- 'printf': remove garbled text ("Look for this throught pod")
- change "use locale 'not_characters'" to the correct "use locale
':not_characters'"
- (hopefully) fix inconsistent use of "real filehandle"; use "bareword
filehandle" instead to distinguish from scalar variables / globrefs
- ":encoding" is a layer, not a pragma
- 'readline': actually use readline in examples
- ?...? is no longer valid; use m?...? instead
- 'sort': whether the algorithm is stable has no effect on runtime
complexity, so "That algorithm was not stable, so I<could> go
quadratic" is nonsense
- 'sort': declaring $a/$b as lexicals is an error regardless of strict
- 'sysopen': as far as I can tell the note about depending on fdopen()
is only true for non-PerlIO builds
- 'use': add an example of what 'use Module VERSION' expands to
- add 'select FILEHANDLE' to filehandle related functions
Also touch ext/Pod-Functions/Functions_pm.PL to make it parse
L<C<foo>|...> in the overview paragraphs.
And teach t/porting/podcheck.t about a ton of man pages and some
external modules.
Karl Williamson [Fri, 26 Feb 2016 23:41:11 +0000 (16:41 -0700)]
regcomp.c: Add missing 'STATIC'
Karl Williamson [Fri, 26 Feb 2016 20:57:10 +0000 (13:57 -0700)]
Fix regex failures on big-endian systems
Commit
accb4364d92e26c20e6a538fc04d1af52a8b94e2 caused regexes to fail
on big-endian systems. It was because I used SvCUR where I should have
been using SvLEN, and was overwriting the final byte of real data with
0, which didn't matter as long as that byte was 0, which in our smokes
on litlle-endian systems, it was.
Further clarification is that inversion lists are stored as UV*, whereas
the scalar handling code is expecting char*. By casting, it all works
out, except that the final byte is kept as a single char NUL. I was
trying to write that final byte as a byte, but by using SvCUR, I was
getting a byte in one of the UVs. With small numbers on a little-endian
system, that byte will be 0 anyway, but not on a big-endian one.
Lukas Mai [Wed, 24 Feb 2016 23:59:41 +0000 (00:59 +0100)]
perlvar: hyperlink from $^D to perlrun/-D
Lukas Mai [Thu, 25 Feb 2016 02:48:48 +0000 (03:48 +0100)]
podcheck.t: expand POD sequences in L</...> section names
Matthew Horsfall [Wed, 24 Feb 2016 20:06:38 +0000 (15:06 -0500)]
Fix perldoc -f sleep to use $SIG{ALRM} instead of $SIG{ALARM}.
Karl Williamson [Tue, 23 Feb 2016 21:04:19 +0000 (14:04 -0700)]
Use less memory in compiling regexes
This is at least a partial patch for [perl #127392], cutting the maximum
memory used on my box from around 8600kB to 7800kB. For [perl #127568],
which has been merged into #127392, the savings are even larger, about
37%
Previously a large number of large mortal SVs could be created while
compiling a single regex pattern, and their accumulated memory quickly
added up. This changes things to not use so many mortals.
Karl Williamson [Tue, 23 Feb 2016 21:00:23 +0000 (14:00 -0700)]
regcomp.c: Guard against corrupting inversion list SV
I don't know of any cases where this happens, but in working on the next
commit I triggered a problem with shrinking an inversion list so much
that the required 0 UV at the beginning was freed.
Daniel Dragan [Sun, 21 Feb 2016 17:28:14 +0000 (12:28 -0500)]
silence warning in Win32CORE
Win32CORE.c: In function ‘boot_Win32CORE’:
../../XSUB.h:127:43: warning: unused parameter ‘cv’ [-Wunused-parameter]