This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
David Mitchell [Tue, 16 Apr 2019 21:17:45 +0000 (22:17 +0100)]
s/safefree()/Safefree() in a few places
Karl pointed that a couple of my recent commits used (lower case)
safefree() rather than Safefree(), the latter having extra debugging
facilities.
Karl Williamson [Tue, 16 Apr 2019 18:27:15 +0000 (12:27 -0600)]
mktables: Silence warning
A variable needed to be updated for Unicode 12.1
Tony Cook [Wed, 17 Apr 2019 01:10:13 +0000 (11:10 +1000)]
free pseen in the magic free code
David Mitchell [Tue, 16 Apr 2019 15:49:47 +0000 (16:49 +0100)]
fix leak when $LANG unset
The following leaked:
LANG= perl -e1
because in S_emulate_setlocale(), it was
1) making a copy of $ENV{"LANG"};
2) throwing that copy away and replacing it with "C" when it discovered
that the string was empty.
A little judicious reordering of that chunk of code makes the issue go
away.
Showed up as failures of lib/locale_threads.t under valgrind / ASan.
David Mitchell [Tue, 16 Apr 2019 14:48:39 +0000 (15:48 +0100)]
fix locale leaks on utf8 strings
For example the following leaked:
require POSIX; import POSIX ':locale_h';
setlocale(&POSIX::LC_ALL, 'aa_DJ.iso88591') or die;
use locale;
my $ok = 'A' lt chr 0x100;
Some code in Perl__mem_collxfrm() does a couple of
for (j = 1; j < 256; j++) { ... }
loops where for each chr(j) character it recursively calls itself, and
records the index of the 'smallest' / 'largest' result. However, when
updating cur_min_x / cur_max_x, it wasn't freeing the previous value.
The symptoms were that valgrind / Address Sanitizer found fault with
lib/locale.t
David Mitchell [Tue, 16 Apr 2019 14:28:16 +0000 (15:28 +0100)]
fix locale leak on zero-length strings
For example the following leaked:
use locale;
my $le = "" le "";
When a comparison is done within locale scope, PERL_MAGIC_collxfrm
magic is added to the SV. However, the value set for mg_len is the length
of the collated string, not the malloced size of the buffer. This means
that mg_len can be set to zero, which by convention, means that mg_ptr
shouldn't be freed.
For now, fix by putting special-cased code in S_mg_free_struct. After
5.30.0 is out, I'll probably add a PERL_MAGIC_collxfrm-specific svt_free
vtable method.
The symptoms were that valgrind / Address Sanitizer found fault with
lib/locale.t
Tony Cook [Tue, 16 Apr 2019 05:24:00 +0000 (15:24 +1000)]
handle an ASAN specific section name parsing nm output on darwin
ASAN builds can generate a section name of __asan_cstring on darwin,
which could make libperl.t fail.
Karl Williamson [Mon, 15 Apr 2019 22:01:49 +0000 (16:01 -0600)]
ext/POSIX/t/mb.t: Fix osvers= syntax checking
Commit
918fbd43ad287e3a4b8f309a55f91e409747c895 added a test skip to
this .t for early HP-UX platforms. Unfortunately, due to a machine
crash, I don't have access to such a platform to test it on, and I got
the syntax wrong. In consulation with Merijn Brand, I believe this
commit gets it right.
Karl Williamson [Mon, 15 Apr 2019 17:10:31 +0000 (11:10 -0600)]
PATCH: [perl #133945] Perl_strtod failures
This commit wraps Perl_strtod() in macros that cause the proper radix
character to be used.
Karl Williamson [Mon, 15 Apr 2019 21:08:05 +0000 (15:08 -0600)]
PATCH: [perl #134034] Assert fail in pattern match
This turned out to be a general problem in regexec.c. The function
regtry() can change the position we are looking at in the target string.
In particular it can point to just past the end of the string. Previous
to this commit, we were assuming that the returned string contained
valid data in the returned position, and in many places we assumed that
it was before the end. This commit fixes that in a bunch of places.
Karl Williamson [Mon, 15 Apr 2019 18:05:07 +0000 (12:05 -0600)]
PATCH: [perl #134029] Fail assert in pattern wildcard
The failing pattern has a single character subpattern, which should be
caught and compilation aborted, and this commit now does so.
David Mitchell [Mon, 15 Apr 2019 10:18:22 +0000 (11:18 +0100)]
skip leaky Storable tests
A bunch of tests make use of freeze/thaw hooks which deliberately die.
Fixing this looks non-trivial, so this commit just skips those tests
for now if running under Address Sanitizer.
This skip includes a version check, so come 5.31.0 it will start failing
smokes again, providing an incentive to fix.
Example of leaking code:
use Storable qw(store);
sub FreezeHookDies::STORABLE_freeze { die ${$_[0]} }
my $x = bless [], "FreezeHookDies";
eval { store($x, "store99"); 1 };
Tony Cook [Mon, 15 Apr 2019 00:37:08 +0000 (10:37 +1000)]
Dan Book is now a perl AUTHOR
Dan Book [Fri, 8 Mar 2019 00:34:14 +0000 (19:34 -0500)]
modernize Exporter usage in perlmod module template
TonyC: placate podcheck by wrapping a verbatim line.
Tony Cook [Mon, 15 Apr 2019 00:17:35 +0000 (10:17 +1000)]
Tony Cook [Tue, 26 Mar 2019 03:23:53 +0000 (14:23 +1100)]
(perl #133951) fallback to the built-in getcwd if we can
Tony Cook [Mon, 25 Mar 2019 05:48:40 +0000 (16:48 +1100)]
(perl #133951) add Internals::getcwd
Tony Cook [Mon, 25 Mar 2019 05:11:16 +0000 (16:11 +1100)]
(perl #133951) don't write an invalid lib/buildcustomize.pl
Cwd under miniperl (at this point) can't determine the current
directory if some ancestor directory isn't readable.
So Cwd::getcwd() would return undef, and write_buildcustomize.pl
would write out a list of paths relative to / rather than to the cwd.
Karl Williamson [Sun, 14 Apr 2019 19:03:51 +0000 (13:03 -0600)]
POSIX/t/mb.t: Skip test on early HP-UX
There is a bug in this OS, fixed as of 11.31, in which mblen() doesn't
return the proper result in the UTF-8 locale C.utf8. Any other UTF-8
locales on this platform are broken for another reason, being that a
bunch of what Perl expects to be punctuation characters aren't.
Karl Williamson [Sun, 14 Apr 2019 01:55:56 +0000 (19:55 -0600)]
PATCH: [perl #133997] Assert fail with script runs
The cause of this is the emulation of recursion in executing regex
patterns and that the script run feature did not cooperate with it. The
result is that the input pointers got pushed (but not the script run)
and popped, so that the script run was pointing to something that had
been tried, failed and otherwise popped.
The solution I've adopted is to always push the current script run start
position whenever a push is done; and pop it whenever a pop is done.
If someone has suggestions about this code, please step forward.
Karl Williamson [Sat, 13 Apr 2019 22:24:53 +0000 (16:24 -0600)]
embed.fnc: Add comment
I meant to do this in the previous commit
Karl Williamson [Wed, 27 Mar 2019 03:54:03 +0000 (21:54 -0600)]
Make a few parse fcns accessible to B::Hooks::Parser
This module had made copies of three functions from toke.c many releases
ago, and they stagnated. Most outside code has no business calling
them, but the least worst choice I believe is to make them accessible,
but hide that fact.
This commit makes them accessible to modules that have defined PERL_EXT.
It does not document their API's, and marks them as subject to change,
so they aren't even listed as available in the docs. In other words,
you'd have to really go digging to find out you could use them.
And the API of two of the three had changed since the code was
originally stolen. So that "subject to change" actually has happened.
We should feel free to change the API as needed, and B::Hooks::Parser
will have to be updated.
Thanks to Tony Cook for advising me on this area unfamiliar to me.
Karl Williamson [Sat, 13 Apr 2019 18:16:45 +0000 (12:16 -0600)]
Merge branch 'minitest' into blead
These commits get minitest passing again.
One test had a wrong skip count.
But most were due to locale handling not being available under minitest.
This is because the ability to change locales requires the POSIX module
which has XS code and which is not loadable under miniperl.
loc_tools.pl was revised to say that locales aren't enabled under
minitest. Most tests that deal with locales check that and skip the
tests that rely on it, so this fixed most of the problems.
And there was one sub in loc_tools that assumed locale handling was
enabled, without checking.
And a couple of lines in one test had to be revised to get around a
bareword warning that doesn't show up if POSIX had been loaded.
Spotted by Hugo++ van der Sanden
Karl Williamson [Sat, 13 Apr 2019 18:07:52 +0000 (12:07 -0600)]
t/op/lc.t: Fix bareword warning
Use an &POSIX::LC_CTYPE instead of bareword LC_CTYPE, as when locales
aren't available the latter isn't legal under 'strict'.
Karl Williamson [Sat, 13 Apr 2019 18:04:29 +0000 (12:04 -0600)]
t/loc_tools.pl: No setlocale when no locales
Don't call this function unconditionally. There may be no locale
handling available, so check that first.
Karl Williamson [Sat, 13 Apr 2019 18:01:40 +0000 (12:01 -0600)]
t/loc_tools.pl: miniperl can't use locale handling
Assume there is no locale handling on this system in the function
locales_enabled() if we are operating (as in minitest) without the boot
loader, as they can't be accessed because the POSIX module which
contains setlocale() can't be loaded.
Karl Williamson [Sat, 13 Apr 2019 18:01:02 +0000 (12:01 -0600)]
t/op/magic.t: Fix skip count
Karl Williamson [Fri, 12 Apr 2019 21:28:54 +0000 (15:28 -0600)]
Reinstate and fix failing POSIX mb.t test
Somehow I had pushed to blead a draft version of the test, rather than
the final one that actually should work. The draft is what got reverted
by
8cc54175018f1cabb5c0354371c9e2ee24f8ee5a. Reinstate the test,
corrected.
Karl Williamson [Fri, 12 Apr 2019 21:45:32 +0000 (15:45 -0600)]
PATCH: [perl #134004] BBC breaks Unicode::CharWidth
A user-defined property \p{IsFoo} is package specific, and can be
specified with :: package qualifiers \p{pkg1::pkg2::...::IsFoo}. Some
other package can also define an IsFoo which is totally independent of
the first. These properties are implemented by definining a sub IsFoo()
in the proper package. I used cv_name() to get the fully qualified name
of the sub. The problem with that is that it can evaluate to
pkg1::pkg2::...::_ANON_, for example. What I really want is the
property name IsFoo, fully qualified. This commit changes to do that.
Karl Williamson [Fri, 12 Apr 2019 21:37:34 +0000 (15:37 -0600)]
regcomp.c: Move code into a function
This is in preparation for it to be called from a 2nd place
Karl Williamson [Fri, 12 Apr 2019 20:33:58 +0000 (14:33 -0600)]
perlfunc: Clarify
Karl Williamson [Fri, 12 Apr 2019 19:15:27 +0000 (13:15 -0600)]
sv.c: Silence some warnings
This adds a cast to silence a warning. There could be loss of data, but
this is for the 'j' flag in printf which specifies the size the output
is to be in.
Karl Williamson [Fri, 12 Apr 2019 20:04:05 +0000 (14:04 -0600)]
Merge branch 'warnings' into blead
These several commits silence warnings specific to Microsoft compilers.
They are bogus warnings as far as we can determine, but persist through
many versions of the compilers.
commit
6879a07bc8b8e75c35d0e3b765ea718cc1c7aeb2
*Author: Tomasz Konojacki <me@xenu.pl>
Date: Thu Apr 4 22:39:38 2019 +0200
implement diagnostics ignore/restore macros for Visual C++
gave the easy infrastructure to turn off such warnings, but adding lines
to take advantage of this makes the code harder to read, and we came up
with alternative methods to shut the compiler up that are less
intrusive, involving casting, and subtracting from 0 instead of a unary
minus, that should be valid across platforms.
There were several other warnings I left in, because it would have
required more research than I have time for right now to be sure that
they are bogus.
Karl Williamson [Fri, 12 Apr 2019 19:09:59 +0000 (13:09 -0600)]
pp.c: Silence some MS VC warnings
These are bogus warnings.
Karl Williamson [Fri, 12 Apr 2019 19:14:21 +0000 (13:14 -0600)]
regcomp.c: Silence some MS VC warnings
These are bogus warnings.
Karl Williamson [Fri, 12 Apr 2019 19:13:41 +0000 (13:13 -0600)]
sv.c: Silence some MS VC warnings
These are bogus warnings.
Karl Williamson [Fri, 12 Apr 2019 19:11:45 +0000 (13:11 -0600)]
pp_hot.c: Silence some MS VC warnings
These are bogus warnings.
David Mitchell [Fri, 12 Apr 2019 15:18:57 +0000 (16:18 +0100)]
warnings.t: skip some leaky tests
A couple of tests in 7fatal leak, and thus fail, when run under Address
Sanitizer. I have a proper fix for this, but it's too close to 5.30 code
freeze to justify merging it yet. So just skip the problematic tests for
now.
David Mitchell [Fri, 12 Apr 2019 13:06:21 +0000 (14:06 +0100)]
fix leak in Perl_coresub_op()
This sub initially creates a new OP_COREARGS op to be made use of in the
various cases of a following switch statement. But in the specific case
of OP_SELECT, the op isn't actually used, and leaks. So don't allocate
it in this case.
The leak could be reproduced with the one-liner
defined &{"CORE::select"};
and was causing t/op/coresubs.t to fail under Address Sanitiser.
David Mitchell [Tue, 9 Apr 2019 09:33:34 +0000 (10:33 +0100)]
Avoid leak/crash calling CORE::foo()
The compile time code in Perl_ck_entersub_args_core() that converts a
subroutine call like mypos(1,2) into a direct call to the built-in
function, e.g. pos(1,2), doesn't handle too many args well.
The ops associated with the extra args are excised from the op tree,
but aren't freed, and their op_sigparent pointers aren't updated
correctly.
This is noticeable if op_free() is altered to walk the tree using
op_sigparent to walk back up to the parent.
This commit frees any extra args and emits the 'Too many arguments' error
immediately, rather than tripping over later.
David Mitchell [Fri, 12 Apr 2019 13:52:27 +0000 (14:52 +0100)]
fix leak in do { ... } while 0
The op tree for
do X while 0
is simplified to
X
but the const OP for the '0' wasn't being freed and so leaked.
David Mitchell [Thu, 11 Apr 2019 16:19:31 +0000 (17:19 +0100)]
Perl_newLISTOP() allocate OP_PUSHMARK safely
This commit is a prelude to allowing op_free() to make use the parent
pointer at the end of an op_sibling chain to walk a sub-tree to be freed.
newLISTOP() converts 0..2 ops into a list, adding a new parent list op
and possibly a pushmark op. However, under Safe.pm, and specifically in
dist/Safe/t/safeops.t, allocating a pushmark can croak. If the optree
under construct at this point isn't consistent (specifically the parent
pointer not yet set), then this can crash op_free() while trying to walk
the new list to free it.
The fix is to allocate the OP_PUSHMARK if needed *before* messing with
the structure of the list sub-tree.
James E Keenan [Fri, 12 Apr 2019 12:10:46 +0000 (12:10 +0000)]
Revert "ext/POSIX/t/mb.t: Add test for MB_CUR_MAX"
This reverts commit
858fc58a344c7550c68495d7fe648b39a1a50c0c.
The unit test introduced by the commit fails on many operating systems.
Signed-off-by: James E Keenan <jkeenan@cpan.org>
Tomasz Konojacki [Tue, 9 Apr 2019 21:15:41 +0000 (23:15 +0200)]
win32/Makefile: minor cleanup
Apart from the indentation fixes, the most notable change is
replacing constructs like this one:
!ELSE
!IF foo
!ENDIF
!ENDIF
with more readable:
!ELSEIF foo
!ENDIF
[perl #134014]
Karl Williamson [Tue, 9 Apr 2019 18:09:34 +0000 (12:09 -0600)]
mktables: Generalize handling of [perl #133979]
I realized that commit
f9c1e7e9ed13a16099c8471c2030b93deb482571
works now, but future Unicode versions may add fractions that fool it.
This commit should handle any such event
Karl Williamson [Sat, 6 Apr 2019 18:38:56 +0000 (12:38 -0600)]
PATCH: [perl #133992] Assertion failure in scan_const
I haven't done the digging, but this appears to be a failure to include
UTF-8 processing when 'use utf8' was added to Perl.
The code that was causing this in toke.c had found a qr/(?#... beginning
of comment in a pattern. It attempted to space up to but not including
the final character, which is handled later. (In most instances that
final character is a single-byte ')', but not in this test case. It
spaced per-byte. The problem is that if the final character is in UTF-8
and isn't a single byte, it leaves the input position pointing at the
final byte of that character, which creates malformed UTF-8, which the
assertion discovered.
The fix is to be cognizant that this is UTF-8 when spacing to the end,
so that the final position begins at the first byte of it.
Karl Williamson [Wed, 10 Apr 2019 18:54:30 +0000 (12:54 -0600)]
toke.c: Add assertion
Karl Williamson [Sat, 6 Apr 2019 20:08:49 +0000 (14:08 -0600)]
toke.c: White-space only
This outdents code that was removed from being in a block by the
previous commit.
Karl Williamson [Sat, 6 Apr 2019 20:05:29 +0000 (14:05 -0600)]
toke.c: Streamline a case
When we are parsing a constant, and the source and destination differ in
UTF-8ness, I realized, in single stepping through the code, that it's
simpler and more efficient to split these into two cases, rather than
try to do one case with some conditionals in the middle.
Karl Williamson [Sat, 6 Apr 2019 19:07:24 +0000 (13:07 -0600)]
toke.c: Change names of two variables
has_utf8 vs is_utf8. One means the source is utf8; the other that the
dest is utf8. But I could never remember which was which. Change so
that is obvious
Karl Williamson [Sat, 6 Apr 2019 18:29:07 +0000 (12:29 -0600)]
toke.c: Use local variable instead of global
These two lines used a PL_ variable, whereas every other use in this
function is a local copy of it. Change for consistency.
Karl Williamson [Wed, 10 Apr 2019 02:34:48 +0000 (20:34 -0600)]
t/re/pat.t: Silence 'wide char' warning
This was introduced in
0a5ed81e6617c9229cc1ea042e9a70c3ec63fd65
Karl Williamson [Wed, 10 Apr 2019 02:22:34 +0000 (20:22 -0600)]
PATCH: [perl #133999] Assertion failure in regex match
This was caused by failing to limit matching to within the bounds of the
target string. I'm pretty sure this bug has long been there, but was
exposed by the recently added wildcard property matching feature.
Karl Williamson [Wed, 10 Apr 2019 00:53:53 +0000 (18:53 -0600)]
PATCH: [perl #133995], Assertion failure in regmatch
This was due to my forgetting that when the positive operation can only
match UTF-8 invariant characters, the complement of it can match
variants. The only change needed is to pass the utf8ness to the macro
that does the work.
Karl Williamson [Sun, 7 Apr 2019 04:47:42 +0000 (22:47 -0600)]
regcomp.c: White space only
Indent the block newly formed in the previous commit.
Karl Williamson [Sun, 7 Apr 2019 04:42:05 +0000 (22:42 -0600)]
PATCH: [perl #133998] regcomp assertion failure
This was caused in the blamed commit by me thinking I could simplify too
much. So this commit puts back in checking specially for things like
/[\s\S]/l, which has to match every possible code point no matter what
the locale.
Steve Hay [Thu, 4 Apr 2019 17:08:52 +0000 (18:08 +0100)]
Add support for VS2019 (Visual C++ 14.2)
This also fixes LINK_FLAGS for VS2017 (Visual C++ 14.1): The subsystem
setting was missed in the changes to add VS2017 support, which was surely
just an oversight.
Karl Williamson [Wed, 3 Apr 2019 19:36:40 +0000 (13:36 -0600)]
ext/POSIX/t/mb.t: Add test for MB_CUR_MAX
Karl Williamson [Wed, 3 Apr 2019 19:17:56 +0000 (13:17 -0600)]
Make POSIX::mblen() slightly safer
by using a mutex around its call
Karl Williamson [Wed, 3 Apr 2019 18:20:08 +0000 (12:20 -0600)]
ext/POSIX/t/mb.t: Use actual expected char len
Some platforms want the precise number of expected bytes passed to
mblen(), not just some maximum.
Karl Williamson [Wed, 3 Apr 2019 18:14:19 +0000 (12:14 -0600)]
ext/POSIX/t/mb.t: Generalize for EBCDIC
Unicode Consortium [Tue, 2 Apr 2019 16:03:14 +0000 (10:03 -0600)]
Preliminary Unicode 12.1
Brian Greenfield [Mon, 8 Apr 2019 13:42:30 +0000 (09:42 -0400)]
Spelling correction in documentation.
Karl Williamson [Sun, 7 Apr 2019 00:00:58 +0000 (18:00 -0600)]
mktables: White-space only
Indent block newly formed in previous commit
Karl Williamson [Sat, 6 Apr 2019 23:51:13 +0000 (17:51 -0600)]
PATCH: [perl #133979] uniprops02 failing on Windows
This turns out to be because Windows doesn't necessarily round to even
on floating point %e conversions. The solution is to add an extra entry
rounding up to odd when a fraction is precisely representable in binary.
So far, the only case where this occurs is 1/32.
Tomasz Konojacki [Thu, 4 Apr 2019 20:39:38 +0000 (22:39 +0200)]
implement diagnostics ignore/restore macros for Visual C++
Karl Williamson [Fri, 5 Apr 2019 22:34:21 +0000 (16:34 -0600)]
PATCH: [perl #133988], Assertion failure
This was due to not checking that a \N{} expanded to a single code point
in contexts where only that is legal. This never could have worked
properly, though the assertion failure is new.
The diagnostic needs to be reworded to accommodate this new case, but
its too late in the 5.29 cycle to do that, so I'm changing just the
description, and will reword in 5.31, [perl #133996]
Karl Williamson [Fri, 5 Apr 2019 22:21:51 +0000 (16:21 -0600)]
PATCH: [perl #133896] Assertion failure
This was due to UTF8_SAFE_SKIP(s, e) not allowing s to be as large as e,
and there are legitimate cases where it can be. This commit hardens the
macro so that it never reads above e-1, returning 0 if it otherwise
would be required to. The assertion is changed to 's <= e'.
Karl Williamson [Fri, 5 Apr 2019 22:26:36 +0000 (16:26 -0600)]
regcomp.c: Change name of variable
This better reflects its use.
Karl Williamson [Fri, 5 Apr 2019 22:25:29 +0000 (16:25 -0600)]
regcomp.c: Consolidate code
This uses gotos to handle an identical panic case, instead of
duplicating the code.
Karl Williamson [Fri, 5 Apr 2019 23:04:38 +0000 (17:04 -0600)]
porting/diag.t: Allow nested =item's
This enhances this test to allow perldiag to have the descriptions of
error messages to contain =item lists (previously only bullet item lists
were allowed).
Karen Etheridge [Fri, 5 Apr 2019 20:54:19 +0000 (13:54 -0700)]
fix typo
Steve Hay [Fri, 5 Apr 2019 20:04:52 +0000 (21:04 +0100)]
5.28.2 should arrive this month
Also: 5.29.9 was released.
Steve Hay [Fri, 5 Apr 2019 20:01:29 +0000 (21:01 +0100)]
Add epigraph for 5.28.2-RC1
Steve Hay [Fri, 5 Apr 2019 18:34:10 +0000 (19:34 +0100)]
5.28.2-RC1 today
David Mitchell [Fri, 5 Apr 2019 16:01:53 +0000 (17:01 +0100)]
fixup to 'change LABEL type from pval to opval'
Commit v5.29.9-68-g017192018b broke g++ builds. Spotted by Karl.
David Mitchell [Fri, 5 Apr 2019 11:49:50 +0000 (12:49 +0100)]
parser: change LABEL type from pval to opval
The items pushed onto the parser stack can be one of several types:
ival, opval, pval etc. The only remaining use of pval is when a "label:"
is encountered.
When an error occurs during parsing, ops on the parse stack get
automatically reaped these days as part of the OP slab mechanism;
but bare strings (pvals) still leak.
Convert this one remaining pval into an opval, making the toker return
an OP_CONST with an SV holding the label.
Since newSTATEOP() still expects a raw string for the label, the parser
just grabs the value returned by the toker and makes a copy of the
string from it, then immediately frees the OP_CONST and its associated
SV.
The leak was showing up in ext/XS-APItest/t/stmtasexpr.t, which expects
to parse a statement where labels are banned.
Karl Williamson [Thu, 4 Apr 2019 15:12:29 +0000 (09:12 -0600)]
Define $d_has_C_UTF8 in Windows config files
Otherwise it gets an uninitialized warning.
Karl Williamson [Thu, 4 Apr 2019 19:44:22 +0000 (13:44 -0600)]
Partial patch for [perl #133970] Roman::Unicode broken
Wrap a call out to Perl code with PUSH/POP stacks.
This gets this module working again, and maybe head off some other smoke
failures, but there are other things needed, including tests, that I'm
working on.
Steve Hay [Thu, 28 Mar 2019 22:51:09 +0000 (22:51 +0000)]
Karl Williamson [Thu, 4 Apr 2019 18:49:41 +0000 (12:49 -0600)]
mktables: Turn off DEBUG
This inadvertently was left on, slowing down the process a little
Karl Williamson [Thu, 4 Apr 2019 03:22:29 +0000 (21:22 -0600)]
Silence some compiler warnings
Most of these are from Win32.
David Mitchell [Thu, 4 Apr 2019 13:38:50 +0000 (14:38 +0100)]
fix leak in Perl_vload_module()
This function allocates a few ops, then calls Perl_utilize().
If the latter function croaks early on, those ops will be leaked,
because they won't yet have been linked into the optree.
In particular, newUNOP(OP_REQUIRE, ...) can die if passed a non-valid
module name.
This can be fixed by moving the start_subparse() call to the start of
Perl_vload_module(), before any op allocations. start_subparse() creates
a new PL_compcv, and so any ops allocated afterwards will come from that
CV's slab rather than being directly malloc()ed. On death, the CV will
be freed and its op slab will be scanned and any ops found there freed.
The leak was showing up in ext/XS-APItest/t/load-module.t under ASan.
Karl Williamson [Wed, 3 Apr 2019 18:06:47 +0000 (12:06 -0600)]
t/charset_tools.pl: Add comments
Karl Williamson [Wed, 3 Apr 2019 20:27:00 +0000 (14:27 -0600)]
newlocale() has a problem in openbsd
And therefore we can't use it, until fixed.
https://marc.info/?l=openbsd-bugs&m=
155364568608759&w=2
Karl Williamson [Wed, 3 Apr 2019 20:31:05 +0000 (14:31 -0600)]
numeric.c: Change formal parameter to be const
as embed.fnc says it should be
Karl Williamson [Wed, 3 Apr 2019 16:25:26 +0000 (10:25 -0600)]
PATCH: [perl #133978] BBC breaks Jcode
This turned out to be caused by taking another macro as a template
without understanding the subtleties. In this case, the variable
'previous_occurrence_end' should be updated only if 'COND' is true. (In
the template the COND was implicitly true)
David Mitchell [Wed, 3 Apr 2019 15:11:54 +0000 (16:11 +0100)]
Avoid leaks in Perl_custom_op_get_field()
In 5.14.0 a new API was introduced to register details for custom ops.
Normally the caller supplies a pointer to a static xop struct with
details for the op, which gets gets added via a hidden
newSViv(PTR2IV(xop))
to PL_custom_ops values.
However, Perl_custom_op_get_field() also supports the older interface,
where name and desc entries were registered in PL_custom_op_names and
PL_custom_op_descs.
If it doesn't find an entry in PL_custom_ops, but does in
PL_custom_op_names, it fakes up a new-API registration in PL_custom_ops.
In this case the xop struct, and the name and description attached to it,
were leaking.
This commit fixes the leak by attaching magic to such newSViv(PTR2IV(xop))
SVs which frees the struct and strings.
David Mitchell [Wed, 3 Apr 2019 13:14:13 +0000 (14:14 +0100)]
fix leak in Devel-PPPort
The leaky code is only used during test. It creates 3 ops, does various
operations related to linking OpSIBLINGs, then fails to free them.
David Mitchell [Wed, 3 Apr 2019 12:23:24 +0000 (13:23 +0100)]
Data::Dumper - avoid leak on croak
v5.21.3-742-g19be3be696 added a facility to Dumper.xs to croak if the
recursion level became too deep (1000 by default).
The trouble with this is that various parts of DD_dump() allocate
temporary SVs and buffers, which will leak if DD_dump() unceremoniously
just croaks().
This currently manifests as dist/Data-Dumper/t/recurse.t failing under
Address Sanitiser.
This commit makes the depth checking code just set a sticky 'too deep'
boolean flag, and
a) on entry, DD_dump() just returns immediately if the flag is set;
b) the flag is checked by the top-level called of DD_dump() and croaks
if set.
So the net effect is to defer croaking until the dump is complete,
and avoid any further recursion once the flag is set.
This is a bit of a quick fix. More long-term solutions would be to
convert DD_dump() to be iterative rather than recursive, and/or make
sure all temporary SVs and buffers are suitably anchored somewhere so
that they get cleaned up on croak.
David Mitchell [Wed, 3 Apr 2019 10:06:22 +0000 (11:06 +0100)]
Fix recent double free in S_parse_gv_stash_name()
RT #133977
My recent commit v5.29.9-29-g657ed7c1c1 moved all buffer freeing to
the end of the function, but missed removing one of the existing frees.
The problem was spotted by James E Keenan and diagnosed by Tony Cook; I just
added a test.
A simple reproducer is
my $def = defined *{"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'x"};
Unicode Consortium [Tue, 2 Apr 2019 15:27:08 +0000 (09:27 -0600)]
Corrections to Unicode 12.0
Somehow I missed updating some files with the result that a few official
12.0 final corrections did not make it into
906f46d96ca4ba2d1039d576954bc5a47868348c.
These are mostly tests and break property changes for a few characters
David Mitchell [Tue, 2 Apr 2019 09:05:37 +0000 (10:05 +0100)]
fix locale.c under -DPERL_GLOBAL_STRUCT_PRIVATE
Karl Williamson [Sun, 31 Mar 2019 19:50:09 +0000 (13:50 -0600)]
handy.h: Parenthesize formal parameters in macro defn
These should be parenthesized to prevent issues when called with an
expression.
Alberto Simões [Sun, 31 Mar 2019 09:49:54 +0000 (10:49 +0100)]
Update EU::CBuilder to 0.280231
Committer: additional email address for contributor
James E Keenan [Sat, 30 Mar 2019 20:26:07 +0000 (16:26 -0400)]
Ed J [Sat, 30 Mar 2019 19:51:53 +0000 (15:51 -0400)]
quotemeta the stuff intended literally in RE
For: RT 133966
Committer: Bump $VERSION in dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
Karl Williamson [Thu, 21 Mar 2019 22:09:41 +0000 (16:09 -0600)]
regcharclass.h: Change to use new inRANGE macro
This was done by changing regen/regcharclass.pl. This results in half
the conditionals being needed, and in some cases better error checking.
Karl Williamson [Fri, 29 Mar 2019 18:57:40 +0000 (12:57 -0600)]
regexec.c: Use first byte info in ANYOFH
Commit
765e6ecf32a570694dcff91c1c72f98306a9390e changed ANYOFH regnodes
to note if the first byte of all code points matched is the same. When
that is the case we can potentially speed up matching by only trying to
match at points in the input where that byte occurs. Since ANYOFH nodes
match only UTF-8 encoded strings, that first byte is going to be a UTF-8
start byte. If that is uncommon in the target string, this is a real
winner.
Karl Williamson [Sun, 24 Mar 2019 03:29:51 +0000 (21:29 -0600)]
Remove zero length valgrind files at end.
This resolves [perl #131135]