This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Karl Williamson [Tue, 19 Mar 2019 18:08:06 +0000 (12:08 -0600)]
Change error wording for \o{}
An empty \o{} no longer says "Number with no digits" in favor of "Empty
\o{}" which is more consistent with errors raised for things like \b{},
\P{}.
There is a small risk of breakage with this change, as with any
diagnostic wording change. However, this construct is relatively new
and rarely used, and this is a fatal error, not a warning you might want
to trap on. There are no empty \o{} instances in CPAN.
Karl Williamson [Tue, 19 Mar 2019 16:25:06 +0000 (10:25 -0600)]
Merge branch 'safer' into blead
I undertook an audit to see where there might be places where malformed
UTF-8 input could cause us to exceed the boundaries of buffers. I
looked for where hopping to other characters in the string and skipping
to the next character based on the current start byte.
This branch is the result of that. Wherever I didn't see how exceeding
the bounds wasn't a problem, I changed to use the safer versions of the
hop and skip operations that we already have. As an example of where it
isn't a problem is when doing the operation is at the end of a loop
iteration, and the loop tests if we've exceeded it, with the result that
the loop just stops executing.
I may have missed things, and may have changed to unnecessarily use the
safer operations in places
Karl Williamson [Mon, 18 Mar 2019 17:02:23 +0000 (11:02 -0600)]
regexec.c: Use safe UTF8SKIP
Karl Williamson [Mon, 18 Mar 2019 17:09:22 +0000 (11:09 -0600)]
regexec.c: Use safer utf8_hop
Karl Williamson [Mon, 18 Mar 2019 16:38:56 +0000 (10:38 -0600)]
regcomp.c: Use safer utf8_hop
Karl Williamson [Tue, 19 Mar 2019 02:16:39 +0000 (20:16 -0600)]
regcomp.c: Use safe UTF8SKIP
Karl Williamson [Tue, 19 Mar 2019 01:48:48 +0000 (19:48 -0600)]
pp_ctl.c: Use safe UTF8SKIP
Karl Williamson [Tue, 19 Mar 2019 01:27:57 +0000 (19:27 -0600)]
pp_pack.c: Use safe UTF8SKIP
Karl Williamson [Mon, 18 Mar 2019 16:29:46 +0000 (10:29 -0600)]
pp.c: Use safer utf8_hop
Karl Williamson [Tue, 19 Mar 2019 03:43:34 +0000 (21:43 -0600)]
regexec.c: Add comments
Karl Williamson [Tue, 19 Mar 2019 03:17:03 +0000 (21:17 -0600)]
pp.c, pp_sys.c: Use DO_UTF8 instead of its expansion
We have a macro to hide the details of this; use it
David Mitchell [Tue, 19 Mar 2019 11:15:21 +0000 (11:15 +0000)]
op_free() remove redundant !kid test
and replace with an assert.
If an op has the OPf_KIDS flag, then cUNOPo->op_first must be non-null.
So testing for !kid doesn't do much, especially as on the previous line
we dereference it anyway.
David Mitchell [Tue, 19 Mar 2019 10:58:46 +0000 (10:58 +0000)]
handle scope error in qr/\(?{/
RT #133879
In this code:
BEGIN {$^H = 0x10000 }; # HINT_NEW_RE
qr/\(?{/
When the toker sees the 'qr', it looks ahead and thinks that the
pattern *might* contain code blocks, so creates a new anon sub to wrap
compilation of the pattern in (so that any code blocks get compiled as
part of the anon sub rather than the main body of the code).
Normally at the end of parsing the qr construct, the parser notes that
no code blocks were found, and throws the unneeded CV away and
restores the old PL_compcv (via a LEAVE_SCOPE). This false positive is
normal and is expected in the relevant code paths.
However, setting the HINT_NEW_RE (which indicates that
overload::constant is present for qr// but with no overloaded function
actually present) causes an error to be raised. The parser does error
recovery and continues.
However, v5.25.9-148-g7c44985626 added a test to not bother compiling a
pattern if the parser is in an errored state, which again is fine,
except it turns out that if this branch is taken, it skips the 'restore
the old PL_compcv' code, leading to the wrong value for PL_compcv when
ops are freed.
The fix is simple: move the "skip if errored" test to after PL_compcv
has been restored.
Karl Williamson [Mon, 18 Mar 2019 17:05:33 +0000 (11:05 -0600)]
Merge branch 'vlb' into blead
This branch implements variable length lookbehind in regular expression
patterns.
Karl Williamson [Mon, 18 Mar 2019 03:47:16 +0000 (21:47 -0600)]
regexec.c: White-space only
Outdent to reflect removed enclosing block
Karl Williamson [Mon, 18 Mar 2019 03:06:10 +0000 (21:06 -0600)]
Implement variable length lookbehind in regex patterns
See [perl #132367].
Karl Williamson [Sun, 17 Mar 2019 18:36:48 +0000 (12:36 -0600)]
regexec.c: regmatch(): Add pushing eol
This continues the process of changing regmatch() to be able to restrict
the end point of where it is looking in the input, by adding that eol
position to the pushed state, and popping it when appropriate.
Karl Williamson [Sun, 17 Mar 2019 16:52:41 +0000 (10:52 -0600)]
regexec.c: restrict match to substring in regmatch()
This begins to add the capability to regmatch() to not look beyond a
certain point in the string in order to find a match. But this is
currently set to the end of the entire string so it shouldn't affect any
current outcomes.
Karl Williamson [Sun, 17 Mar 2019 16:36:48 +0000 (10:36 -0600)]
regexec.c: Add parameter to static fcn
This parameter will be used to limit how far in the input string to
apply the function to. But currently, it is set to the end of the
string, so there should be no change from previous behavior.
Karl Williamson [Sat, 16 Mar 2019 19:37:59 +0000 (13:37 -0600)]
Add warning category for variable length lookbehind
Karl Williamson [Sun, 17 Mar 2019 16:19:21 +0000 (10:19 -0600)]
regexec.c: Rmv unnecessary assigns
We never use this variable again (this isn't in a loop unlike similar
cases in other functions in this file), so we don't care if it gets
updated. Instead use the source value directly.
Karl Williamson [Sun, 17 Mar 2019 18:00:23 +0000 (12:00 -0600)]
regexec.c: Delete unused macro
Karl Williamson [Sun, 17 Mar 2019 18:09:40 +0000 (12:09 -0600)]
regexec.c: Comment fixes, additions
Karl Williamson [Sun, 17 Mar 2019 18:07:41 +0000 (12:07 -0600)]
regexec.c: Move macro defns, comments adjacent to fcn
Over the years the heading comments for regmatch(), as well as the macro
definitions that are used by just it, have become separated from it by
many intervening functions. This moves things back so the things that
apply just to regmatch() are just before it.
Karl Williamson [Sat, 16 Mar 2019 20:26:49 +0000 (14:26 -0600)]
perlre: Link technique for variable length lookbehind
This web page gives a technique that one can use to achieve variable
length lookbehinds.
Dagfinn Ilmari Mannsåker [Mon, 18 Mar 2019 15:47:26 +0000 (15:47 +0000)]
perlvar: improve POD markup for $-[n] example
Closing and re-opening the C<> arond the I<> leads to weird formatting
in man/text mode. Instead nest the I<> inside the C<>.
David Mitchell [Tue, 12 Mar 2019 11:05:48 +0000 (11:05 +0000)]
fix paren buffer leak in (?|...)
The (?| ... | ... |... ) alternation resets the paren index for each
branch. This can trick the code in S_reg() into re-mallocing the open
and close paren index buffers during every branch, leaking the old ones.
This commit fixes the leak by introducing a new compilation variable,
RExC_parens_buf_size, which records the actual number of slots malloced.
By decoupling RExC_parens_buf_size from RExC_npar, it also means that
the code can allocate a buffer larger than currently needed. This means
that
/(.)(.)(.)(.)/
no longer does a malloc() and 3 reallocs(), but instead initially
mallocs 10 slots, and if more than 10 captures are seen during
compilation, reallocs() to 20, 40, 80 ....
Karl Williamson [Mon, 18 Mar 2019 04:11:04 +0000 (22:11 -0600)]
PATCH: [perl #131551] Too deep regex compilation recursion
This patch, started by Yves Orton, and refined in consultation with Tony
Cook, imposes a maximum depth of unclosed left parentheses, at which
point it croaks. This is to prevent the segfault in the ticket.
The patch adds a variable that can be set to increase or decrease this
limit at run time (actually regex compilation time) should this be
desired, and hence our pre-determined limit of 1000 can be changed if
necessary.
Karl Williamson [Mon, 18 Mar 2019 03:59:52 +0000 (21:59 -0600)]
regcomp.c: Use mnemonic for flag parameter
Karl Williamson [Sat, 16 Mar 2019 19:22:35 +0000 (13:22 -0600)]
perlre: Consistent casing and spelling of VERB args
Craig A. Berry [Sat, 16 Mar 2019 19:10:40 +0000 (14:10 -0500)]
realclean unidatafiles on VMS the same way as elsewhere.
We were deleting lib/unicore/*.pl, but with uni_keywords.pl there
is now one non-generated .pl file in that directory. Deleting it
in realclean caused subsequent configure attempts in the same
directory tree to fail.
Karl Williamson [Fri, 15 Mar 2019 17:11:11 +0000 (11:11 -0600)]
inline.h: Improve comment
Karl Williamson [Fri, 15 Mar 2019 03:39:56 +0000 (21:39 -0600)]
utf8_length() Add two UNLIKELY()s
The input is likely to be valid.
Karl Williamson [Thu, 23 Nov 2017 06:10:01 +0000 (23:10 -0700)]
S_multiconcat() Use faster variant counting
Karl Williamson [Thu, 23 Nov 2017 06:12:37 +0000 (23:12 -0700)]
toke.c: lex_stuff_pvn() Use faster UTF-8 variant count
What finally got me to push this commit, since speed really doesn't
matter during compilation, is that this removes a hand-rolled
implementation.
Karl Williamson [Thu, 14 Mar 2019 23:37:29 +0000 (17:37 -0600)]
t/re/pat.t: Add test for [perl #133933]
This was fixed by
bf848a12528ab1e63a2f20da532eda498adbdca6.
Karl Williamson [Thu, 14 Mar 2019 23:06:16 +0000 (17:06 -0600)]
regcomp.c: Add assertions
These make sure we don't exceed the 32 bits available for long jumps.
Karl Williamson [Thu, 14 Mar 2019 22:46:50 +0000 (16:46 -0600)]
Add more checking for regnode offset overflowing
This is part of the ongoing failures in [perl #133921].
The bottom line cause is that there are generally 16 bits available for
the address of the next regnode. On very large patterns, this may not
be enough. When that happens, a long jump is used instead.
What previous commits have done is to insert tests in a loop to detect
that overflow isn't going to occur. But it turns out that there are
other places where such overflow could occur. The real solution should
be to detect overflow in the base level routine that would otherwise get
things wrong. This entails making that routine be able to return
failure. It turns out that another function is used under DEBUGGING, so
that one must be changed as well. And the calls where it is possible
for this to overflow are changed to look for failure return and proceed
appropriately, which is to set a flag that we need to use long jumps,
and restart the parse.
Karl Williamson [Thu, 14 Mar 2019 17:50:10 +0000 (11:50 -0600)]
regnodes.h, perldebguts: Shorten some descriptions
Karl Williamson [Thu, 14 Mar 2019 17:48:11 +0000 (11:48 -0600)]
Any Common digit set can match in any script
This fixes a design flaw in script runs that in 5.30 effectively
prevented digits from the Common script except the ASCII [0-9] from
being in any meaningful script run.
Karl Williamson [Thu, 14 Mar 2019 03:25:05 +0000 (21:25 -0600)]
PATCH: [perl #133921] Segfaults in regcomp.c
If a regular expression pattern gets too long so that the branch
instructions need more bits than are available, it is supposed to
reparse and use long jumps instead of the normal ones that don't take up
extra room. The blamed commit caused the test for this to be done too
late. This just moves the test to do it in time; lexically later in the
file, but just after the variable takes on the too-large value and
before it gets used in the next loop iteration.
Karl Williamson [Thu, 14 Mar 2019 03:24:47 +0000 (21:24 -0600)]
t/re/pat.t: Rmv stray semi-colon
Karl Williamson [Thu, 14 Mar 2019 01:11:46 +0000 (19:11 -0600)]
PATCH: [perl #133871] heap-buffer-overflow in S_reginsert
The regex compiler was written assuming it knew how many parentheses
pairs there were at code generation time. When I converted to a single
pass in
7c932d07cab18751bfc7515b4320436273a459e2, most things were
straight forward to not have to know this number, but there were a few
where it was non-trivial (for me anyway) to figure out how to handle.
So I punted on these and do a second pass when these are encountered.
There are few of them and are less commonly used, namely (?R), (?|...)
and forward references to groups (which most commonly will end up being
a syntax error anyway).
The fix in this commit is to avoid doing some parentheses relocations
when a regnode is inserted when it is known that the parentheses counts
are unreliable (during initial parsing of one of these tricky
constructs). The code in the ticket is using a branch reset '(?|...)'.
A second pass will get done, and the insert properly handled then, after
the counts are reliable.
Karl Williamson [Thu, 14 Mar 2019 00:41:45 +0000 (18:41 -0600)]
regcomp.c: Create macro, add comments
Karl Williamson [Thu, 14 Mar 2019 00:45:34 +0000 (18:45 -0600)]
regcomp.c: Rmv unused variable
Karl Williamson [Tue, 12 Mar 2019 21:56:05 +0000 (15:56 -0600)]
t/re/pat.t: Outdent 2 lines
Karl Williamson [Thu, 14 Mar 2019 00:03:01 +0000 (18:03 -0600)]
Allow qr'\N{...}'
Karl Williamson [Wed, 13 Mar 2019 23:58:00 +0000 (17:58 -0600)]
regcomp.c: White-space, comments only
Karl Williamson [Thu, 12 Jan 2017 21:50:26 +0000 (14:50 -0700)]
toke.c: Allow \N{} handling fcn to be used elsewhere in core
This function will be used in regcomp.c in a later commit. This commit
changes the function so that it is callable outside of toke.c. It adds
a parameter and moves some code in new_constant to the wrapper function
so that these do not cause problems when called from outside toke. And
it adds some assertions
Karl Williamson [Thu, 12 Jan 2017 21:46:21 +0000 (14:46 -0700)]
toke.c: Add wrapper function
This is in preparation for the underlying function to be called from
elsewhere. This adds a wrapper to be used internally in toke.c that
keeps the other caller of the underlying function from having to know
the changes to that function. That function is changed to return any
error message instead of raising it itself.
Karl Williamson [Tue, 17 Jan 2017 00:43:06 +0000 (17:43 -0700)]
toke.c: Change API of static function
This will be useful in future commits. new_constant() is changed so
that if an extra parameter is not NULL, it sets it to point to an error
message instead of raising the message itself. Thus its caller can
choose to handle errors itself.
Tony Cook [Wed, 13 Mar 2019 23:19:04 +0000 (10:19 +1100)]
there is no sv_catpvfn()
Replace in various documentation and messages appropriately.
Karl Williamson [Fri, 8 Mar 2019 20:16:53 +0000 (13:16 -0700)]
regcomp.h: Rmv obsolete references to 'swash'
regexes no longer use these
Karl Williamson [Wed, 13 Mar 2019 21:21:39 +0000 (15:21 -0600)]
regexec.c: We know the end ptr; don't need to recalc
Karl Williamson [Wed, 13 Mar 2019 21:20:50 +0000 (15:20 -0600)]
regexec.c: Add assertion
Karl Williamson [Wed, 13 Mar 2019 20:23:03 +0000 (14:23 -0600)]
regcomp.c: Add assertion
Karl Williamson [Wed, 13 Mar 2019 19:36:00 +0000 (13:36 -0600)]
regcomp.c: Rmv unnecessary branch
The function memchr() seems to get inlined so it is very fast, and it's
legal to call it with a 0 length, so let it figure out that it's zero.
Karl Williamson [Wed, 13 Mar 2019 19:23:24 +0000 (13:23 -0600)]
perlvar: Fix broken link
Karl Williamson [Wed, 13 Mar 2019 19:18:28 +0000 (13:18 -0600)]
perlrecharclass: Minor wording improvements
Karl Williamson [Wed, 13 Mar 2019 19:17:39 +0000 (13:17 -0600)]
perlre: Minor wording improvements
Karl Williamson [Wed, 13 Mar 2019 19:16:43 +0000 (13:16 -0600)]
perlre: Italicize a bunch of stuff
These are not meant to be written literally.
Karl Williamson [Wed, 13 Mar 2019 17:42:15 +0000 (11:42 -0600)]
dquote.c: Use UTF8_SAFE_SKIP
Otherwise malformed input could cause this to return a pointer outside
its buffer
Karl Williamson [Wed, 13 Mar 2019 17:41:09 +0000 (11:41 -0600)]
Add UTF8_SAFE_SKIP API macro
This version of UTF8SKIP refuses to advance beyond the end pointer
Karl Williamson [Wed, 13 Mar 2019 16:38:13 +0000 (10:38 -0600)]
perldiag: A deprecation is now fatal
Karl Williamson [Tue, 12 Mar 2019 22:21:27 +0000 (16:21 -0600)]
t/re/pat_advanced.t: Change some ok's to like's
Dan Kogai [Wed, 13 Mar 2019 02:09:18 +0000 (22:09 -0400)]
Encode: synch with CPAN version 3.01
Karl Williamson [Tue, 12 Mar 2019 21:47:15 +0000 (15:47 -0600)]
toke.c: Clarify comment
Karl Williamson [Tue, 12 Mar 2019 21:20:29 +0000 (15:20 -0600)]
t/re/pat_advanced.t: Add some comments
Karl Williamson [Tue, 12 Mar 2019 17:36:48 +0000 (11:36 -0600)]
Add tests for wildcards in Unicode property values
Karl Williamson [Mon, 11 Mar 2019 23:16:34 +0000 (17:16 -0600)]
Add Unicode property wildcards
Karl Williamson [Mon, 11 Mar 2019 21:55:54 +0000 (15:55 -0600)]
regen/mk_invlists.pl: Add tables for Unicode wildcards
This supports this new feature.
Karl Williamson [Mon, 11 Mar 2019 19:14:36 +0000 (13:14 -0600)]
Add warnings category experimental::uniprop_wildcards
Karl Williamson [Thu, 7 Mar 2019 22:31:58 +0000 (15:31 -0700)]
is_invlist(): Allow NULL input
For generality, it should allow a NULL and return FALSE.
Karl Williamson [Mon, 11 Mar 2019 23:10:06 +0000 (17:10 -0600)]
perlunicode: Update, clarify
This updates to match the latest Unicode document on regular
expressions, and to incorporate changes that have happened to Perl that
didn't get updated here. It also includes new clarifications about some
of the Unicode requirements.
Karl Williamson [Thu, 7 Mar 2019 22:29:28 +0000 (15:29 -0700)]
perlapi: Clarify entry for hv_store()
Karl Williamson [Mon, 11 Mar 2019 17:18:18 +0000 (11:18 -0600)]
regen/mk_invlists.pl: Remove stray debugging stmts
These debugging lines were left in by
21c34e9717d
Karl Williamson [Sat, 9 Mar 2019 18:09:01 +0000 (11:09 -0700)]
regen/mk_invlists.pl: Comment/white-space only
Karl Williamson [Sat, 9 Mar 2019 16:43:45 +0000 (09:43 -0700)]
regen/mk_invlists.pl, lib/utf8_heavy.pl: Rename variable
This renames a variable to more accurately reflect its content, and adds
a new one which has the old name but with an accurate content.
Karl Williamson [Thu, 7 Mar 2019 22:14:56 +0000 (15:14 -0700)]
charclass_invlists.h: Add comment
Karl Williamson [Sat, 9 Mar 2019 18:48:20 +0000 (11:48 -0700)]
t/re/reg_mesg.t: Add test
David Mitchell [Tue, 12 Mar 2019 07:10:10 +0000 (07:10 +0000)]
fix blead on non-threaded builds
My recent v5.29.8-64-g02a9632ac4 commit broke unthreaded builds.
This is the obvious fix. I've heard a report that unthreaded perl
SEGVs now but can't reproduce.
David Mitchell [Mon, 11 Mar 2019 16:18:10 +0000 (16:18 +0000)]
Fix leak on syntax error in main prog
t/lib/croak.t was failing several tests under ASan because it was
running small stand-alone programs with some sort of error in, such as
BEGIN { }
myfunc 1;
Unlike other code paths (such as S_doeval_compile() for evals),
Perl_newPROG() - when called for the main body rather than for a
completed eval - was calling cv_forget_slab() on PL_compcv regardless of
whether an error was present. That call converts the compiling CV into
a compiled one, which disclaims ownership of the slab(s) its ops are
embedded in. This means that when the CV is freed, ops within the slab
which aren't embedded within the PL_main_root tree would leak.
Such ops may exist when Perl_newPROG() is reached after one of more
errors.
The fix is simply to not call cv_forget_slab() if the error count is > 0.
David Mitchell [Fri, 8 Mar 2019 08:40:29 +0000 (08:40 +0000)]
fix leak when compiling typed hash deref
In something like
my Foo $h;
$h->{bad_key}
perl will croak if package Foo defines valid %FIELDS and bad_key isn't
one of them. This croak happens during the second pass in
S_maybe_multideref(), which is trying to convert $h->{bad_key} into a
single multideref op. Since the aux buffer is allocated at the end of
the first pass, the buffer leaks.
The fix is to do the check in the first pass, which has been done by
adding an extra boolean flag to S_check_hash_fields_and_hekify(),
indicating whether to just check or actually do it.
Karl Williamson [Fri, 8 Mar 2019 16:45:37 +0000 (09:45 -0700)]
Don't use utf8_heavy.pl unless needed
Prior to this commit 'use utf8' loaded utf8_heavy.pl. But previous
commits in the 5.29 series mean it is not needed from the core unless a
tr/// is using UTF-8, a much less likely occurrence. So load it only on
demand
Karen Etheridge [Sun, 10 Mar 2019 20:33:58 +0000 (13:33 -0700)]
upgrade ExtUtils::Manifest from version 1.71 to 1.72
Karl Williamson [Mon, 2 Jul 2018 04:39:47 +0000 (22:39 -0600)]
perldelta for
fd879d933c2a2ee22ac6e2462acc016aa033854d
This patch causes pack to die rather than return malformed UTF-8. This
protects the rest of the core from unexpectedly getting malformed
inputs.
Karl Williamson [Mon, 2 Jul 2018 04:39:47 +0000 (22:39 -0600)]
PATCH: [perl #131642] pack returning malformed UTF-8
This patch causes pack to die rather than return malformed UTF-8. This
protects the rest of the core from unexpectedly getting malformed
inputs.
Karl Williamson [Fri, 8 Mar 2019 17:01:48 +0000 (10:01 -0700)]
PATCH: [perl #133876] Write out of bounds
This was caused by a lapse on my part about the inputs to this function
that grows memory. I was thinking the trailing NUL was included, but
it's not. This patch adds space for that to all calls of
sv_utf8_upgrade_flags_grow() in the file.
But it occurs to me that maybe the function itself should just add one
instead of having the caller do it. If you think so, let me know.
Tony Cook [Fri, 8 Mar 2019 00:08:53 +0000 (11:08 +1100)]
Tony Cook [Thu, 28 Feb 2019 00:53:19 +0000 (11:53 +1100)]
(perl #124203) fix a similar problem with DB::lsub
Tony Cook [Wed, 27 Feb 2019 04:29:23 +0000 (15:29 +1100)]
bump $DB::VERSION for perl5db.pl to 1.55
Tony Cook [Wed, 27 Feb 2019 04:28:37 +0000 (15:28 +1100)]
bump $threads::shared::VERSION to 1.60
Tony Cook [Wed, 27 Feb 2019 01:01:40 +0000 (12:01 +1100)]
(perl #124203) avoid a deadlock in DB::sub
I don't know how this ever worked.
Previously, DB::sub() would hold a lock on $DB::DBGR for it's entire
body, including the call to the subroutine being called.
This could cause problems in two cases:
a) on creation of a new thread, CLONE() is called in the context of
the new interpreter before the new thread is created. So you'd have a
sequence like:
threads->new
DB::sub for threads::new (lock $DBGR)
call into threads::new which creates a new interpreter
Cwd::CLONE() (in the new interpreter)
DB::sub for Cwd::CLONE (in the new interpreter) (deadlock trying to lock $DBGR)
One workaround I tried for this was to prevent pp_entersub calling
DB::sub if we were cloning (by checking PL_ptr_table). This did
improve matters, but wasn't needed in the final patch.
Note that the recursive lock on $DBGR would have been fine if the new
code was executing in the same interpreter, since the locking code
simply bumps a reference count if the current interpreter already
holds the lock.
b) when the called subroutine blocks. For the test case this could
happen with the call to $thr->join. There would be a sequence like:
(parent) $thr->join
(parent) DB::sub for threads::join (lock $DBGR)
(parent) call threads::join and block
(child) try to call main::sub1
(child) DB::sub for main::sub1 (deadlock trying to lock $DBGR)
This isn't limited to threads::join obviously, one thread could be
waiting for input, sleeping, or performing a complex calculation.
The solution I chose here was the obvious one - don't hold the lock
for the actual call.
This required some rearrangement of the code and removed some
duplication too.
Tony Cook [Wed, 27 Feb 2019 01:01:12 +0000 (12:01 +1100)]
add extra lock tracing to threads::shared
This was useful in tracing the cause for the deadlock in #124203.
This can be enabled during a build of perl by adding:
-Accflags=-DSHARED_TRACE_LOCKS -DDEBUGGING
to the Configure command-line.
To see the trace at run-time add -DU or -DUv to the perl command-line.
The original DEBUG_LOCKS tracing using warn caused extra calls
confusing back traces when trying to debug this problem.
Karl Williamson [Thu, 7 Mar 2019 20:44:34 +0000 (13:44 -0700)]
PATCH: [perl #133882] Assertion failure
The asserts in this routine were doing there job. It was called
inappropriately, with len set to 0, which means for it that it's
supposed to calculate the length by using strlen(). But, len being 0
here meant that the input was empty. When run under valgrind, errors
would also show up.
This function was being called to see if the string had any characters
that varied depending on if it is UTF-8 or not. Since we know that the
answer is no if the length is 0, we simply don't call this function
then.
Karl Williamson [Thu, 7 Mar 2019 20:44:14 +0000 (13:44 -0700)]
t/re/subst.t: Fix typo in comment
Karl Williamson [Thu, 7 Mar 2019 18:40:25 +0000 (11:40 -0700)]
regexec.c: Rule out match sooner
If this function is passed a regnode that won't match a non-UTF-8
string, we can fail immediately if the string isn't UTF-8.
Karl Williamson [Thu, 7 Mar 2019 18:39:49 +0000 (11:39 -0700)]
regexec.c: Improve comments for a function
Karl Williamson [Thu, 7 Mar 2019 18:37:21 +0000 (11:37 -0700)]
PATCH: [perl #133899] panic in s///
Thanks for finding this bug, and the others you've been finding.
A new regnode was added, but this function was not updated to account
for that. I've now checked all the other new regnodes in 5.29 and this
was the only missing one.
Karl Williamson [Thu, 7 Mar 2019 00:50:23 +0000 (17:50 -0700)]
Add hook for Unicode private use override
I am starting to write a Unicode::Private_Use module which will allow
one to specify the Unicode properties of private use code points, thus
making them actually useful. This commit adds a hook to regcomp.c to
accommodate this module. The changes are pretty minimal. This way we
don't have to wait another release cycle to get it out there.
I don't want to document this interface, until it's proven.