This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Karl Williamson [Tue, 10 Jan 2017 17:31:29 +0000 (10:31 -0700)]
re.pm: pod formatting nits, and clarifications
Karl Williamson [Fri, 6 Jan 2017 05:03:35 +0000 (22:03 -0700)]
Warn on unescaped /[]}]/ under re strict
This commit generates a warning when the experimental 're strict'
feature is in effect for unescaped '}' and ']' characters (in a regular
expression pattern) that are interpreted literally.
This brings the behavior of these more in line with ')' which croaks
when it is taken literally.
The problem with the existing behavior is that these characters may be
metacharacters or they may be literals, depending on action at a
distance. Not so with ')', which is always a metacharacter unless
escaped.
Ideally, all three of these characters should behave similarly, but it
really is too late for that, except we can warn if the user has
requested extra checking of their patterns with this experimental
're strict' feature.
Karl Williamson [Fri, 6 Jan 2017 04:51:12 +0000 (21:51 -0700)]
t/re/reg_mesg.t: Add new ability
This now allows one to say that a warning message is to be expected if
and only if 'use re "strict"' is on.
Karl Williamson [Tue, 10 Jan 2017 18:09:33 +0000 (11:09 -0700)]
Various .t's: Escape literal '}' and ']' in patterns
It is clearer to show that these characters which are sometimes meta and
sometimes literal are meant to be taken literally here.
Karl Williamson [Fri, 6 Jan 2017 02:28:38 +0000 (19:28 -0700)]
regcomp.c: Clarify comment.
Karl Williamson [Thu, 12 Jan 2017 18:07:47 +0000 (11:07 -0700)]
Add /xx regex pattern modifier
This was first proposed in the thread starting at
http://www.nntp.perl.org/group/perl.perl5.porters/2014/09/msg219394.html
Karl Williamson [Fri, 13 Jan 2017 18:17:25 +0000 (11:17 -0700)]
perlre: Clarifications, typos
Karl Williamson [Wed, 11 Jan 2017 02:10:58 +0000 (19:10 -0700)]
perlretut: Add some white space for legibility
Karl Williamson [Thu, 12 Jan 2017 05:18:53 +0000 (22:18 -0700)]
regcomp.c: Remove obsolete data structure element
This was used for the removed feature of having the source in a
different encoding.
Karl Williamson [Fri, 13 Jan 2017 04:05:35 +0000 (21:05 -0700)]
pp_sys.c: White space only
Vertically align some components of an 'if' for readability.
James E Keenan [Thu, 12 Jan 2017 22:15:30 +0000 (17:15 -0500)]
Write tests for RT #77934.
Assistance with test provided by Jerry Hedden.
Karl Williamson [Wed, 11 Jan 2017 21:21:16 +0000 (14:21 -0700)]
Rmv unused regex implementation structure element
Karl Williamson [Mon, 9 Jan 2017 22:40:54 +0000 (15:40 -0700)]
PATCH: [perl #130530]: HP-UX assertion failure
This was introduced in
a1a5ec35e6a3df0994b103aadb28a8c1a3a278da, and was
due to a thinko on my part. Zefram figured it out.
A macro evaluating to a string constant returns an instance of that
constant. Compilers are free to collapse all instances into a single
one (which saves space), or to have multiple copies. The code was
assuming the former, and HP-UX cc doesn't.
The passed size also was one byte larger than it should have been.
Hugo van der Sanden [Mon, 9 Jan 2017 16:46:11 +0000 (16:46 +0000)]
[perl #130522] test cases for len(STCLASS) > len(target)
Hugo van der Sanden [Sun, 8 Jan 2017 14:59:36 +0000 (14:59 +0000)]
[perl #130522] don't try to find_by_class outside the string
If the calculated latest start position to try is before our current
start position, stop immediately: else we can read out of bounds,
and end up doing unnecessary work.
Hugo van der Sanden [Sun, 8 Jan 2017 14:54:57 +0000 (14:54 +0000)]
[perl #130522] do not allow endpos to exceed strend
Check substrings can come from lookaheads, so their length can exceed
minlen. Use a clamped variant of HOP3c to avoid a bad endpos in this case.
Tomasz Konojacki [Tue, 10 Jan 2017 02:47:51 +0000 (03:47 +0100)]
(perl #130534) fix test failures under DragonFly BSD
Karl Williamson [Tue, 10 Jan 2017 19:34:52 +0000 (12:34 -0700)]
Add Tomasz Konojacki to AUTHORS
Karl Williamson [Tue, 10 Jan 2017 18:38:34 +0000 (11:38 -0700)]
t/loc_tools.pl: Quit immediately if incompat locale
The design of this was to not continue when presented with a locale that
we have discovered is incompatible with Perl. Instead it was soldiering
on. Those incompatibilities could cause segfaults, etc if the libc
isn't fully protected against unexpected input.
Karl Williamson [Tue, 10 Jan 2017 18:35:05 +0000 (11:35 -0700)]
t/loc_tools.pl: Allow for multiple warnings
This code searched the first warning for particular patterns. It really
should search all warnings for complete correctness.
Karl Williamson [Tue, 10 Jan 2017 18:33:32 +0000 (11:33 -0700)]
t/loc_tools.pl: Emphasize input conditions in comment
Karl Williamson [Tue, 10 Jan 2017 18:32:53 +0000 (11:32 -0700)]
locale.c: Fix typo in comment
Karl Williamson [Tue, 10 Jan 2017 18:31:01 +0000 (11:31 -0700)]
locale.c: -DL shouldn't affect other things
Prior to this commit, -DL would cause a message to be suppressed
elsewhere. Code could be relying on that message being output in the
expected place.
Tony Cook [Mon, 9 Jan 2017 00:09:50 +0000 (11:09 +1100)]
perldelta for
95309d6ba0f3
Tony Cook [Thu, 8 Dec 2016 03:14:11 +0000 (14:14 +1100)]
add build options to disable the PERL_HASH* and PERL_PERTURB_KEYS env vars
These variables either control or reveal information used in perl's
hash implementation that a careful user may not want controlled or
exposed.
Karl Williamson [Sun, 8 Jan 2017 17:41:56 +0000 (10:41 -0700)]
perlpodspec: Note Pod::Simple instead of Pod::Parser
Pod::Parser is on its way out from core. This changes the text to
correspond.
Hugo van der Sanden [Sat, 7 Jan 2017 01:27:50 +0000 (01:27 +0000)]
[perl #130495] add fresh_perl() option for prog with embedded utf8
Support { wide_chars => 1 } in the args hash to fresh_perl*() functions,
and use it for the recently added test in re/pat.t
Aaron Crane [Sat, 7 Jan 2017 15:32:46 +0000 (15:32 +0000)]
Improve perlintern.pod docs for PL_dowarn
Aaron Crane [Sat, 7 Jan 2017 13:57:05 +0000 (13:57 +0000)]
Fix save-stack type error
Peter Avalos [Sat, 7 Jan 2017 14:32:08 +0000 (14:32 +0000)]
add setproctitle() support for DragonFly BSD
RT #130068
(applied untested, as I don't have access to a dragonfly box - DAPM)
David Mitchell [Sat, 7 Jan 2017 14:12:05 +0000 (14:12 +0000)]
fix some comment typos about PL_isa_DOES
... and expand one of the comments a bit.
Aaron Crane [Fri, 6 Jan 2017 17:03:21 +0000 (17:03 +0000)]
cflags.SH: omit a needless process in generated file
Using the shell "case" statement rather than grep(1) will save a process on
every core C file compiled.
David Mitchell [Sat, 7 Jan 2017 10:09:28 +0000 (10:09 +0000)]
t/perf/optree.t: remove obsolete comment
with commit v5.25.8-172-gb243b19, I removed some special-casing of the A
in (A&&B) being in boolean context, but forgot to remove a comment
describing this special-casing.
James E Keenan [Fri, 6 Jan 2017 22:56:50 +0000 (17:56 -0500)]
Eliminate two unused variables detected by clang.
"warning: unused variable 'i' [-Wunused-variable]"
David Mitchell [Fri, 6 Jan 2017 16:28:50 +0000 (16:28 +0000)]
[MERGE] redo boolean context
Overhaul the stuff that flags an op as being in boolean context (currently
just padhv and rv2hv). Make the mechanism in rpeep() general, so that
other ops can be easily added in future, and add a generic testing
framework for such ops in t/perf/optree.t.
This alters the amount on situations recognised as being in boolean
context (mainly increasing them).
David Mitchell [Fri, 6 Jan 2017 11:35:11 +0000 (11:35 +0000)]
In A && B, stop special-casing boolean-ness of A
Some ops, (currently PADHV and RV2HV) can be flagged as being in boolean
context, and if so, may return a simple truth value which may be more
efficient to calculate than a full scalar value. (This was originally
motivated by code like if (%h) {...}, where the scalar context %h returned a
bucket ratio string, which involved counting how many HvARRAY buckets were
non-empty, which was slow in large hashes. It's been made less important
since %h in scalar context now just returns a key count, which is quick to
calculate.)
There is an issue with the A argument of A||B, A//B and A&&B, in that,
although A checked by the logop in boolean context, depending on its
truth value the original A may be passed through to the next op. So in
something like $x = (%h || -1), it's not sufficient for %h to return a
truth value; it must return a full scalar value which may get assigned to
$x.
So in general, we only mark the A op as being in boolean context if the
logop is in void context, or if the returned A would only be consumed in
boolean context; so !(A||B) would be ok for example.
However, && is a special case of this, since it will return the original A
only if A was false. Before this commit, && was special-cased to mark A as
being in boolean context regardless of the context of (A&&B). The downside
of this is that the A op can't just return &PL_sv_no as a false value;
it has to return something that is usable in scalar context too. For
example with %h, it returns sv_2mortal(newSViv(0))), which stringifies to
"0" while &PL_sv_no stringifies to "".
This commit removes that special case and makes && behave like || and //
again.
The upside is that some ops in boolean context will be able to more
cheaply return a false value (e.g. just &PL_sv_no verses
sv_2mortal(newSViv(0))).
The main downside is that && in unknown context (typically an
'if (%h} {...}' as the last statement in a sub) will have to check at
runtime whether the caller context is slower. It will also have to return
a scalar value for something like $y = (%h && $x), but that's a relatively
uncommon occurrence, and now that %h in scalar context doesn't have to
count used buckets, the extra cost in these rare cases is minor.
David Mitchell [Wed, 4 Jan 2017 23:50:14 +0000 (23:50 +0000)]
add xor, grep, flip, flop to boolean cxt detection
The code that detects whether certain ops (currently just PADHV and RV2HV)
are called in boolean context only recognises a few ops as providing
boolean context: NOT, OR, DOR, AND, COND_EXPR.
This commit expands this by adding GREPWHILE, FLIP, FLOP, XOR too (in the
case of XOR it only applies to the RHS arg - the LHS is not simple to
detect).
This means that in something like
@AofH_nonempty = grep %$_, @AofH
the test for each hash being non-empty will now be done in boolean rather
than full scalar context, so may be faster.
Similarly (although less excitingly) these hash key counts are also
boolean now:
%hash .. $other;
$other .. %hash;
$other xor %hash;
(I basically did a grep for 'SvTRUE' in pp*.c to see what other ops might
be imposing boolean context.)
Since this has been added to the general boolean context detection
mechanism, it will also apply for any future ops with are 'booleanised'.
David Mitchell [Wed, 4 Jan 2017 21:22:21 +0000 (21:22 +0000)]
reindent block in rpeep()
(whitespace-only change)
The code for the case OP_PADAV/OP_PADSV was too far left.
David Mitchell [Wed, 4 Jan 2017 20:27:55 +0000 (20:27 +0000)]
re-implement boolean context detection
When certain ops are used in a boolean context (currently just PADHV and
RV2SV, implementing '%hash'), one of the private flags OPpTRUEBOOL or
OPpMAYBE_TRUEBOOL is set on the op to indicate this; at
runtime, the pp function can then just return a boolean value rather than
a full scalar value (in the case of %hash, an element count).
However, the code which sets these flags has had a complex history, and is
a bit messy. It also sets the flags incorrectly (but safely) in many
cases: principally indicating boolean context when it's in fact void, or
scalar context when it's in fact boolean. Both these permutations make the
code potentially slower (but still correct).
[ As a side-note: in 5.25, a bare %hash in scalar context changed from
returning a bucket count etc, to just returning a key count, which is
quicker to calculate. So the boolean optimisation for %hash is not nearly
as important now: it's now just the overhead of creating a temp to return
a count verses returning &PL_sv_yes, rather than counting keys. However
the improved and generalised boolean context detection added by this
commit will be useful in future to apply boolean context to other ops. ]
In particular, this wasn't being optimised (i.e. a 'not' of a hash within
an if):
if (!%hash) { ...}
This commit fixes all these cases (and uncomments a load of failing tests
in t/perf/optree.t which were added in the previous commit.)
It makes the code below nearly 3 times faster:
my $c; my %h = 1..10;
for my $i (1..10_000_000) { if (!%h) { $c++ }; }
It restructures the relevant code in rpeep() so that rather than switching
on logops like OP_OR, then seeing if that op is preceded by PADHV/RV2HV,
it instead switches on PADHV/RV2HV then sees if succeeding ops impose
boolean context on that op - that is to say, in all possible execution
paths after the PADHV/RV2HV pushes a scalar onto the stack, will that
scalar only ever be used for a boolean test? (*).
The scanning of succeeding ops is extracted out into a static function.
This will make it very easy in future to apply boolean context to other
ops too, or to expand the definition of boolean context (e.g. adding
'xor').
(*) Although in theory an expression like (A && B) can return A if A is
false, if A happens to be %hash, and as long as pp_padhv() etc return
a boolean false value that is also usable in scalar context (so it returns
0 rather than PL_sv_no), then we can pretend that OP_AND's LH arg is
never used as a scalar.
David Mitchell [Wed, 4 Jan 2017 19:07:46 +0000 (19:07 +0000)]
add testing framework for boolean context
Some ops (currently just padhv and rv2hv) are optimised when found to be
in boolean context - by setting a private flag on the op indicating
definite or maybe boolean context. At run time, the op can just return
true / false rather than a real value, which may be cheaper.
This commit adds a bunch of tests in nested loops to optree.t to check
that the right private flags are set for the various permutations of
if (%h || $x) { ...}
etc.
It's written in such a way that its easy to add new ops to it.
At the moment many permutations are actually commented out, as these
(fairly comprehensive) tests show up a number of deficiencies in the
current implementation. These should be fixed in the next commit.
David Mitchell [Wed, 4 Jan 2017 09:16:51 +0000 (09:16 +0000)]
t/perf/optree.t: add use warnings, strict
James E Keenan [Fri, 6 Jan 2017 12:48:21 +0000 (07:48 -0500)]
Removed unused CHR_DIST macro from a second file (RT 130519).
Andy Lester [Sun, 27 Nov 2016 04:46:13 +0000 (22:46 -0600)]
Removed unused CHR_DIST macros
Aaron Crane [Sun, 20 Nov 2016 14:18:22 +0000 (14:18 +0000)]
Fix the Unicode Bug in the range operator
Karl Williamson [Thu, 5 Jan 2017 05:41:53 +0000 (22:41 -0700)]
regcomp.c: Use memEQ instead of looping an element at a time
Karl Williamson [Thu, 5 Jan 2017 05:25:15 +0000 (22:25 -0700)]
perlapi: Add clarification for SvGROW()
Karl Williamson [Thu, 5 Jan 2017 05:18:24 +0000 (22:18 -0700)]
toke.c: Make too-long inline function just static
This function is too long to be effectively inlined, so don't request
the compiler to do so.
Karl Williamson [Thu, 5 Jan 2017 05:16:08 +0000 (22:16 -0700)]
utf8.c: Add a const to a function parameter
Tony Cook [Thu, 5 Jan 2017 00:04:05 +0000 (11:04 +1100)]
Tony Cook [Wed, 4 Jan 2017 23:39:44 +0000 (10:39 +1100)]
Various fixes for dtrace builds on FreeBSD and for other platforms
(to a lesser extent)
Tony Cook [Mon, 28 Nov 2016 04:15:18 +0000 (15:15 +1100)]
(perl #130108) check if dtrace accepts -xnolibs and use it if available
dtrace without -xnolibs fails in a FreeBSD jail, so we need to supply
it on FreeBSD.
Unfortunately systemtap's dtrace emulation doesn't support -xnolibs so
we need to test if it's available.
Tony Cook [Mon, 28 Nov 2016 04:19:12 +0000 (15:19 +1100)]
(perl #130108) separate compiled objects from dtrace modified objects
When generating an object file with "dtrace -G", dtrace also modifies
the input object files.
This causes two problems:
1) Since the objects are modified, their modification times are updated
which may break dependency checks by make.
2) on FreeBSD at least, once the object has been processed it can't be
processed again by dtrace -G
Tony Cook [Mon, 28 Nov 2016 04:22:16 +0000 (15:22 +1100)]
(perl #130108) add elf to libswanted on FreeBSD 10.x
usedtrace builds add references to libelf symbols, causing link
failures without it.
at hints time we don't know if the user will interactively select
dtrace and there's no CBU, so it's added unconditionally on 10.x
Tony Cook [Thu, 17 Nov 2016 11:18:30 +0000 (22:18 +1100)]
(perl #130108) generate a dummy dtrace_main.o if perlmain.o doesn't contain probes
efc4bddfd4 added generating a probes object file for perlmain.o, since
the compiler was generating probes even for unused inline functions.
The default compiler on FreeBSD 11 however doesn't generate probes for
these unused inline functions, and dtrace -G fails because it can't
find any.
So if dtrace fails for perlmain.o generate a dummy object file to
take its place.
Similarly for XS::APItest.
Aaron Crane [Wed, 4 Jan 2017 20:02:45 +0000 (20:02 +0000)]
RT#130496: assertion failure for '{}->$x' on undefined $x
Karl Williamson [Mon, 2 Jan 2017 22:58:23 +0000 (15:58 -0700)]
APItest/t/handy.t: Skip locale tests when not in locale
In XS code, the macros that pay attention to locale don't check if they
are being called from within the scope of 'use locale'; they assume that
the code calling them wouldn't be doing so unless appropriate. That's
not true of Perl-level code. I forgot that when writing these tests.
Normally it doesn't show up as a problem as the underlying locale is the
C locale, which on almost all platforms has the effect of not being in a
locale. But the VMS C locale is special, and so doesn't meet the
assumptions of these tests. The solution is to skip locale-aware macros
unless we are testing locale.
Andy Lester [Sat, 24 Dec 2016 05:53:19 +0000 (23:53 -0600)]
Remove unnecessary pointer math.
James E Keenan [Wed, 4 Jan 2017 18:17:19 +0000 (18:17 +0000)]
RT#113960: perl5db should ignore /dev/tty on non-Unix systems
If a Win32 system happens to have a \dev\tty file at the root of the current
drive, we were incorrectly treating that as an indicator that the system is
in fact Unix-like.
Fix this by looking at the filesystem for that file only after considering
all the OS platforms that we know aren't Unix-like in that way.
Aaron Crane [Wed, 4 Jan 2017 15:42:32 +0000 (15:42 +0000)]
RT#130487: fix stack-management bug in Data::Dumper
This was introduced when Data::Dumper acquired the ability to call
B::Deparse from its XS implementation.
Hugo van der Sanden [Wed, 4 Jan 2017 14:52:21 +0000 (14:52 +0000)]
[perl #130495] /x comment skipping stops a byte short
If that byte was part of a utf-8 character, this caused inappropriate
"malformed utf8" warnings or assertions.
In principle this should also skip the newline, but failing to do so
is safe.
James E Keenan [Fri, 27 May 2016 00:29:14 +0000 (20:29 -0400)]
Place discussion of postfix under DESCRIPTION.
Make subheadings more consistent. Say what the WARNING is about.
For: RT #128250, based on suggestions by Father Chrysostomos.
Karl Williamson [Wed, 28 Dec 2016 04:25:39 +0000 (21:25 -0700)]
toke.c: Clarify comment
Karl Williamson [Wed, 28 Dec 2016 04:15:43 +0000 (21:15 -0700)]
toke.c: Keep better track for avoiding work in tr///
As explained in the comments, tr/// creates byte map tables for bytes
0-255 if everything is below 256. If something is higher than that,
special handling is required (currently a swash), and so there is no
point in creating the tables here by expanding each range. Prior to
this commit, it realized this on a per-range basis, not expanding ranges
which extend above 255. This commit changes that so if any time it
finds something above 255, it remembers that and skips the expansion of
all future ranges encountered.
This was done without adding any extra tests outside the specific tr///
code.
Karl Williamson [Wed, 28 Dec 2016 04:20:13 +0000 (21:20 -0700)]
toke.c: Fix comment that said the opposite of what was meant
Karl Williamson [Wed, 28 Dec 2016 03:55:13 +0000 (20:55 -0700)]
toke.c: Simplify expression
Unless there's a reason its needed, I prefer not to set a variable
within an 'if', as it increases the reader's cognitive load.
Karl Williamson [Wed, 28 Dec 2016 03:52:20 +0000 (20:52 -0700)]
SV_UTF8_NO_ENCODING is no longer used
It once had meaning under 'use encoding';
Karl Williamson [Fri, 19 Aug 2016 03:41:08 +0000 (21:41 -0600)]
toke.c: White-space only
Indent after previous commit added new blocks, and a couple other white
space adjustments
Karl Williamson [Fri, 19 Aug 2016 00:54:13 +0000 (18:54 -0600)]
toke.c: Potentially avoid work when converting to UTF-8
Some code points < 256 are the same whether represented in UTF-8, or
not. Others change to require 2 bytes to represent in UTF-8. When
parsing a string, using UTF-8 is avoided unless necessary, because of
the extra overhead required for processing UTF-8. This means that when,
during the parse, we discover we need to convert to UTF-8, we have to,
in effect, reparse whatever we have so far to make sure those code
points that differ under UTF-8 get their proper representation. This
reparsing would not be necessary if we know that the string doesn't have
such code points.
It turns out that keeping track of having seen UTF-8 variant code points
is cheap, requiring no extra branch instructions. And the payoff is
potentially large, avoiding having to reparse the string. This commit
changes to keep track.
Karl Williamson [Mon, 26 Dec 2016 04:53:04 +0000 (21:53 -0700)]
toke.c: Reorder if/else branches
It is easier to read code if the trivial branch is follows immediately
after the 'if'.
Karl Williamson [Wed, 28 Dec 2016 02:37:33 +0000 (19:37 -0700)]
toke.c: Fix too-small SvGROW()
This might be a bug on EBCDIC, but not ASCII platforms. The code forgot
that SvGROW takes a total size, and not an incremental size. So, this
is most likely a no-op, but I believe there are no cases on ASCII
platforms where this actually needs to grow, and on EBCDIC, it would
only be very large, way above Unicode, code points. Grows in later
iterations of the loop would recover to grow to the correct size, unless
this EBCDIC escape sequence was the final thing there.
Karl Williamson [Wed, 28 Dec 2016 02:20:08 +0000 (19:20 -0700)]
toke.c: Simplify a couple of expressions
By storing an intermediate result in a temporary, the final expression
is clearer.
Karl Williamson [Wed, 28 Dec 2016 02:45:07 +0000 (19:45 -0700)]
toke.c: Convert sv_grow to SvGROW
The latter is preferred
Karl Williamson [Tue, 3 Jan 2017 01:08:57 +0000 (18:08 -0700)]
APItest/t/handy.t: Fix for EBCDIC
There were several instances where the native code point and the Unicode
equivalent were being conflated.
Aaron Crane [Mon, 2 Jan 2017 15:12:45 +0000 (15:12 +0000)]
perlhacktips: add some notes on TRUE and FALSE
Steve Hay [Mon, 2 Jan 2017 21:20:05 +0000 (21:20 +0000)]
Add epigraphs for 5.22.3-RC5 and 5.24.1-RC5
Aaron Crane [Mon, 2 Jan 2017 18:40:42 +0000 (18:40 +0000)]
makedepend.SH: omit trailing "." in progress messages
Since the message ends in the name of a file, I find that the trailing dot
makes it harder to select the filename in my terminal emulator.
Steve Hay [Mon, 2 Jan 2017 17:23:15 +0000 (17:23 +0000)]
Update copyright year
David Mitchell [Mon, 2 Jan 2017 16:37:27 +0000 (16:37 +0000)]
Handle chop(@a =~ tr///)
RT #130198
'chop(@x =~ tr/1/1/)' crashed with an assertion failure. Ditto for chomp.
There are two quirks which together cause this. First, the op tree for
a tr// is different from other bind ops:
$ perl -MO=Concise -e'$x =~ m/a/'
5 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
4 </> match(/"a"/) vKS ->5
- <1> ex-rv2sv sK/1 ->4
3 <#> gvsv[*x] s ->4
$ perl -MO=Concise -e'$x =~ tr/a/b/'
5 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
- <1> null vKS/2 ->5
- <1> ex-rv2sv sKRM/1 ->4
3 <#> gvsv[*x] s ->4
4 <"> trans sS ->5
Note that the argument for the match is a child of the match, while the
arg of the trans is an (earlier) sibing of the trans (linked by a common
null parent).
The normal code path that croaks when e.g. a match is seen in an lvalue
context,
$ perl -e'chop(@a =~ /a/)'
Can't modify pattern match (m//) in chop at -e line 1, near "/a/)
is skipped, since lvalue() is only called for the first child of a null op.
Fixing this is as simple as calling lvalue() on the RHS too if the RHS is
a trans op.
The second issue is that chop and chomp are special-cased not to flatten
an array; so
@b = 10..99;
chop $a, @b, $c;
pushes 3 items on the stack to pass to pp_chop, rather than 102. pp_chop()
itself then iterates over any array args.
The compiler was seeing the rv2av op in chop(@a =~ tr///) and was setting
the OPf_REF (don't flatten) flag on it. Which then caused pp_trans to
panic when its arg was an AV rather than a string.
This second issue is now moot, since after the fix suggested above, we
will have croaked before we reach the place where OPf_REF would be set.
This commit adds lots of tests, since tr/a/a/ and tr/a/b/r are
special-cased in terms of whether they are regarded as modifying the
var they are bound to.
Steve Hay [Mon, 2 Jan 2017 15:07:59 +0000 (15:07 +0000)]
5.22.3-RC5 and 5.24.1-RC5 today
James E Keenan [Sun, 1 Jan 2017 15:12:56 +0000 (10:12 -0500)]
John Lightsey [Sun, 25 Dec 2016 02:41:40 +0000 (21:41 -0500)]
Fix a null pointer dereference segfault in Storable.
At point where the retrieve_code logic was unable to read the string that
contained the code.
Also fix several locations where retrieve_other was called with a null context
pointer. This also resulted in a null pointer dereference.
Committer: Add tests adapted from submitter's test program.
For: RT #130098
jdhedden [Sat, 31 Dec 2016 17:51:35 +0000 (12:51 -0500)]
Upgrade to threads 2.12
For: RT # 130469
jdhedden [Sat, 31 Dec 2016 17:33:47 +0000 (12:33 -0500)]
Upgrade to threads::shared 1.54
jkeenan [Mon, 13 Aug 2012 01:55:42 +0000 (21:55 -0400)]
Clarify that 'installhtml' is intended only for use in the Perl 5 core distribution.
For: RT # 114466
jdhedden [Fri, 30 Dec 2016 17:37:21 +0000 (12:37 -0500)]
Upgrade to threads::shared 1.53
For: RT #130457
James E Keenan [Fri, 30 Dec 2016 17:30:17 +0000 (12:30 -0500)]
Prevent tests from getting hung up on 'NonStop' option.
For: https://rt.perl.org/Ticket/Display.html?id=130445
Thanks to Håkon Hægland for report and suggestion. Simplify revisions, per
feedback from Aaron Crane.
James E Keenan [Fri, 30 Dec 2016 14:58:17 +0000 (09:58 -0500)]
Discuss Porting/sync-with-cpan -- the simpler usage -- first.
Incorporate feedback from Aaron Crane.
Aaron Crane [Fri, 30 Dec 2016 18:48:36 +0000 (18:48 +0000)]
[MERGE] Further improvements to Porting/sync-with-cpan
With these changes, all the recent module imports could have been handled
automatically; and applying it to a tricky case that hasn't yet been
imported does now at least yield better advice on how to proceed.
Aaron Crane [Fri, 30 Dec 2016 18:27:14 +0000 (18:27 +0000)]
Porting/sync-with-cpan: another preflight check
Aaron Crane [Fri, 30 Dec 2016 18:00:45 +0000 (18:00 +0000)]
Revert "Porting/sync-with-cpan: apply --jobs=N when running module tests"
This reverts commit
06998c55f9d56cbee761af0d6dc5ec06fcee3c62.
It turns out that some CPAN modules' test suites fail when run in parallel.
For example, DB_File has three test files, all of which create database files
of the same names. (I'm slightly puzzled as to why I don't see failures from
that module whenever running Perl's test suite in parallel; my guess is that,
when only a few test files are being run, it's much more likely that the
tests will be run simultaneously.)
We can submit patches for modules with serial-only test suites, but for now
at least, the best course of action seems to be for sync-with-cpan to run
modules' test suites serially.
Aaron Crane [Fri, 30 Dec 2016 16:07:05 +0000 (16:07 +0000)]
Porting/sync-with-cpan: handle unwritable files in tarballs
If the tarball contains an unwritable file, we were throwing an exception
when trying to open the file for appending. Opening the file isn't actually
necessary for bumping the file's timestamp, which was the intention of that
code. However, it's a good idea to make the file locally-writable anyway, so
that if the user later needs to edit it, they can do so easily.
Aaron Crane [Fri, 30 Dec 2016 16:04:35 +0000 (16:04 +0000)]
Porting/sync-with-cpan: remove needless loop
The de_exec() routine is only ever called with one argument at a time, so
simplify it.
Aaron Crane [Fri, 30 Dec 2016 15:40:16 +0000 (15:40 +0000)]
Porting/sync-with-cpan: fix bug in updating Maintainers.pl
We must look for $module, not $cpan_mod, because the former is specifically
the key in %Modules under which we found the details for this dist.
Aaron Crane [Fri, 30 Dec 2016 15:26:37 +0000 (15:26 +0000)]
Porting/sync-with-cpan: try to change "::" to "-" in module name
This is needed for cases like IO-Compress when the user asks for
"IO::Compress".
In addition, if we still can't find the module, be more explicit about what
the problem is.
Aaron Crane [Fri, 30 Dec 2016 15:05:42 +0000 (15:05 +0000)]
Porting/sync-with-cpan: offer advice in the face of CUSTOMIZED
Aaron Crane [Fri, 30 Dec 2016 14:01:57 +0000 (14:01 +0000)]
[MERGE] Improve Porting/sync-with-cpan
The original goal of this sequence of patches was to address RT#130375. That
ticket proposes extending the release manager's guide with discussion of
what regen/lib_cleanup.pl does, and why it might sometimes be needed, and
thus why Porting/sync-with-cpan might yield a porting-test failure when
t/porting/regen.t detects that it needs to be run.
However, I find the RMG is already relatively bulky, and therefore hard to
navigate; so adding more text to it would exacerbate that problem. In
addition, it seems much better to merely fix this problem: we can always run
regen/lib_cleanup.pl, and if it makes any changes, those changes can be
committed along with the updated CPAN module being imported.
This merge also contains a few other improvements to Porting/sync-with-cpan:
- The log file it generates is now listed in .gitignore
- It allows specifying the module name with "-" rather than "::" as a name
separator
- A bug that prevented the new module's tests from being run is now fixed
- The MANIFEST is now rewritten to accommodate any file deletions introduced
by the updated CPAN module
- The messages emitted have been reworked slightly for clarity; in
particular, "Fixing MANIFEST" will no longer be followed by a confusing
and scary "'MANIFEST' is NOT sorted properly" message
- It now takes a --jobs option, which if supplied is used both for executing
make and running the module's tests
- The --tarball option now works when the tarball isn't in the current
directory
- It runs a few additional preflight checks that detect mistakes I found
myself making
These changes have been tested by using Porting/sync-with-cpan to import
Test::Simple into blead as of
54f6f377a29af7d60918c003fc2c462439c340bd,
since that was the triggering case for RT#130375.
Aaron Crane [Fri, 30 Dec 2016 13:51:04 +0000 (13:51 +0000)]
Porting/sync-with-cpan: allow out-of-tree --tarball file
Previously, in this situation, we correctly used Archive::Tar to extract the
contents of the tarball under cpan/, but then tried to look for the files in
a nonexistent directory alongside the original tarball.
Aaron Crane [Fri, 30 Dec 2016 13:46:11 +0000 (13:46 +0000)]
Porting/sync-with-cpan: more preflight checks for --tarball
If the file supplied doesn't exist (or names a directory), we'll get a
failure from Archive::Tar after having already made some changes.
Aaron Crane [Fri, 30 Dec 2016 13:42:51 +0000 (13:42 +0000)]
Porting/sync-with-cpan: avoid unless/else
Aaron Crane [Fri, 30 Dec 2016 11:33:37 +0000 (11:33 +0000)]
Porting/sync-with-cpan: bail out early if Configure hasn't been run