This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
5 years agoDevel-PPPort/parts/inc/misc: Sort =provides section
Karl Williamson [Mon, 1 Apr 2019 19:41:23 +0000 (13:41 -0600)]
Devel-PPPort/parts/inc/misc: Sort =provides section

This makes it easier to see if it corresponds to what's implemented

5 years agoAdd/fix character classification macros, like isDIGIT
Karl Williamson [Thu, 18 Apr 2019 20:57:34 +0000 (14:57 -0600)]
Add/fix character classification macros, like isDIGIT

5 years agoUpdate apidoc.fnc, embed.fnc to 5.30
Karl Williamson [Fri, 19 Apr 2019 22:09:21 +0000 (16:09 -0600)]
Update apidoc.fnc, embed.fnc to 5.30

my_sprintf has been removed from blead, but is furnished here, so it
can't be removed.

5 years agoHACKERS: Fix typo, clarify
Karl Williamson [Mon, 1 Apr 2019 19:51:38 +0000 (13:51 -0600)]
HACKERS: Fix typo, clarify

5 years agoPOSIX.xs: Use new inRANGE macro
Karl Williamson [Thu, 28 Mar 2019 03:22:59 +0000 (21:22 -0600)]
POSIX.xs: Use new inRANGE macro

5 years agohandy.h: Make inRANGE more robust
Karl Williamson [Sat, 20 Apr 2019 06:17:42 +0000 (00:17 -0600)]
handy.h: Make inRANGE more robust

It turns out that in order to make this work or assert if it won't, it
needs to be more complicated.  The problem has to do with signed and
unsigned operands.  It now special cases where the item being checked to
be in the range is a char, and casts that to a U8.  Otherwise, there is
a problem when that is a negative signed type and the range is above the
int_max for that type.  An assert is added to detect this rare event
(not rare for chars, hence the special case).  The use of sizeof() for
this case means that it will be resolved at compile time and not
generate extra code.  I did an experiment, and gcc even under -O0
compiled away the sizeof() clause.

As an example of why this is needed, suppose we have a signed char,
-127, and we want to see if it is in the range 128-130, expressed as
ints.  Without casting that -127 to an unsigned char, it would subtract
128 from -127, yield -255, which when cast to an unsigned int would be
wrong.  But casting the -127 to U8 first yields 129, and gives the
correct result.  The same issue could happen wih ints if the range is
above INT_MAX, but that is a much rarer case, and this macro asserts
against it.

5 years agoext/POSIX/t/mb.t: Skip a test on early HP-UX
Karl Williamson [Fri, 19 Apr 2019 21:33:10 +0000 (15:33 -0600)]
ext/POSIX/t/mb.t: Skip a test on early HP-UX

This was fixed by the time of 11.31

5 years agot/op/sprintf2.t - Mark failing tests as TODO with VC++ prior to VC14
Steve Hay [Fri, 19 Apr 2019 18:27:05 +0000 (19:27 +0100)]
t/op/sprintf2.t - Mark failing tests as TODO with VC++ prior to VC14

See perl #133982.

5 years agoSilence Cwd.pm warning on Android builds if targetsh is not defined
Richard Leach [Tue, 16 Apr 2019 20:07:00 +0000 (20:07 +0000)]
Silence Cwd.pm warning on Android builds if targetsh is not defined

5 years agoregcomp.c: Copy some safeguards from swash_init()
Karl Williamson [Fri, 19 Apr 2019 16:56:48 +0000 (10:56 -0600)]
regcomp.c: Copy some safeguards from swash_init()

Moving \p{user-defined} into core C code instead of utf8_heavy.pl
removes it from using swash_init(), instead calling the user sub
directly.  At the suggestion of Tony Cook, this commit cargo cults some
precautions that swash_init() did before calling utf8_heavy (which in
turn called the user sub).  Some of these make sense, but some we're
doing because swash_init() did, and presumably it had reasons to.  (git
blame doesn't really help).

5 years agoext/POSIX/t/posix.t: Clarify tests
Karl Williamson [Fri, 19 Apr 2019 16:35:12 +0000 (10:35 -0600)]
ext/POSIX/t/posix.t: Clarify tests

These tests, added in 693d95f399039f4aa96bb6737166aeeb546e5350, may be
confusing, due to truncation due to precision in any failing output.
This changes the test name to include a caveat.

5 years agoMake note of the test failures reportied in perl #133981
Steve Hay [Fri, 19 Apr 2019 16:36:22 +0000 (17:36 +0100)]
Make note of the test failures reportied in perl #133981

5 years agoCheck that perl and POSIX::strtod assign same value
sisyphus [Tue, 16 Apr 2019 12:09:20 +0000 (22:09 +1000)]
Check that perl and POSIX::strtod assign same value

5 years agoCreate Strtod()
Karl Williamson [Thu, 18 Apr 2019 04:22:48 +0000 (22:22 -0600)]
Create Strtod()

This commit creates my_strod() and a synonym, Strtod(), to emulate
strtod() using the most precise function known to us that is available
on the platform.  strtod() is not in K&R, but is in C90, so atof() may
be silently substituted instead on those few platforms without it.

This function also correctly handles locale issues, such as if the radix
character should be a dot or comma (or something else) depending on the
parent perl code is using locale or not, and which locale.

The symbol Perl_strtod continues to be defined on platforms which have
some version of strtod(), for backward compatibility, and can be called
as a function (or rather macro) but most applications should just use
Strtod() and not sweat the details.

This commit also fixes the problems with the prior commit:
    commit 4ac6fab20b8950ee14756c6f2438809c572082cd
     Author: Karl Williamson <khw@cpan.org>
     Date:   Mon Apr 15 11:10:31 2019 -0600

         PATCH: [perl #133945] Perl_strtod failures

         This commit wraps Perl_strtod() in macros that cause the proper
         radix character to be used.

5 years agot/op/taint.t - Skip failing test on Windows
Steve Hay [Fri, 19 Apr 2019 16:18:21 +0000 (17:18 +0100)]
t/op/taint.t - Skip failing test on Windows

As khw points out on perl #133980, other environment tainting tests are
skipped on Windows (and other platforms) already so it is probably wise
to do likewise for this test too. (It would be nice to understand why the
skip is necessary, though, so leaving ticket open for now...)

5 years agot/io/perlio.t: skips tests if no /tmp
Richard Leach [Tue, 16 Apr 2019 18:59:35 +0000 (18:59 +0000)]
t/io/perlio.t: skips tests if no /tmp

This skips tests that expect there to be a /tmp if there isn't one.

Committer: changed commit message

5 years agoRichard Leach is now a Perl author
Karl Williamson [Fri, 19 Apr 2019 16:07:28 +0000 (10:07 -0600)]
Richard Leach is now a Perl author

5 years agoImport perl5282delta.pod
Steve Hay [Fri, 19 Apr 2019 15:44:32 +0000 (16:44 +0100)]
Import perl5282delta.pod

5 years agoUpdate Unicode 12.1
Karl Williamson [Fri, 19 Apr 2019 15:19:35 +0000 (09:19 -0600)]
Update Unicode 12.1

This takes the few latest changes in the draft Unicode 12.1, ahead of
our freeze.  None are substantive.  No further non-substantive changes
will be added, except in the unlikely event that a substantive change is
made, we will take it and potentially delay Perl 5.30.

5 years agoUpdate Module-CoreList with data for 5.28.2
Steve Hay [Fri, 19 Apr 2019 15:37:35 +0000 (16:37 +0100)]
Update Module-CoreList with data for 5.28.2

5 years agoTick off 5.28.2
Steve Hay [Fri, 19 Apr 2019 15:17:17 +0000 (16:17 +0100)]
Tick off 5.28.2

5 years agoAdd epigraph for 5.28.2
Steve Hay [Fri, 19 Apr 2019 15:16:20 +0000 (16:16 +0100)]
Add epigraph for 5.28.2

5 years agoregcomp.c: Add more taint checking for \p{user-defined}
Karl Williamson [Fri, 19 Apr 2019 15:02:02 +0000 (09:02 -0600)]
regcomp.c: Add more taint checking for \p{user-defined}

User-defined properties are implemented as perl subs.  Prior to this
commit, if tainting had been found during pattern compilation, the sub
wasn't called, and the compilation aborted.  This commit adds checking
that the return of the sub isn't tainted, and if it is tainted, aborts

5 years ago5.28.2 today
Steve Hay [Fri, 19 Apr 2019 14:12:43 +0000 (15:12 +0100)]
5.28.2 today

5 years agoupdate Porting/deparse-skips.txt
David Mitchell [Fri, 19 Apr 2019 12:05:01 +0000 (13:05 +0100)]
update Porting/deparse-skips.txt

Remove 3 test scripts from the list which were expected to fail under
'TEST -deparse', but which now succeed.

This is likely to be due to unrelated changes to those scripts rather
than any specific bug fixes in Deparse.pm itself.

5 years agoDeparse: mark "$a[0]\[1]" TODO
David Mitchell [Fri, 19 Apr 2019 11:57:48 +0000 (12:57 +0100)]
Deparse: mark "$a[0]\[1]" TODO

Currently Deparse fails to output a backslash, turning the result
into a multi-dimensional array lookup. This is a long-standing fault.
For now, mark it TODO, and remove the construct from uni/fold.t, which is
where I first spotted the issue by running 'TEST -deparse'.

5 years agoext/File-Glob/t/rt131211.t: fix timing issues #2
David Mitchell [Fri, 19 Apr 2019 11:38:33 +0000 (12:38 +0100)]
ext/File-Glob/t/rt131211.t: fix timing issues #2

Commit v5.27.8-405-gf548aeca98 from a year ago tweaked this
timing-sensitive test script to reduce false positives.
However, we're still seeing the occasional failure of test 2 in smokes,
so twaks the timing a little further.

5 years agoupgrade Module-Metadata to 1.000036
Karen Etheridge [Thu, 18 Apr 2019 18:29:31 +0000 (11:29 -0700)]
upgrade Module-Metadata to 1.000036

1.000036  2019-04-18 18:25:15Z
  - properly clean up temp dirs after testing

5 years agointrpvar.h: Add emphasis to comment
Karl Williamson [Thu, 18 Apr 2019 16:06:47 +0000 (10:06 -0600)]
intrpvar.h: Add emphasis to comment

5 years agoext/I18N-Langinfo/Langinfo.pm: Fix comments
Karl Williamson [Thu, 18 Apr 2019 16:02:37 +0000 (10:02 -0600)]
ext/I18N-Langinfo/Langinfo.pm: Fix comments

5 years agoRevert "ignore new temp dirs"
Karen Etheridge [Thu, 18 Apr 2019 18:09:34 +0000 (11:09 -0700)]
Revert "ignore new temp dirs"

This reverts commit 94945d95701937a050ccc231eafa0087c9a74ee3.

These temp dirs should never be created in the repository itself (if
they are, that's a bug!)

5 years agoignore new temp dirs
Karen Etheridge [Thu, 18 Apr 2019 03:22:55 +0000 (20:22 -0700)]
ignore new temp dirs

5 years agoupgrade Module-Metadata to 1.000035
Karen Etheridge [Thu, 18 Apr 2019 02:50:09 +0000 (19:50 -0700)]
upgrade Module-Metadata to 1.000035

1.000035  2019-04-18 02:43:11Z
  - quieten noisy tests (issue #31)

1.000034  2018-07-19 20:26:18Z (TRIAL RELEASE)
  - fix how relative paths are absolutized, so they work properly on MSWin32
    (Christian Walde, PR#24)

5 years agoRevert "skip leaky Storable tests"
David Mitchell [Wed, 17 Apr 2019 08:25:26 +0000 (09:25 +0100)]
Revert "skip leaky Storable tests"

This reverts commit 2cf75007609600e27520fb4e25a34103543889ca.

The problem the tests were skipped has been resolved by
v5.29.9-142-g1d7b2a7e3a

5 years agos/safefree()/Safefree() in a few places
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.

5 years agomktables: Silence warning
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

5 years agofree pseen in the magic free code
Tony Cook [Wed, 17 Apr 2019 01:10:13 +0000 (11:10 +1000)]
free pseen in the magic free code

5 years agofix leak when $LANG unset
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.

5 years agofix locale leaks on utf8 strings
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

5 years agofix locale leak on zero-length strings
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

5 years agohandle an ASAN specific section name parsing nm output on darwin origin/tonyc/libperl-asan
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.

5 years agoext/POSIX/t/mb.t: Fix osvers= syntax checking
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.

5 years agoPATCH: [perl #133945] Perl_strtod failures
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.

5 years agoPATCH: [perl #134034] Assert fail in pattern match
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.

5 years agoPATCH: [perl #134029] Fail assert in pattern wildcard
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.

5 years agoskip leaky Storable tests
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 };

5 years agoDan Book is now a perl AUTHOR
Tony Cook [Mon, 15 Apr 2019 00:37:08 +0000 (10:37 +1000)]
Dan Book is now a perl AUTHOR

5 years agomodernize Exporter usage in perlmod module template
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.

5 years agoperldelta for 05fed879afad, 15f67d146cf1, 0a4d1779402e
Tony Cook [Mon, 15 Apr 2019 00:17:35 +0000 (10:17 +1000)]
perldelta for 05fed879afad15f67d146cf10a4d1779402e

5 years ago(perl #133951) fallback to the built-in getcwd if we can
Tony Cook [Tue, 26 Mar 2019 03:23:53 +0000 (14:23 +1100)]
(perl #133951) fallback to the built-in getcwd if we can

5 years ago(perl #133951) add Internals::getcwd
Tony Cook [Mon, 25 Mar 2019 05:48:40 +0000 (16:48 +1100)]
(perl #133951) add Internals::getcwd

5 years ago(perl #133951) don't write an invalid lib/buildcustomize.pl
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.

5 years agoPOSIX/t/mb.t: Skip test on early HP-UX
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.

5 years agoPATCH: [perl #133997] Assert fail with script runs
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.

5 years agoembed.fnc: Add comment
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

5 years agoMake a few parse fcns accessible to B::Hooks::Parser
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.

5 years agoMerge branch 'minitest' into blead
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

5 years agot/op/lc.t: Fix bareword warning
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'.

5 years agot/loc_tools.pl: No setlocale when no locales
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.

5 years agot/loc_tools.pl: miniperl can't use locale handling
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.

5 years agot/op/magic.t: Fix skip count
Karl Williamson [Sat, 13 Apr 2019 18:01:02 +0000 (12:01 -0600)]
t/op/magic.t: Fix skip count

5 years agoReinstate and fix failing POSIX mb.t test
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.

5 years agoPATCH: [perl #134004] BBC breaks Unicode::CharWidth
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.

5 years agoregcomp.c: Move code into a function
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

5 years agoperlfunc: Clarify
Karl Williamson [Fri, 12 Apr 2019 20:33:58 +0000 (14:33 -0600)]
perlfunc: Clarify

5 years agosv.c: Silence some warnings
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.

5 years agoMerge branch 'warnings' into blead
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.

5 years agopp.c: Silence some MS VC warnings
Karl Williamson [Fri, 12 Apr 2019 19:09:59 +0000 (13:09 -0600)]
pp.c: Silence some MS VC warnings

These are bogus warnings.

5 years agoregcomp.c: Silence some MS VC 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.

5 years agosv.c: Silence some MS VC 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.

5 years agopp_hot.c: Silence some MS VC 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.

5 years agowarnings.t: skip some leaky tests
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.

5 years agofix leak in Perl_coresub_op()
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.

5 years agoAvoid leak/crash calling CORE::foo()
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.

5 years agofix leak in do { ... } while 0
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.

5 years agoPerl_newLISTOP() allocate OP_PUSHMARK safely
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.

5 years agoRevert "ext/POSIX/t/mb.t: Add test for MB_CUR_MAX"
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>
5 years agowin32/Makefile: minor cleanup
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]

5 years agomktables: Generalize handling of [perl #133979]
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

5 years agoPATCH: [perl #133992] Assertion failure in scan_const
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.

5 years agotoke.c: Add assertion
Karl Williamson [Wed, 10 Apr 2019 18:54:30 +0000 (12:54 -0600)]
toke.c: Add assertion

5 years agotoke.c: White-space only
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.

5 years agotoke.c: Streamline a case
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.

5 years agotoke.c: Change names of two variables
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

5 years agotoke.c: Use local variable instead of global
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.

5 years agot/re/pat.t: Silence 'wide char' warning
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

5 years agoPATCH: [perl #133999] Assertion failure in regex match
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.

5 years agoPATCH: [perl #133995], Assertion failure in regmatch
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.

5 years agoregcomp.c: White space only
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.

5 years agoPATCH: [perl #133998] regcomp assertion failure
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.

5 years agoAdd support for VS2019 (Visual C++ 14.2)
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.

5 years agoext/POSIX/t/mb.t: Add test for MB_CUR_MAX
Karl Williamson [Wed, 3 Apr 2019 19:36:40 +0000 (13:36 -0600)]
ext/POSIX/t/mb.t: Add test for MB_CUR_MAX

5 years agoMake POSIX::mblen() slightly safer
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

5 years agoext/POSIX/t/mb.t: Use actual expected char len
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.

5 years agoext/POSIX/t/mb.t: Generalize for EBCDIC
Karl Williamson [Wed, 3 Apr 2019 18:14:19 +0000 (12:14 -0600)]
ext/POSIX/t/mb.t: Generalize for EBCDIC

5 years agoPreliminary Unicode 12.1
Unicode Consortium [Tue, 2 Apr 2019 16:03:14 +0000 (10:03 -0600)]
Preliminary Unicode 12.1

5 years agoSpelling correction in documentation.
Brian Greenfield [Mon, 8 Apr 2019 13:42:30 +0000 (09:42 -0400)]
Spelling correction in documentation.

5 years agomktables: White-space only
Karl Williamson [Sun, 7 Apr 2019 00:00:58 +0000 (18:00 -0600)]
mktables: White-space only

Indent block newly formed in previous commit

5 years agoPATCH: [perl #133979] uniprops02 failing on Windows
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.

5 years agoimplement diagnostics ignore/restore macros for Visual C++
Tomasz Konojacki [Thu, 4 Apr 2019 20:39:38 +0000 (22:39 +0200)]
implement diagnostics ignore/restore macros for Visual C++