This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
6 years agoForbid out of range Unicode code points.
Abigail [Tue, 6 Jun 2017 16:51:37 +0000 (18:51 +0200)]
Forbid out of range Unicode code points.

Unicode allows code points up to 0x10FFFF, but Perl allows much more.
However, code points above IV_MAX may not always work correctly, and
may even cause the interpreter to hang. Code points exceeding IV_MAX
have been deprecated since 5.24, and will be illegal in 5.28.

This commit removes many tests (without replacing them) as they were
testing behaviour of code points exceeding IV_MAX.

6 years ago[PATCH] corelist: Provide access to info on utilities via Module::CoreList::Utils
Thomas Sibley [Tue, 6 Jun 2017 12:11:58 +0000 (13:11 +0100)]
[PATCH] corelist: Provide access to info on utilities via Module::CoreList::Utils

Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
6 years agoPorting/bench.pl: typo in error message
David Mitchell [Mon, 5 Jun 2017 16:14:15 +0000 (17:14 +0100)]
Porting/bench.pl: typo in error message

6 years agoremove -DH (DEBUG_H) misfeature
David Mitchell [Mon, 5 Jun 2017 15:45:32 +0000 (16:45 +0100)]
remove -DH (DEBUG_H) misfeature

RT# 129300

This hash-dumping debugging flag corrupted hash values and has probably
not been used by anyone in 20 years.

6 years agosv.c: move some pod blocks
David Mitchell [Mon, 5 Jun 2017 15:36:08 +0000 (16:36 +0100)]
sv.c: move some pod blocks

The S_sv_uncow() definition, and a forward declaration of it, both get
between some pod and the function that pod describes. Move the pod around
a bit to be next their functions.

6 years agomake OP_REF support boolean context
David Mitchell [Fri, 6 Jan 2017 14:59:54 +0000 (14:59 +0000)]
make OP_REF support boolean context

RT #78288

When ref() is used in a boolean context, it's not necessary to return
the name of the package which an object is blessed into; instead a simple
truth value can be returned, which is faster.

Note that it has to cope with the subtlety of an object blessed into the
class "0", which should return false.

Porting/bench.pl shows for the expression !ref($r), approximately:
    unchanged         for a non-reference $r
    doubling of speed for a reference $r
    tripling of speed for a blessed reference $r

This commit builds on the mechanism already used to set the OPpTRUEBOOL
and OPpMAYBE_TRUEBOOL flags on padhv and rv2hv ops when used in boolean
context.

6 years agoForbid setting $/ to a reference to a non-postive integer
Dagfinn Ilmari Mannsåker [Thu, 1 Jun 2017 16:33:15 +0000 (17:33 +0100)]
Forbid setting $/ to a reference to a non-postive integer

This used to work like setting it to 'undef', but has been deprecated
since Perl 5.20.

In passing, avoid duplicate duplicate uninitialized warning by reusing
the SvIV() result already stored in 'val'.

6 years agoFix inconsistent whitespace in mg.c
Dagfinn Ilmari Mannsåker [Fri, 2 Jun 2017 09:45:32 +0000 (10:45 +0100)]
Fix inconsistent whitespace in mg.c

A handful of assignments are lacking a space on the left-hand side,
which is not consistent with the rest of the project style
(perlstyle mandates «Space around most operators»).

Also, a comment was mis-aligned.

6 years agoForbid use of bare << to mean <<""
Dagfinn Ilmari Mannsåker [Fri, 2 Jun 2017 14:47:02 +0000 (15:47 +0100)]
Forbid use of bare << to mean <<""

It has ben deprecated since perl 5.000.

6 years agoDisallow opening the same symbol as both a file and directory handle
Dagfinn Ilmari Mannsåker [Fri, 2 Jun 2017 16:30:22 +0000 (17:30 +0100)]
Disallow opening the same symbol as both a file and directory handle

This has been deprecated since Perl 5.10

6 years agoUpdate ExtUtils-Install to CPAN version 2.14
Chris 'BinGOs' Williams [Mon, 5 Jun 2017 13:13:36 +0000 (14:13 +0100)]
Update ExtUtils-Install to CPAN version 2.14

  [DELTA]

2.14

- Fix tests for when perl path contains a space

2.12

- Fix win32 check

2.10

- 'make -s' support: set $INSTALL_QUIET automatically

2.08

- Optimisations:

  * use our instead of vars
  * lazy load modules
  * make OS variables into constants
  * move some calculations out of a loop

2.06

- Removed instructions using Build.PL from README

- Load Win32API::File for _move_file_at_boot only when needed

- Allow disabling autosplit by omitting autosplit dir

6 years agoclosure.t: fix typo
David Mitchell [Mon, 5 Jun 2017 14:33:42 +0000 (15:33 +0100)]
closure.t: fix typo

6 years agoperldata.pod: clarify hash in scalar context.
David Mitchell [Mon, 5 Jun 2017 14:32:10 +0000 (15:32 +0100)]
perldata.pod: clarify hash in scalar context.

RT ##131166

6 years agoFREETMPS when leaving eval, even when void/dying
David Mitchell [Mon, 22 Aug 2016 08:50:43 +0000 (09:50 +0100)]
FREETMPS when leaving eval, even when void/dying

[ This commit was originally added as v5.25.2-77-g214949f then reverted
by v5.25.2-89-gcc040a9, since it broke Variable::Magic. That distribution
has since been fixed, so this fix can be re-applied to blead ]

When a scope is exited normally (e.g. pp_leavetry, pp_leavesub),
we do a FREETMPS only in scalar or list context; in void context
we don't bother for efficiency reasons. Similarly, when there's an
exception and we unwind to (and then pop) an EVAL context, we haven't
been bothering to FREETMPS.

The problem with this in try/eval (exiting normally or via an exception)
is that it can delay some SVs getting freed until *after* $@ has been
set. If that freeing calls a destructor which happens to set $@,
then that overwrites the "real" value of $@.

For example

    sub DESTROY { eval { die "died in DESTROY"; } }
    eval { bless []; };
    is ($@, "");

Before this commit, that test would fail because $@ is "died in DESTROY".

This commit ensures that leaving an eval/try by whatever means always
clears the tmps stack before setting $@.

See http://nntp.perl.org/group/perl.perl5.porters/237380.

For now, I haven't added a FREETMPS to the other pp_leavefoo()
void context cases, since I can't think of a case where it would
matter.

6 years agoS_require_tie_mod(): use a new stack
David Mitchell [Tue, 14 Mar 2017 09:19:15 +0000 (09:19 +0000)]
S_require_tie_mod(): use a new stack

RT #130861

This function is used to load a module associated with various magic vars,
like $[ and %+. Since it can be called 'unexpectedly', it should use a new
stack. The issue in this ticket was equivalent to

    my $var = '[';
    $$var;

where the symbolic dereference triggered a run-time load of arybase.pm,
which grew the stack, invalidating the SP in pp_rv2sv.

Note that most of the stuff which S_require_tie_mod() calls, such as
load_module(), will do its own PUSHSTACK(); but S_require_tie_mod() also
does a bit of stack manipulation itself.

The test case includes a magic number, 125, which happens to be the exact
size necessary to trigger a stack realloc in S_require_tie_mod(). In later
perl versions this value may well change. But it seemed too expensive
to call fresh_perl_is() 100's of times with different values of $n.

This commit also adds a SPAGAIN to pp_rv2sv on the 'belt and braces'
principle.

This commit is based on an earlier effort by Aaron Crane.

6 years ago[MERGE] lots of Deparse.pm fixups
David Mitchell [Mon, 5 Jun 2017 13:33:09 +0000 (14:33 +0100)]
[MERGE] lots of Deparse.pm fixups

As of this point,

    ./TEST -deparse op/delete.t

passes all tests (that are no on its exclude list)/

6 years agoDeparse: support delete %h{foo bar}
David Mitchell [Mon, 5 Jun 2017 13:29:51 +0000 (14:29 +0100)]
Deparse: support delete %h{foo bar}

Key/value slicing was recently extended to delete too. Make Deparse
support this.

6 years agoPorting/deparse-skips.txt: add failing tests
David Mitchell [Mon, 27 Feb 2017 08:45:08 +0000 (08:45 +0000)]
Porting/deparse-skips.txt: add failing tests

Add the 27 currently unexpected failing tests to the 'known failing' list
in deparse-skips.txt. These most likely represent newer or modified test
scripts which tickle existing Deparse issues rather than regressions in
Deparse, but I haven't examined them to check.

By adding them in, we're kind of resetting the clock - perhaps in future
we won't allow new failures to appear.

There are now 174 known failing scripts out of 2555. At the start of this
branch there were 178 known failing and 84 unexpectedly failing scripts.
In 5.24.0 there were  207 known failing and 174 unexpectedly failing scripts.

Also, re-sort the list.

The following were added to to deparse-skips.txt by this commit:

../cpan/Module-Metadata/t/metadata.t
../cpan/Scalar-List-Utils/t/subname.t
../cpan/Scalar-List-Utils/t/uniq.t
../cpan/Term-Cap/test.pl
../cpan/Test-Simple/t/Test2/behavior/run_subtest_inherit.t
../cpan/Test-Simple/t/regression/684-nested_todo_diag.t
../cpan/autodie/t/basic_exceptions.t
../cpan/autodie/t/binmode.t
../cpan/autodie/t/fileno.t
../cpan/autodie/t/mkdir.t
../cpan/autodie/t/read.t
../cpan/autodie/t/truncate.t
../cpan/autodie/t/unlink.t
../cpan/bignum/t/biinfnan.t
../cpan/bignum/t/bninfnan.t
../cpan/bignum/t/brinfnan.t
../dist/Data-Dumper/t/trailing_comma.t
../dist/threads/t/blocks.t
../ext/XS-APItest/t/synthetic_scope.t
../lib/Benchmark.t
../lib/dumpvar.t
mro/basic_01_c3_utf8.t
mro/basic_01_dfs_utf8.t
mro/complex_c3_utf8.t
op/hexfp.t
op/lvref.t
uni/variables.t

6 years agopurge Porting/deparse-skips.txt
David Mitchell [Fri, 24 Feb 2017 20:25:18 +0000 (20:25 +0000)]
purge Porting/deparse-skips.txt

Many excluded files have since been removed, and some have been
renamed. Update Porting/deparse-skips.txt accordingly.

6 years agot/TEST: warn about unknown files deparse-skips.txt
David Mitchell [Fri, 24 Feb 2017 20:15:48 +0000 (20:15 +0000)]
t/TEST: warn about unknown files deparse-skips.txt

In ./TEST -deparse, when reading Porting/deparse-skips.txt, emit a warning
for each excluded file which no longer exists.

Also, move the scope of $in to just the sub that uses it.

6 years agodeparse-skips.txt: remove cpan/File-Path/t/taint.t
David Mitchell [Fri, 24 Feb 2017 20:00:34 +0000 (20:00 +0000)]
deparse-skips.txt: remove cpan/File-Path/t/taint.t

This was fixed a few commits ago, but I forgot to mark it fixed.

6 years agodeparse-skips.txt: add Archive-Tar/t/03_file.t
David Mitchell [Fri, 24 Feb 2017 17:37:31 +0000 (17:37 +0000)]
deparse-skips.txt: add Archive-Tar/t/03_file.t

This test script uses constant anon subs, which get deparsed back
into real subs and fail; e.g.

    use strict;
    { my $x; use constant FOO => sub { $x = 1 }; }
    FOO->();

which gets deparsed as

    use strict;
    { my $x; use constant FOO => sub { $x = 1 }; }
    sub { $x = 1 }->();

and croaks with 'Global symbol "$x" requires explicit package name'

Since the name of the constant ('FOO') has been folded away, there's
no way to correctly deparse this unless more info is saved in the op tree.

6 years agosort Porting/deparse-skips.txt
David Mitchell [Fri, 24 Feb 2017 17:35:57 +0000 (17:35 +0000)]
sort Porting/deparse-skips.txt

have core test first, then cpan/dist etc. Sort alphabetically
within each category

6 years agoDeparse: better handle BEGIN { use_ok() }
David Mitchell [Fri, 24 Feb 2017 16:11:34 +0000 (16:11 +0000)]
Deparse: better handle BEGIN { use_ok() }

Commit v5.25.3-111-g8071973 added handling for the bad deparsing of

    BEGIN { use_ok() }

Basically by stripping out the bad code text *after* it had been deparsed.
However, this didn't catch all bad cases - in particular, where #line
directives got added:

    use Socket (@{
    #line 10 "t/000_load.t"
    $args[0];});

Under TEST -deparse, this fixes the following unexpectedly failing
scripts:

    ../cpan/Term-ANSIColor/t/taint/basic.t
    ../cpan/autodie/t/00-load.t
    ../dist/Locale-Maketext/t/01_about_verbose.t
    ../dist/Locale-Maketext/t/10_make.t
    ../dist/Locale-Maketext/t/20_get.t
    ../dist/Locale-Maketext/t/40_super.t
    ../dist/Locale-Maketext/t/50_super.t
    ../dist/Locale-Maketext/t/60_super.t
    ../dist/Locale-Maketext/t/70_fail_auto.t
    ../dist/Locale-Maketext/t/91_backslash.t
    ../ext/File-Glob/t/taint.t
    ../ext/Hash-Util/t/Util.t
    ../lib/DB.t
    ../lib/File/Basename.t

and fixes the following expected-to-fail script:

    ../dist/Net-Ping/t/000_load.t

6 years agoDeparse my var attributes correctly
David Mitchell [Fri, 24 Feb 2017 14:32:28 +0000 (14:32 +0000)]
Deparse my var attributes correctly

Formerly this:

    my $x :foo;

deparsed as

    'attributes'->import('main', \$x, 'foo'), my $x;

it now deparses as:

    my $x :foo;

It handles all the common forms, such as

    my Foo::Bar ($s, @a, %h) :foo(foo1) bar(bar1);

but doesn't yet handle an attribute declaration that's not a statement,
e.g.

    f(1, $x :foo);

Under TEST -deparse, this fixes the following unexpectedly failing
scripts:

    ../dist/IO/t/io_file_export.t
    ../dist/IO/t/io_multihomed.t
    ../dist/IO/t/io_udp.t
    ../dist/Thread-Queue/t/02_refs.t
    ../dist/Thread-Semaphore/t/01_basic.t
    ../dist/Thread-Semaphore/t/04_nonblocking.t
    ../dist/Thread-Semaphore/t/05_force.t
    ../dist/Thread-Semaphore/t/06_timed.t
    ../dist/threads-shared/t/av_refs.t
    ../dist/threads-shared/t/blessed.t
    ../dist/threads-shared/t/clone.t
    ../dist/threads-shared/t/cond.t
    ../dist/threads-shared/t/dualvar.t
    ../dist/threads-shared/t/hv_refs.t
    ../dist/threads-shared/t/object.t
    ../dist/threads-shared/t/object2.t
    ../dist/threads-shared/t/shared_attr.t
    ../dist/threads-shared/t/sv_refs.t
    ../dist/threads-shared/t/utf8.t
    ../dist/threads-shared/t/wait.t
    ../dist/threads-shared/t/waithires.t
    ../dist/threads/t/err.t
    ../dist/threads/t/free.t
    ../dist/threads/t/join.t
    ../dist/threads/t/kill.t
    ../dist/threads/t/kill2.t
    ../dist/threads/t/libc.t
    ../dist/threads/t/problems.t
    ../dist/threads/t/state.t
    op/threads-dirh.t

and fixes the following expected-to-fail scripts:

    ../dist/Thread-Queue/t/08_nothreads.t
    ../dist/threads/t/exit.t
    ../dist/threads/t/thread.t
    op/attrs.t
    op/getpid.t

6 years agoDeparse.pm: handle BEGIN { require expr }
David Mitchell [Thu, 23 Feb 2017 14:33:05 +0000 (14:33 +0000)]
Deparse.pm: handle BEGIN { require expr }

Deparse examines BEGIN subs to see if they look like

    BEGIN { require Foo; ... }

and if so deparses them as 'use Foo' instead.

However, it can't cope when Foo is an expression rather than a constant,
such as

    BEGIN {
        require($ENV{PERL_CORE} ? '../../t/test.pl' : './t/test.pl');
    }

and crashes.

This commit makes it instead recognise such op trees as not being part of
a 'use'.

Under TEST -deparse, this fixes the following unexpectedly failing
script:

    dist/threads/t/kill3.t

and fixes the following expected-to-fail scripts:

    dist/IO/t/io_file_export.t
    dist/IO/t/io_multihomed.t
    dist/IO/t/io_udp.t
    dist/threads/t/err.t
    dist/threads/t/kill2.t
    dist/threads/t/libc.t

6 years agoDeparse: avoid deep recursion warning
David Mitchell [Thu, 23 Feb 2017 13:41:35 +0000 (13:41 +0000)]
Deparse: avoid deep recursion warning

sub _pessimise_walk_exe() recursively walks the optree, so can easily
exceed a depth of 100.

6 years agot/TEST -deparse: list unexpectedly passing scripts
David Mitchell [Thu, 23 Feb 2017 12:52:09 +0000 (12:52 +0000)]
t/TEST -deparse: list unexpectedly passing scripts

Currently Porting/deparse-skips.txt maintains a list of test scripts
that are expected fail when run after deparsing. If a script unexpectedly
passes, its listed as a failure in the summary at the end of the run.

Make the summary include a list of unexpected passes too to make it
easier to distinguish from failures.

6 years agoDeparse: don't remove escapes for tabs in patterns
David Mitchell [Thu, 23 Feb 2017 10:53:10 +0000 (10:53 +0000)]
Deparse: don't remove escapes for tabs in patterns

In the following, the T represents a literal tab character.

/\T/ and /\T/x were being deparsed as /T/ and /T/x.
In the particular case of /\T/x that actually changed the pattern's
meaning.

So don't do that: leave the backslashes alone.

This makes
    ./TEST -deparse t/re/keep_tabs.t
pass.

6 years agoDeparse: make a complex pattern readable with /x
David Mitchell [Thu, 23 Feb 2017 10:30:42 +0000 (10:30 +0000)]
Deparse: make a complex pattern readable with /x

In sub re_unback().

It shouldn't change its functionality, but just add whitespace
and comments for readability.

6 years agoDeparse: handle OP_PADRANGE in regex code blocks
David Mitchell [Wed, 22 Feb 2017 16:54:51 +0000 (16:54 +0000)]
Deparse: handle OP_PADRANGE in regex code blocks

Deparse handles the OP_PADRANGE op by overlaying the view of the optree
with the original pad ops (as if they had never been optimised into a
single OP_PADRANGE op).

However, the op treewalk to pessimise such ops wasn't walking into
the op subtrees of code blocks in patterns. So for example

    /(?{ my ($x, $y) = @a; })/

was being deparsed (with a warning) as

    /(?{ (XXX) = @a; })/

With this commit, this passes again:

 ./TEST -deparse re/pat_re_eval.t

6 years agoDeparse.t: diag full code that failed to compile
David Mitchell [Wed, 22 Feb 2017 16:53:50 +0000 (16:53 +0000)]
Deparse.t: diag full code that failed to compile

makes it easier to debug when adding new tests that it doesn't like

6 years agomake porting/cmp_version.t clearer what happens
David Mitchell [Mon, 5 Jun 2017 11:32:12 +0000 (12:32 +0100)]
make porting/cmp_version.t clearer what happens

Add some code comments, and include the version number its comparing
against in the output.

6 years agoModule-CoreList/t/maintainer.t: silence warning
David Mitchell [Mon, 5 Jun 2017 11:13:20 +0000 (12:13 +0100)]
Module-CoreList/t/maintainer.t: silence warning

../dist/Module-CoreList/t/maintainer.t .. Name
"Module::CoreList::released" used only once: possible typo

6 years agoXPUSH*: reuse code from mPUSH* macros
Eugen Konkov [Mon, 5 Jun 2017 08:07:54 +0000 (09:07 +0100)]
XPUSH*: reuse code from mPUSH* macros

6 years agoEntware released perl-5.24.1
H.Merijn Brand [Sun, 4 Jun 2017 09:16:09 +0000 (11:16 +0200)]
Entware released perl-5.24.1

6 years agoWhen building with g++ on FreeBSD, explicitly set 'usedl' and 'dlsrc'.
James E Keenan [Tue, 23 May 2017 01:25:18 +0000 (21:25 -0400)]
When building with g++ on FreeBSD, explicitly set 'usedl' and 'dlsrc'.

For: https://rt.perl.org/Ticket/Display.html?id=131337
Signed-off-by: James E Keenan <jkeenan@cpan.org>
6 years agoPatch suggested by Craig Berry for RT 131337.
James E Keenan [Mon, 22 May 2017 02:16:23 +0000 (22:16 -0400)]
Patch suggested by Craig Berry for RT 131337.

6 years agoUpdate Module::CoreList for 5.27.1
David Mitchell [Sat, 3 Jun 2017 07:54:01 +0000 (08:54 +0100)]
Update Module::CoreList for 5.27.1

6 years agoBump the perl version in various places for 5.27.1
David Mitchell [Sat, 3 Jun 2017 07:24:12 +0000 (08:24 +0100)]
Bump the perl version in various places for 5.27.1

6 years agoUse new paradigm for hdr file double inclusion guard
Karl Williamson [Thu, 20 Apr 2017 16:16:11 +0000 (10:16 -0600)]
Use new paradigm for hdr file double inclusion guard

We changed to use symbols not likely to be used by non-Perl code that
could conflict, and which have trailing underbars, so they don't look
like a regular Perl #define.

See https://rt.perl.org/Ticket/Display.html?id=131110

There are many more header files which are not guarded.

6 years agoDefine and use symbolic constants for LvFLAGS
Dagfinn Ilmari Mannsåker [Fri, 31 Mar 2017 14:04:15 +0000 (15:04 +0100)]
Define and use symbolic constants for LvFLAGS

6 years agodo not overallocate in zaphod32_hash
Yves Orton [Sun, 26 Mar 2017 17:12:51 +0000 (19:12 +0200)]
do not overallocate in zaphod32_hash

We don't use it, but it should be fixed regardless to sync
with upstream which might.

6 years agoremove unneeded an unwelcome dependency
Yves Orton [Fri, 24 Mar 2017 13:33:36 +0000 (14:33 +0100)]
remove unneeded an unwelcome dependency

I added this when debugging the load average change and forgot to remove it
afterwards, and it upsets Jarkkos test suite.

6 years agoPorting/bench.pl: allow more than one file to be read at a go
Yves Orton [Thu, 23 Mar 2017 21:06:51 +0000 (22:06 +0100)]
Porting/bench.pl: allow more than one file to be read at a go

6 years agoprevent mro.pm from loading DynaLoader
Graham Knop [Sat, 15 Apr 2017 14:23:11 +0000 (16:23 +0200)]
prevent mro.pm from loading DynaLoader

XSLoader::load cares about the package it is called from.  If it is a
different package from what you are trying to load, it falls back to
loading and using DynaLoader.

Move the load call to be in the mro package as it should be, so that it
doesn't trigger needless extra load.

6 years agoPorting: add note on unsetting env
Sawyer X [Fri, 2 Jun 2017 10:58:19 +0000 (12:58 +0200)]
Porting: add note on unsetting env

6 years agoperldelta for delete on key/value slices
Dagfinn Ilmari Mannsåker [Fri, 2 Jun 2017 10:07:40 +0000 (11:07 +0100)]
perldelta for delete on key/value slices

6 years agoAdd support for deleting key/value slices (RT#131328)
Dagfinn Ilmari Mannsåker [Sat, 20 May 2017 13:08:06 +0000 (14:08 +0100)]
Add support for deleting key/value slices (RT#131328)

6 years agorevert the Perl_croak_nocontext() change to PERL_HASH()
Yves Orton [Fri, 2 Jun 2017 02:17:51 +0000 (04:17 +0200)]
revert the Perl_croak_nocontext() change to PERL_HASH()

it only appeared to work, but actually was not being invoked in my testing.

Once it was tested properly it became clear that Perl_croak_nocontext()
is not always available where things are calling PERL_HASH(). Need to investigate
further how to make this work.

6 years agofixup defines for SBOX mode
Yves Orton [Fri, 2 Jun 2017 02:13:47 +0000 (04:13 +0200)]
fixup defines for SBOX mode

6 years agoperldeprecation: Add vec() with above-FF code points
Karl Williamson [Thu, 1 Jun 2017 22:10:48 +0000 (16:10 -0600)]
perldeprecation: Add vec() with above-FF code points

6 years agoUpdate Locale-Codes from CPAN 3.42 to 3.52.
Sullivan Beck [Thu, 1 Jun 2017 21:33:18 +0000 (17:33 -0400)]
Update Locale-Codes from CPAN 3.42 to 3.52.

Committer: re-sorted MANIFEST.

6 years agoPATCH: [perl #131142] Revise 'if' documentation
Ken Cotterill [Thu, 1 Jun 2017 19:09:39 +0000 (13:09 -0600)]
PATCH: [perl #131142] Revise 'if' documentation

This adds text about how to import when you want to 'use MODULE ()'

6 years agoAdd Ken Cotterill to AUTHORS
Karl Williamson [Thu, 1 Jun 2017 19:11:57 +0000 (13:11 -0600)]
Add Ken Cotterill to AUTHORS

6 years agot/op/vec.t: White space only.
Karl Williamson [Thu, 1 Jun 2017 18:37:01 +0000 (12:37 -0600)]
t/op/vec.t: White space only.

Adds an indentation level following the previous commit's adding a
surrounding block

6 years agoDeprecate vec() with above-FF code points.
Karl Williamson [Thu, 1 Jun 2017 18:20:52 +0000 (12:20 -0600)]
Deprecate vec() with above-FF code points.

This will make this consistent with the bitwise operators.

6 years agoset up catchable runloops early enough
Zefram [Sun, 26 Mar 2017 20:53:29 +0000 (21:53 +0100)]
set up catchable runloops early enough

The jmpenv frame to catch Perl exceptions is set up lazily, and this used
to be a bit too lazy.  The flow of control through pp_entereval had a gap
where the eval frame was on the context stack but the catcher hadn't been
set up, and it was possible for an exception to occur in that gap and be
signalled through unwinding, which would thus break.  Specifically this
occurred if the code being evaluated died in a UNITCHECK block, because
doeval_compile() invokes those blocks with no special arrangements for
exceptions, whereas it handles compilation/BEGIN exceptions by means
that don't unwind.

This patch sets up the catcher earlier, before putting the eval frame
on the context stack.  This change is made to entereval, entertry,
and require, the three ops that set up real eval frames.  In each case,
whereas previously the catcher was interposed last thing before handing
off to the following op, the catcher is now set up first thing in the
pp function, with docatch() now recursively invoking the pp function.

Fixes [perl #105930].

6 years agoutf8.h: Add parens around macro param in expansion
Karl Williamson [Thu, 1 Jun 2017 16:44:08 +0000 (10:44 -0600)]
utf8.h: Add parens around macro param in expansion

a6951642ede4abe605dcf0e94b74948e0a60a56b added an assertion to find bugs
in calling macros, and so far, instead, it found a bug in a macro.  A
parameter needs to be enclosed in parens in case it is an expression, so
that precedence works.

6 years agohv_func.h: Fix compilation error
Karl Williamson [Thu, 1 Jun 2017 16:18:02 +0000 (10:18 -0600)]
hv_func.h: Fix compilation error

g++ 6.3 croaks on the new PERL_HASH_WITH_SEED macro.  The parameters
need casts

6 years agosilence warning in gv.t
Yves Orton [Thu, 1 Jun 2017 14:55:01 +0000 (16:55 +0200)]
silence warning in gv.t

Useless use of single ref constructor in void context at op/gv.t line 1191.

Apparently this is intended to test if we crash. But it throws warnings. So
we silence the warnings.

6 years agohv.c: silence compiler warning
Yves Orton [Thu, 1 Jun 2017 14:30:34 +0000 (16:30 +0200)]
hv.c: silence compiler warning

hv.c: In function ‘Perl_hv_undef_flags’:
hv.c:2053:35: warning: ‘orig_ix’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             PL_tmps_stack[orig_ix] = &PL_sv_undef;

The warning is bogus, as we only use orig_ix if "save" is true,
and if "save" is true we will have initialized orig_ix. However
initializing it in the first place avoids any issue

6 years agoav.c: silence compiler warning
Yves Orton [Thu, 1 Jun 2017 14:28:21 +0000 (16:28 +0200)]
av.c: silence compiler warning

av.c: In function ‘Perl_av_undef’:
av.c:577:35: warning: ‘orig_ix’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             PL_tmps_stack[orig_ix] = &PL_sv_undef;

The warning is bogus, as we only use the orig_ix if real is true,
and if real is true we will have set orig_ix. But it doesnt cost
much to initialize it always and shut up the compiler.

6 years agoRT #127742: Hash keys are limited to 2 GB - throw an exception if hash keys are too...
Aaron Crane [Thu, 1 Jun 2017 12:42:22 +0000 (14:42 +0200)]
RT #127742: Hash keys are limited to 2 GB - throw an exception if hash keys are too long

We currently require hash keys to be less than 2**31 bytes long. But (a)
nothing actually tries to enforce that, and (b) if a Perl program tries to
create a hash with such a key (using a 64-bit system), we miscalculate the
size of a memory block, yielding a panic:

$ ./perl -e '+{ "x" x 2**31, undef }'
panic: malloc, size=18446744071562068026 at -e line 1.

Instead, check for this situation, and croak with an appropriate (new)
diagnostic in the unlikely event that it occurs.

This also involves changing the type of an argument to a public API function:
Perl_share_hek() previously took the key's length as an I32, but that makes
it impossible to detect over-long keys, so it must be SSize_t instead.

From Yves:
We also inject the length test into the PERL_HASH() macro, so that where
the macro is used *before* calling into any of the hv functions we can
avoid hashing a very long string only to throw an exception that it is
too long. Might as well fail fast.

6 years agoCaptialise Perl when talking about specific versions in perldelta
Dagfinn Ilmari Mannsåker [Thu, 1 Jun 2017 15:08:50 +0000 (16:08 +0100)]
Captialise Perl when talking about specific versions in perldelta

6 years agoAdd NOT_REACHED to quiet clang -Weverything warnings
Andy Lester [Mon, 27 Feb 2017 03:15:46 +0000 (21:15 -0600)]
Add NOT_REACHED to quiet clang -Weverything warnings

6 years agoRemove deprecated function 'to_utf8_case()'
Karl Williamson [Wed, 10 May 2017 14:29:46 +0000 (08:29 -0600)]
Remove deprecated function 'to_utf8_case()'

This is keeping with the schedule for 5.28.

6 years agoFatalize \N{}
Karl Williamson [Thu, 2 Mar 2017 18:31:36 +0000 (11:31 -0700)]
Fatalize \N{}

This has been deprecated, scheduled to be fatal now.

6 years agot/re/pat_advanced.t: Prepare for fatal \N{}
Karl Williamson [Thu, 2 Mar 2017 18:26:22 +0000 (11:26 -0700)]
t/re/pat_advanced.t: Prepare for fatal \N{}

The next commit will make \N{} fatal, but we still allow a custom
charnames handler to evaluate a name to the empty string, and that still
needs to be tested.  This changes to do that.

6 years agoMove tests to pat_advanced.t
Karl Williamson [Thu, 2 Mar 2017 18:19:39 +0000 (11:19 -0700)]
Move tests to pat_advanced.t

The next commit will change these tests to require the infrastructure
already available in pat_advanced.t

6 years agoregcomp.c: Simplify expression
Karl Williamson [Thu, 2 Mar 2017 04:52:22 +0000 (21:52 -0700)]
regcomp.c: Simplify expression

Here, there is no advantage to assigning a variable within an 'if', and
it is somewhat harder to read, so don't do it.

6 years agore/pat_advanced.t: Convert ok to like
Karl Williamson [Tue, 14 Feb 2017 19:04:28 +0000 (12:04 -0700)]
re/pat_advanced.t: Convert ok to like

'like' gives better diagnostics than 'ok'.  This converts the ones it is
straight forward to do.

6 years agoRestore "improve and update hash algorithm configuration docs in INSTALL"
Yves Orton [Thu, 1 Jun 2017 13:06:44 +0000 (15:06 +0200)]
Restore "improve and update hash algorithm configuration docs in INSTALL"

This reverts commit 9627bf7af087e000c169b623f1a4536976a0f6c1,
and 2b2e489d8a432b3526cb21ef651bb9101ecd5b9d, which were reverts
of commit e7e07d980872d020fd93a43cda96f72c8013af20 and of commit
c25b844905729021ec43dcc6c244d99330d7260a resepctively.

Updated docs to reflect new hash functions, along with some wordsmithing
tweaks to make things read more smoothly (hopefully).

6 years agoRestore "get rid of USE_HASH_SEED_EXPLICIT"
Yves Orton [Thu, 1 Jun 2017 13:04:26 +0000 (15:04 +0200)]
Restore "get rid of USE_HASH_SEED_EXPLICIT"

This reverts commit eba287cb48b881ee252ec418246375010c97a85b,
which was a revert of dd1b95f812312c85390f487887cdd55282fcd6ce.

As far as I know USE_HASH_SEED_EXPLICIT been outright broken for a long
time, and it doesnt make any sense since mandatory randomization anyway,
so simply remove it.

6 years agoRestore "Move utility macros to their own file"
Yves Orton [Thu, 1 Jun 2017 13:02:27 +0000 (15:02 +0200)]
Restore "Move utility macros to their own file"

This reverts commit 3f023586c2fbf826d45cf78795361337eca3daa1,
which was a revert of commit 259e968485f855f70472c8be9267efceca42b0fb.

After this patch hv_func.h is left with only logic relating to
selecting and configuring the hash function we use, not the utility macros
(such as ROTL and equivalent) our hash functions use and share.

6 years agoRestore "Add new hashing and "hash with state" infrastructure"
Yves Orton [Thu, 1 Jun 2017 13:00:13 +0000 (15:00 +0200)]
Restore "Add new hashing and "hash with state" infrastructure"

This reverts commit e6a172f358c0f48c4b744dbd5e9ef6ff0b4ff289,
which was a revert of a3bf60fbb1f05cd2c69d4ff0a2ef99537afdaba7.

Add new hashing and "hash with state" infrastructure

This adds support for three new hash functions: StadtX, Zaphod32 and SBOX,
and reworks some of our hash internals infrastructure to do so.

SBOX is special in that it is designed to be used in conjuction with any
other hash function for hashing short strings very efficiently and very
securely. It features compile time options on how much memory and startup
time are traded off to control the length of keys that SBOX hashes.

This also adds support for caching the hash values of single byte characters
which can be used in conjuction with any other hash, including SBOX, although
SBOX itself is as fast as the lookup cache, so typically you wouldnt use both
at the same time.

This also *removes* support for Jenkins One-At-A-Time. It has served us
well, but it's day is done.

This patch adds three new files: zaphod32_hash.h, stadtx_hash.h,
sbox32_hash.h

6 years agoRestore "Tweak our hash bucket splitting rules"
Yves Orton [Thu, 1 Jun 2017 12:56:12 +0000 (14:56 +0200)]
Restore "Tweak our hash bucket splitting rules"

This reverts commit e4343ef32499562ce956ba3cb9cf4454d5d2ff7f,
which was a revert of 05f97de032fe95cabe8c9f6d6c0a5897b1616194.

Prior to this patch we resized hashes when after inserting a key
the load factor of the hash reached 1 (load factor= keys / buckets).

This patch makes two subtle changes to this logic:

1. We split only after inserting a key into an utilized bucket,
2. and the maximum load factor exceeds 0.667

The intent and effect of this change is to increase our hash tables
efficiency. Reducing the maximum load factor 0.667 means that we should
have much less keys in collision overall, at the cost of some unutilized
space (2/3rds was chosen as it is easier to calculate than 0.7). On the
other hand, only splitting after a collision means in theory that we execute
the "final split" less often. Additionally, insertin a key into an unused
bucket increases the efficiency of the hash, without changing the worst
case.[1] In other words without increasing collisions we use the space
in our hashes more efficiently.

A side effect of this hash is that the size of a hash is more sensitive
to key insert order. A set of keys with some collisions might be one
size if those collisions were encountered early, or another if they were
encountered later. Assuming random distribution of hash values about
50% of hashes should be smaller than they would be without this rule.

The two changes complement each other, as changing the maximum load
factor decreases the chance of a collision, but changing to only split
after a collision means that we won't waste as much of that space we
might.

[1] Since I personally didnt find this obvious at first here is my
explanation:

The old behavior was that we doubled the number of buckets when the
number of keys in the hash matched that of buckets. So on inserting
the Kth key into a K bucket hash, we would double the number of
buckets.  Thus the worse case prior to this patch was a hash
containing K-1 keys which all hash into a single  bucket, and the post
split worst case behavior would be having K items in a single bucket
of a hash with 2*K buckets total.

The new behavior says that we double the size of the hash once inserting
an item into an occupied bucket and after doing so we exceeed the maximum
load factor (leave aside the change in maximum load factor in this patch).
If we insert into an occupied bucket (including the worse case bucket) then
we trigger a key split, and we have exactly the same cases as before.
If we insert into an empty bucket then we now have a worst case of K-1 items
in one bucket, and 1 item in another, in a hash with K buckets, thus the
worst case has not changed.

6 years agoRestore "use a specific define for 64 bit hashing"
Yves Orton [Thu, 1 Jun 2017 12:54:36 +0000 (14:54 +0200)]
Restore "use a specific define for 64 bit hashing"

This reverts commit 63e6b12834233dc9b98f2b7b63611f958aa88cc6,
which was a revert of a4283faf7092ec370914ee3e4e7afeddd0115689.

6 years agoFix #131190 - UTF8 code improperly casting negative integer to U8 in comparison
Yves Orton [Thu, 1 Jun 2017 12:51:44 +0000 (14:51 +0200)]
Fix #131190 - UTF8 code improperly casting negative integer to U8 in comparison

This reverts commit b4972372a75776de3c9e6bd234a398d103677316,
effectively restoring commit ca7eb79a236b41b7722c6800527f95cd76843eed,
and commit 85fde2b7c3f5631fd982f5db735b84dc9224bec0.

6 years agoperlfunc.pod: explain seek in O_APPEND
Dan Collins [Tue, 5 Jul 2016 23:02:12 +0000 (19:02 -0400)]
perlfunc.pod: explain seek in O_APPEND

In all modern systems, seek has no effect in O_APPEND. As explained
by Nick Cleaton at that RT, the comment was written in a time when:

    ...opening a file for append [was] the same as opening for
    write and then seeking to the end.

    This is not the case.  When a file is opened in append mode,
    all writes are appended to the then end of file, irrespective
    of the current file position.

Corrected comment was contributed by him.

6 years agoAvoid unused-parameter warning when compiling with g++.
James E Keenan [Sun, 14 May 2017 13:57:21 +0000 (09:57 -0400)]
Avoid unused-parameter warning when compiling with g++.

6 years ago[perl #131085] Crash with sub-in-stash
Father Chrysostomos [Fri, 7 Apr 2017 21:08:02 +0000 (14:08 -0700)]
[perl #131085] Crash with sub-in-stash

$ perl -e '$::{"A"} = sub {}; \&{"A"}'
Segmentation fault (core dumped)

The code that vivifies a typeglob out of a code ref assumed that the
CV had a name hek, which is always the case when perl itself puts the
code ref there (via ‘sub A{}’), but is not necessarily the case if
someone is insinuating other stuff into the stash.

6 years agoUpdate core with version 0.9918
John Peacock [Tue, 25 Apr 2017 00:06:01 +0000 (20:06 -0400)]
Update core with version 0.9918

6 years agoRelax fatal circumstances of unescaped '{'
Karl Williamson [Wed, 31 May 2017 03:19:20 +0000 (21:19 -0600)]
Relax fatal circumstances of unescaped '{'

After the 5.26.0 code freeze, it came out that an application that many
others depend on, GNU Autoconf, has an unescaped '{' in it.  Commit
7335cb814c19345052a23bc4462c701ce734e6c5 created a kludge that was
minimal, and designed to get just that one application to work.

I originally proposed a less kludgy patch that was applicable across a
larger set of applications.  The proposed patch didn't fatalize uses
of unesacped '{' where we don't anticipate using it for something other
than its literal self.  That approach worked for Autoconf, but also far
more instances, but was more complicated, and was rejected as being too
risky during code freeze.

Now this commit implements my original suggestion.  I am putting it in
now, to let it soak in blead, in case something else surfaces besides
Autoconf, that we need to work around.  By having experience with the
patch live, we can be more confident about using it, if necessary, in a
dot release.

6 years agot/re/reg_mesg.t: Add override of warning default on/off
Karl Williamson [Wed, 31 May 2017 19:08:33 +0000 (13:08 -0600)]
t/re/reg_mesg.t: Add override of warning default on/off

This .t needs an overhaul to more cleanly accommodate the extra tasks it
has been given over the years.  But until then, this is a minimal
enhancement that will be useful in the commit after this one.

This adds the ability to specify that a particular pattern being tested
should generate a message which is raised by default vs one that isn't.
The messages are currently grouped in categories whose default is
determined by the category itself.  This commit avoids having to create
a new category when a message comes along that doesn't quite fit into
the existing ones.

6 years agoregcomp.c: Don't set variable within an 'if'
Karl Williamson [Wed, 31 May 2017 19:44:20 +0000 (13:44 -0600)]
regcomp.c: Don't set variable within an 'if'

Sometimes it is convenient/and or necessary to do an assignment within a
clause of an 'if', but it adds a little cognitive load.  In this case,
it's entirely unnecessary.  This patch changes to do the assignment
before the 'if'.

6 years agoperlguts: Add some C<>
Karl Williamson [Wed, 24 May 2017 02:54:06 +0000 (20:54 -0600)]
perlguts: Add some C<>

6 years agocharnames: Clarify comment
Karl Williamson [Wed, 24 May 2017 02:53:11 +0000 (20:53 -0600)]
charnames: Clarify comment

6 years agocharnames: Remove obsolete pod about NBSP
Karl Williamson [Wed, 24 May 2017 02:51:56 +0000 (20:51 -0600)]
charnames: Remove obsolete pod about NBSP

This is illegal since 5.26, and the text should have been removed then,
but was overlooked.

6 years agoperlmodinstall: Make a link for http text
Karl Williamson [Wed, 24 May 2017 02:50:44 +0000 (20:50 -0600)]
perlmodinstall: Make a link for http text

6 years agoutf8.h: Add assertions for macros that take chars
Karl Williamson [Wed, 26 Apr 2017 16:29:58 +0000 (10:29 -0600)]
utf8.h: Add assertions for macros that take chars

This is inspired by [perl #131190].  The UTF-8 macros whose parameters
are characters now have assertions that verify they are not being called
with something that won't fit in a char.  These assertions should be
getting optimized out if the input type is a char or U8.

6 years agoChange formal parameter for newSVpvn
Karl Williamson [Thu, 20 Apr 2017 14:33:42 +0000 (08:33 -0600)]
Change formal parameter for newSVpvn

This fixes a discrepancy in perlapi.  See
http://nntp.perl.org/group/perl.perl5.porters/243384

6 years agoAUTHORS: Update Jim Shneider's email
Karl Williamson [Tue, 11 Apr 2017 17:37:23 +0000 (11:37 -0600)]
AUTHORS: Update Jim Shneider's email

6 years agot/op/fork.t: Don't output shell warning
Karl Williamson [Tue, 11 Apr 2017 20:11:40 +0000 (14:11 -0600)]
t/op/fork.t: Don't output shell warning

If the shell doesn't support 'ulimit -u', it can cause unexpected
warnings that can cause the tests to fail.  This happens on s/390.

6 years agoAPItest/numeric.xs: Fix uninit error
Karl Williamson [Tue, 11 Apr 2017 17:11:24 +0000 (11:11 -0600)]
APItest/numeric.xs: Fix uninit error

valgrind shows that a variable could be used unininitialized.

6 years agot/harness: Run APItests in parallel
Karl Williamson [Wed, 22 Mar 2017 03:52:33 +0000 (21:52 -0600)]
t/harness: Run APItests in parallel

This commit changes these tests to be run like the tests in t/lib, in
parallel with each other, when available.  This is the longest running
directory, and prior to this commit, on many-core systems it can be the
final thing chugging along, a test at-a-time, while the other cores are
idle.

6 years agot/harness: Remove useless sort
Karl Williamson [Wed, 22 Mar 2017 03:41:34 +0000 (21:41 -0600)]
t/harness: Remove useless sort

Instead move its effect to the sort that overrides the first one.  This
is because the tests are executed in the order of the rules to
TAP::Harness, not in the order of the test list.

6 years agoSlightly change -Dr output of regex ANYOF nodes
Karl Williamson [Mon, 30 Jan 2017 21:52:46 +0000 (14:52 -0700)]
Slightly change -Dr output of regex ANYOF nodes

This changes to precede each literal '[' in a [...] class with a
backslash to better make is standout as a literal

6 years agoWhen and how to use Devel::PatchPerl to repair older builds.
James E Keenan [Mon, 27 Feb 2017 17:24:25 +0000 (12:24 -0500)]
When and how to use Devel::PatchPerl to repair older builds.

Following recommendation by Matthew Horsfall.

6 years agoAdd Module-CoreList maintainer tests
Chris 'BinGOs' Williams [Thu, 1 Jun 2017 12:28:00 +0000 (13:28 +0100)]
Add Module-CoreList maintainer tests