This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
4 years agoPerl_sv_vcatpvfn_flags: reindent block
David Mitchell [Thu, 11 May 2017 08:06:05 +0000 (09:06 +0100)]
Perl_sv_vcatpvfn_flags: reindent block

whitespace only

4 years agoPerl_sv_vcatpvfn_flags: reduce scope of 'int i'
David Mitchell [Thu, 11 May 2017 08:00:30 +0000 (09:00 +0100)]
Perl_sv_vcatpvfn_flags: reduce scope of 'int i'

Declare an 'i' var wherever needed for local use, rather than being in
scope for 1600 lines.

4 years agoPerl_sv_vcatpvfn_flags: get rid of an (int) cast
David Mitchell [Wed, 10 May 2017 16:23:51 +0000 (17:23 +0100)]
Perl_sv_vcatpvfn_flags: get rid of an (int) cast

harmless in this case, but there really shouldn't be (int) casts
on string length and ptr diff calculations

4 years agoPerl_sv_vcatpvfn_flags: calc (width - elen) once
David Mitchell [Wed, 10 May 2017 15:58:58 +0000 (16:58 +0100)]
Perl_sv_vcatpvfn_flags: calc (width - elen) once

There's a couple of blocks of code which repeat the expression
(width - elen). Calculate this once at the top. This makes it slightly
easier to audit the code for signed/unsigned wrap etc.

Should be no functional change.

4 years agoPerl_sv_vcatpvfn_flags: avoid 1-byte buf overrun
David Mitchell [Wed, 10 May 2017 15:17:18 +0000 (16:17 +0100)]
Perl_sv_vcatpvfn_flags: avoid 1-byte buf overrun

This only occurs on the "%a" (hex) format, and only happens when
processing a denormalised value whose bit pattern is 0xf....f or similar,
and when rounding up it needs to insert a '1' at the head of the number
and shift the rest of the digits down one.

In practice this never seems to happen - the top nybble of a denormalised
float value always seems to be 0x1 (presumably because that's implicit) so
there's never any carry to a higher digit. Maybe other platforms do it
differently.

Also VHEX_SIZE seems to be rounded up, so in practice there's no overrun.

But better safe than sorry.

4 years agoPerl_sv_vcatpvfn_flags: avoid a potential wrap
David Mitchell [Wed, 10 May 2017 14:27:49 +0000 (15:27 +0100)]
Perl_sv_vcatpvfn_flags: avoid a potential wrap

In the floating-point hex (%a) code, it checks whether the requested
precision is smaller than the hex buf size. It does this by casting
(precis + 1) to signed. Since precis can be any user-supplied value,
this can wrap. Instead, cast the (buffer_length - 1) to unsigned, since
this is bounded to a small constant value > 1.

In practise this makes no difference currently, as a large precis will
have caused a malloc panic earlier anyway. But that might change in
future.

4 years agoPerl_sv_vcatpvfn_flags: simplify an expression
David Mitchell [Wed, 10 May 2017 13:03:25 +0000 (14:03 +0100)]
Perl_sv_vcatpvfn_flags: simplify an expression

In the hex floating/point code, (subnormal ? vfnz : vhex) is equivalent to
v0, which we just set to the same value.

So keep things simple.

4 years agosprintf(): handle mangled formats better with utf8
David Mitchell [Wed, 10 May 2017 10:19:38 +0000 (11:19 +0100)]
sprintf(): handle mangled formats better with utf8

Currently if sprintf() detects an error in the format while processing
a %.... entry, it copies the bytes as-is from the % to the point the
error was detected, then continues, If the output string and format string
don't have the same utf8-ness, this can result in badly-formed utf8
output.

This commit changes the code so that it just appends a '%' then restarts
processing from the character following the %. Most of the time this just
again results with the characters following the % being output as-is,
expect this time the 'normal' character-copying code path is taken, which
handles utf8 mismatches correctly.

By doing this, it also removes a block of code which contained a "roll
your own" string appender which used SvGROW() and Copy(). This was one
further place which was potentially open to wrapping and block overrun
bugs.

This commit may cause occasional changes in behaviour, depending on
whether there are any further '%' characters within the bad section of the
format.  Now these will be reprocessed, possibly triggering further
'Invalid conversion' type warnings.

4 years agoPerl_sv_vcatpvfn_flags: simplify wrap checking
David Mitchell [Tue, 9 May 2017 14:55:07 +0000 (15:55 +0100)]
Perl_sv_vcatpvfn_flags: simplify wrap checking

The main SvGROW() has a new-length arg roughly equivalent to

    (SvCUR(sv) + elen + zeros + esignlen + dotstrlen + 1);

Rationalise the overflow/wrap checking by doing each individual addition
separately with its own check. This is slightly redundant as some of the
values are interdependent, but this way it's easier to see whether all
possible overflows are being checked for.

`

4 years agoPerl_sv_vcatpvfn_flags: reduce scope of 'gap' var
David Mitchell [Tue, 9 May 2017 14:32:49 +0000 (15:32 +0100)]
Perl_sv_vcatpvfn_flags: reduce scope of 'gap' var

shouldn't make any functional difference

4 years agoPerl_sv_vcatpvfn_flags: reindent a block of code
David Mitchell [Tue, 9 May 2017 14:29:25 +0000 (15:29 +0100)]
Perl_sv_vcatpvfn_flags: reindent a block of code

(whitespace-only change)

indent a chunk of code ready for the next commit.

4 years agoPerl_sv_vcatpvfn_flags: reduce scope of 'have' var
David Mitchell [Tue, 9 May 2017 13:48:59 +0000 (14:48 +0100)]
Perl_sv_vcatpvfn_flags: reduce scope of 'have' var

Just declare this var in the small block where its needed, rather than
being in scope for 500+ lines.

Should be no functional changes.

4 years agoPerl_sv_vcatpvfn_flags: split the 'need' local var
David Mitchell [Tue, 9 May 2017 13:36:40 +0000 (14:36 +0100)]
Perl_sv_vcatpvfn_flags: split the 'need' local var

The 'need' local var has a wide scope (over 500 lines), and is used for
two separate purposes. Split it into two separate vars. One remains wide
scope, but is just used to calculate the new value of PL_efloatsize. Rename
that one to 'float_need'.

For the second use, introduce a new scope of just 6 lines with its own
'need' variable'.

This should make no functional difference but makes the code slightly
easier to understand and analyse.

4 years agosprintf(): add memory wrap tests
David Mitchell [Tue, 9 May 2017 13:29:11 +0000 (14:29 +0100)]
sprintf(): add memory wrap tests

In various places Perl_sv_vcatpvfn_flags() does croak_memory_wrap()
(including a couple added by the previous commit to fix RT #131260),
but there don't appear to be any tests for them.

So this commit adds some tests.

4 years agoFix dmake build breakage when using Visual C++
Steve Hay [Wed, 7 Jun 2017 07:39:20 +0000 (08:39 +0100)]
Fix dmake build breakage when using Visual C++

This was introduced by commit 1f664ef531. dmake with VC++ is not a common
combination, but I should have tested it :-(

4 years agoperldelta for 1097da16b21f
Tony Cook [Wed, 7 Jun 2017 05:17:44 +0000 (15:17 +1000)]
perldelta for 1097da16b21f

4 years ago[perl #131263] clear the UTF8 flag on a glob if it isn't UTF8
Tony Cook [Wed, 7 Jun 2017 05:00:26 +0000 (15:00 +1000)]
[perl #131263] clear the UTF8 flag on a glob if it isn't UTF8

Previously sv_2pv_flags() would set the UTF8 flag on a glob if it
had a UTF8 name, but wouldn't clear tha flag if it didn't.

This meant a name change, eg. if assigned another glob, from a UTF8
name to a non-UTF8 name would leave the flag set.

4 years ago[perl #131221] improve duplication of :via handles
Tony Cook [Thu, 1 Jun 2017 05:11:27 +0000 (15:11 +1000)]
[perl #131221] improve duplication of :via handles

Previously duplication (as with open ... ">&...") would fail
unless the user supplied a GETARG, which wasn't documented, and
resulted in an attempt to free and unreferened scalar if supplied.

Cloning on thread creation was simply broken.

We now handle GETARG correctly, and provide a useful default if it
returns nothing.

Cloning on thread creation now duplicates the appropriate parts of the
parent thread's handle.

4 years agoFatalize the use of code points above 0xFF for bitwise operators.
Abigail [Tue, 6 Jun 2017 23:27:47 +0000 (01:27 +0200)]
Fatalize the use of code points above 0xFF for bitwise operators.

This commit removes quite a number of tests, mostly from t/op/bop.t,
which test the behaviour of such code points in combination of
bitwise operators. Since it's now fatal, the tests are no longer useful.

4 years agoenforce size constraint via STATIC_ASSERT, not just a comment
Lukas Mai [Tue, 6 Jun 2017 23:00:58 +0000 (01:00 +0200)]
enforce size constraint via STATIC_ASSERT, not just a comment

4 years agorename STATIC_ASSERT_GLOBAL to STATIC_ASSERT_DECL
Lukas Mai [Tue, 6 Jun 2017 22:55:34 +0000 (00:55 +0200)]
rename STATIC_ASSERT_GLOBAL to STATIC_ASSERT_DECL

There's nothing that stops you from using it in a local scope and doing
so can be useful occasionally.

I believe this change in names is harmless because there are no direct
users of STATIC_ASSERT_GLOBAL in core or on CPAN; they all go through
STATIC_ASSERT_STMT.

4 years agoFatalize inheriting AUTOLOAD for non-methods.
Abigail [Tue, 6 Jun 2017 21:16:30 +0000 (23:16 +0200)]
Fatalize inheriting AUTOLOAD for non-methods.

This was deprecated in 5.004.

4 years agobuildtoc: explicitly accept -q (RT #131520)
Lukas Mai [Tue, 6 Jun 2017 21:01:35 +0000 (23:01 +0200)]
buildtoc: explicitly accept -q (RT #131520)

Normally the default behavior of Getopt::Long is to enable auto_abbrev,
which allows '--quiet' to be spelled as '-q', but not when
POSIXLY_CORRECT is set:

 $ POSIXLY_CORRECT=1 make
 ...
 ./perl -Ilib -I. -f pod/buildtoc -q
 Unknown option: q
 pod/buildtoc: Usage: pod/buildtoc [--quiet]
 make: *** [makefile:405: pod/perltoc.pod] Error 255

4 years agoRemove B::OP:terse
Abigail [Tue, 6 Jun 2017 18:59:59 +0000 (20:59 +0200)]
Remove B::OP:terse

This method was deprecated, and, according to the comments, didn't
work correctly anyway.

4 years agoperldelta entry for 13f4dd346e6f3b61534a20f246de3a80b3feb743
Abigail [Tue, 6 Jun 2017 18:00:04 +0000 (20:00 +0200)]
perldelta entry for 13f4dd346e6f3b61534a20f246de3a80b3feb743

4 years agoRemove diag entry about comma-less format variable list.
Abigail [Tue, 6 Jun 2017 17:50:47 +0000 (19:50 +0200)]
Remove diag entry about comma-less format variable list.

Commit c7321345b8729a0b98040be0b0b96e41f6a13ba8 removed accepting
comma-less format variables, so this entry can go.

4 years agoOut of range Unicode code point is now fatal.
Abigail [Tue, 6 Jun 2017 17:40:11 +0000 (19:40 +0200)]
Out of range Unicode code point is now fatal.

Followup on 13f4dd346e6f3b61534a20f246de3a80b3feb743. This commit patch
pod/perldiag, to change the "Use of code point 0x%s is deprecated"
deprecation message into the "Use of code point 0x%s is not allowed"
fatal error.

Adjusted the wording of the description accordingly.

4 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.

4 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>
4 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

4 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.

4 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.

4 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.

4 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'.

4 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.

4 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.

4 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

4 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

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

4 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

4 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.

4 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.

4 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)/

4 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.

4 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

4 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.

4 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.

4 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.

4 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.

4 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

4 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

4 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

4 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

4 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.

4 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.

4 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.

4 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.

4 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

4 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

4 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.

4 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

4 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

4 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

4 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>
4 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.

4 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

4 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

4 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.

4 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

4 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.

4 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.

4 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

4 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.

4 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

4 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

4 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)

4 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.

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

4 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

4 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.

4 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 ()'

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

4 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

4 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.

4 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].

4 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.

4 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

4 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.

4 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

4 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.

4 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.

4 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

4 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

4 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.

4 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.

4 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.

4 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

4 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.

4 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.

4 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).