This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agoPorting/todo.pod: refaliasing needs fixing still
Father Chrysostomos [Tue, 7 Jun 2016 21:36:58 +0000 (14:36 -0700)]
Porting/todo.pod: refaliasing needs fixing still

I don’t know when I’ll be able to get to this.  This seems like a good
place to jot down the ideas that existed only in my head till now.

7 years agoPorting/todo.pod: Suggest Deparse improvements
Father Chrysostomos [Tue, 7 Jun 2016 21:17:38 +0000 (14:17 -0700)]
Porting/todo.pod: Suggest Deparse improvements

7 years agoop/lex_assign.t: fix intermittent failures
David Mitchell [Tue, 7 Jun 2016 16:41:20 +0000 (17:41 +0100)]
op/lex_assign.t: fix intermittent failures

The bulk of this test script tests whether ops which are capable of
the OA_TARGLEX optimisation return the same results with lexical and
package var assignments, i.e.

    my $a;
    $a = OP;
    $b = OP;
    is($a,$b);

When OP is 'time', the two calls can return different times, resulting in
occasional intermittent failures. So move time into it's custom test which
can cope with a delta of 1.

Similarly if the op is <*>, parallel testing can result in temporary files
appearing in the current directory, resulting in different returns.
However, since glob doesn't actually have the 'T' (OA_TARGLEX) set in
regen/opcodes, this test is moot - so skip it.

If glob ever does ever get OA_TARGLEX, and so need to be tested, it may
require some subtlety, such as globbing for a pattern that won't match any
temporary files.

7 years agoFix Pod-Checker version
Chris 'BinGOs' Williams [Tue, 7 Jun 2016 14:49:51 +0000 (15:49 +0100)]
Fix Pod-Checker version

7 years agoPorting/todo.pod: Add note to ‘repack the optree’
Father Chrysostomos [Tue, 7 Jun 2016 05:30:17 +0000 (22:30 -0700)]
Porting/todo.pod: Add note to ‘repack the optree’

7 years agoPorting/todo.pod: Hey, we have refaliasing
Father Chrysostomos [Tue, 7 Jun 2016 05:26:11 +0000 (22:26 -0700)]
Porting/todo.pod: Hey, we have refaliasing

7 years agoPorting/todo.pod: Rmv ‘LVALUE functions for lists’
Father Chrysostomos [Tue, 7 Jun 2016 05:25:19 +0000 (22:25 -0700)]
Porting/todo.pod: Rmv ‘LVALUE functions for lists’

$ ./perl -Ilib -e 'sub foo :lvalue{@hash{"foo","bar"}} (foo) = (3,4); use Data::Dumper; warn Dumper \%hash'
$VAR1 = {
          'foo' => 3,
          'bar' => 4
        };
$ ./perl -Ilib -e 'sub foo :lvalue{@arr[1,2]} (foo) = (3,4); use Data::Dumper; warn Dumper \@arr'
$VAR1 = [
          undef,
          3,
          4
        ];

Apparently slices do work.

7 years agoPorting/todo.pod: Update file name in ‘truncate() prototype’
Father Chrysostomos [Tue, 7 Jun 2016 05:21:11 +0000 (22:21 -0700)]
Porting/todo.pod: Update file name in ‘truncate() prototype’

7 years agoPorting/todo.pod: Point out problem with readpipe(LIST)
Father Chrysostomos [Tue, 7 Jun 2016 05:19:46 +0000 (22:19 -0700)]
Porting/todo.pod: Point out problem with readpipe(LIST)

7 years agoPorting/todo.pod: Suggest documenting XS & lex subs
Father Chrysostomos [Tue, 7 Jun 2016 05:13:42 +0000 (22:13 -0700)]
Porting/todo.pod: Suggest documenting XS & lex subs

7 years agoPorting/todo.pod: Delete strcat/strcpy test entry
Father Chrysostomos [Tue, 7 Jun 2016 05:11:15 +0000 (22:11 -0700)]
Porting/todo.pod: Delete strcat/strcpy test entry

We have t/porting/libperl.t.

7 years agoperldelta for 0a44e30b028e99
Tony Cook [Tue, 7 Jun 2016 05:11:44 +0000 (15:11 +1000)]
perldelta for 0a44e30b028e99

7 years ago[perl #127333] add warning for until(assignment)
Dan Collins [Tue, 7 Jun 2016 01:04:46 +0000 (21:04 -0400)]
[perl #127333] add warning for until(assignment)

while ($a = 1) emits a warning "Found = in conditional, should be ==".
However, until ($a = 1) does not. The parser breaks down until
(condition) into while (!(condition)), which defeats the check in
S_scalarboolean, since it is looking for a conditional that /is/ an
assignment, but we have a conditional that is a thinly veiled assignment.

A similar bug is [perl #127122]. That bug was fixed by treating
unless (a) {b} else {c} as if (a) {c} else {b}, instead of treating it
as if (!a) {b} else {c}. That approach will not work here.

Instead, the test in S_scalarboolean has been widened. It previously
looked for an OP_SASSIGN with op_first OP_CONST, it now also detects an
OP_NOT surrounding that construct.

Tests for both while() and until() were also added to t/lib/warnings/op.

7 years agoskip a Tets-Simple test that's leaking shm blocks
Tony Cook [Tue, 7 Jun 2016 01:30:03 +0000 (11:30 +1000)]
skip a Tets-Simple test that's leaking shm blocks

Reported upstream as

https://github.com/Test-More/test-more/issues/679

7 years agoPorting/todo.pod: Don't need pod fixes anymore
Karl Williamson [Mon, 6 Jun 2016 21:12:53 +0000 (15:12 -0600)]
Porting/todo.pod: Don't need pod fixes anymore

I recently fixed just about all the core perl pod errors that are
fixable, so this task can be considered completed.

7 years agoFix compiler warning -Wuninitialized
Andy Lester [Mon, 6 Jun 2016 19:13:53 +0000 (14:13 -0500)]
Fix compiler warning -Wuninitialized

7 years agoIncrease $XS::APItest::VERSION to 0.82
Father Chrysostomos [Mon, 6 Jun 2016 20:41:39 +0000 (13:41 -0700)]
Increase $XS::APItest::VERSION to 0.82

7 years agoAdd intro_my to XS::APItest::lexical_import
Father Chrysostomos [Mon, 6 Jun 2016 20:40:12 +0000 (13:40 -0700)]
Add intro_my to XS::APItest::lexical_import

so that code thieves will have some correct code to steal.

Without intro_my(), the lexical subs installed in a ‘use’ block will
not be visible to the following statement, but only the one after it.
BEGIN blocks already get intro_my called, so it worked already with a
BEGIN block, but not with ‘use’.

7 years ago(perl #127993) test reporting of multiple conflict markers
Tony Cook [Mon, 6 Jun 2016 00:43:48 +0000 (10:43 +1000)]
(perl #127993) test reporting of multiple conflict markers

7 years agouse yyerror instead of croaking immediately (RT #127993)
Lukas Mai [Sat, 4 Jun 2016 11:05:36 +0000 (13:05 +0200)]
use yyerror instead of croaking immediately (RT #127993)

7 years agoconstant: don't skip the E2BIG test on Hurd, but improve comments
Dominic Hargreaves [Sun, 5 Jun 2016 10:44:51 +0000 (11:44 +0100)]
constant: don't skip the E2BIG test on Hurd, but improve comments

As Father Chrysostomos explained on [perl #128319] the previous change
was based on a misunderstanding of the purpose of the test, which is
only to test that constant.pm can create a dualvar out of $! which
has an error string, and nothing specifically to do with E2BIG.

The new comments, also suggested by Father Chrysostomos, make this more
clear.

7 years agoconstant: skip E2BIG test on GNU/Hurd
Dominic Hargreaves [Sat, 4 Jun 2016 13:36:26 +0000 (14:36 +0100)]
constant: skip E2BIG test on GNU/Hurd

Hurd doesn't use 7 for E2BIG, so this string test would fail if the
test itself were more precise.

7 years agofix bogus "at end of line" error message for "my (my $x, $y, $z)"
Lukas Mai [Sat, 4 Jun 2016 10:44:57 +0000 (12:44 +0200)]
fix bogus "at end of line" error message for "my (my $x, $y, $z)"

7 years agospelling: s/delimeter/delimiter/
Lukas Mai [Sat, 4 Jun 2016 10:23:06 +0000 (12:23 +0200)]
spelling: s/delimeter/delimiter/

7 years ago[perl #128307] Fix ‘foo ? require : bar’
Father Chrysostomos [Fri, 3 Jun 2016 05:35:10 +0000 (22:35 -0700)]
[perl #128307] Fix ‘foo ? require : bar’

The lexer’s bareword-parser that kicks in after it sees ‘require’ was
getting confused by the single colon, since it assumed that if the
thing that followed began with a letter or colon it must be a package
or module name.  Hence, require with : after it was parsed as
require "", but with a ‘bareword’ "".  The lexer should be checking
for two colons, not just one.

7 years agoDon’t use yyerror for each($scalar) experiment err
Father Chrysostomos [Fri, 3 Jun 2016 05:10:04 +0000 (22:10 -0700)]
Don’t use yyerror for each($scalar) experiment err

This is a follow-up to 69e7f50e50.  69e7f50e50 resulted in yyerror
being called twice for the same error, resulting in double diagnos-
tics for where the error occurred:

$ ./perl -e 'keys $scalar, $1'
Experimental keys on scalar is now forbidden at -e line 1, near "$scalar,"
Type of arg 1 to keys must be hash or array (not scalar dereference) at -e line 1, near "$scalar,"
Execution of -e aborted due to compilation errors.

We don’t need ‘near "$scalar,"’ twice.

For the first one we should queue the error directly, using qerror()
(which yyerror itself normally calls), so we don’t get double
diagnostics.

7 years agoAdd Configure probe for strerror_l()
Aaron Crane [Thu, 2 Jun 2016 18:11:12 +0000 (19:11 +0100)]
Add Configure probe for strerror_l()

As requested by khw++

Until the relevant symbol is used, HAS_STRERROR_L must be mentioned
explicitly in metaconfig.h.

This corresponds to metaconfig d0838744f03cfe7642950ea91dd48f575d0bfd15.

7 years agoAdd Configure probe for querylocale()
Aaron Crane [Thu, 2 Jun 2016 18:04:49 +0000 (19:04 +0100)]
Add Configure probe for querylocale()

As requested by khw++

Until the relevant symbol is used, HAS_QUERYLOCALE must be mentioned
explicitly in metaconfig.h.

This corresponds to metaconfig 541f0dd272df4f9326996727898393ac8f6626f7.

7 years agoRebuild Configure from current metaconfig
Aaron Crane [Thu, 2 Jun 2016 17:56:02 +0000 (18:56 +0100)]
Rebuild Configure from current metaconfig

  Relevant changes:

  commit 5d3ffa97290d2d3d65a42a0ed8b69d945b661ee7
  Author: H.Merijn Brand - Tux <h.m.brand@xs4all.nl>
  Date:   Sun May 29 15:30:33 2016 +0200

      Finish.U isn't modified anymore

      All changes accepted by upstream. One down, 164 to go

  commit 5d805d83bd4663831594540ddadeeb6213d19736
  Author: H.Merijn Brand - Tux <h.m.brand@xs4all.nl>
  Date:   Sat May 14 18:48:26 2016 +0200

      Remove trailing whitespace on meta-lines in unit files

      This change has also been proposed as PR to dist upstream

  commit b9807b5fe3f4c97fa34e19b8a9b265f91f0e4aca
  Author: H.Merijn Brand - Tux <h.m.brand@xs4all.nl>
  Date:   Sat May 14 18:30:03 2016 +0200

      Merged changes to Finish.U

7 years agoGet EUMM basic.t passing again on Win32.
Craig A. Berry [Thu, 2 Jun 2016 12:18:20 +0000 (07:18 -0500)]
Get EUMM basic.t passing again on Win32.

There are dueling uses of PERL_CORE.  On Windows, the FIXIN macro
assumes it can run pl2bat.bat from the installed Perl if PERL_CORE
is not set, so deleting PERL_CORE from the environment as this
test was doing makes you get the wrong one (or none at all).

But if PERL_CORE is set, the metafile target is not generated in
the Makefile, so you can't test that or things that depend on it
(e.g. disttest).  So at least for now, get basic.t passing by
skipping those tests.

7 years agoRenée Bäcker will be doing the October release, 5.25.10
Sawyer X [Wed, 1 Jun 2016 09:21:33 +0000 (11:21 +0200)]
Renée Bäcker will be doing the October release, 5.25.10

7 years agoallow ext/XS-APItest/t/win32.t to pass with both E: and T: drives
Tony Cook [Wed, 1 Jun 2016 07:23:05 +0000 (17:23 +1000)]
allow ext/XS-APItest/t/win32.t to pass with both E: and T: drives

Encountered while testing locally on Windows 7 x64.

cmd.exe stores the current directory for each drive as entries in the
environment, like:

  C:\Users\tony>set "" | findstr "^="
  =::=::\
  =C:=C:\Users\tony
  =D:=D:\ASM1061

When a Win32 build of perl built with USE_IMP_SYS starts up it saves
the current directories of each drive in a per-thread structure so
that each pseudo-forked process can have it's own set of drive current
directories.

If you run an external command, some versions of cmd.exe will add
an entry to the environment storing the result of that command, for
example:

  C:\Users\tony>set "" | find "ExitCode"

  C:\Users\tony>git status
  fatal: Not a git repository (or any of the parent directories): .git

  C:\Users\tony>set "" | find "ExitCode"
  =ExitCode=00000080

which is similar to the current directory entries.

The sloppy parsing by VDir::FromEnv[WA]() would treat that as a
current directory entry for the E: drive, copying the "tCode=...."
into the current directory.  Normally these values include a leading
drive letter and \, like "E:\", but this case leaves us without that.

Later, when harness spawns the child process it builds a new environment
block, including the drive current directories, which is done by
VDir::BuildEnvironmentSpace().  This, rather than using the index of
the drive to build the "=C:=..." entries above, uses the first
letter of the stored entry, so the environment block would have
something like:

  t:=tCode=00000080

which the child perl would treat as the current directory for the T:
drive.

7 years ago[perl #128294] bisect-runner.pl: --no-module-tests
Father Chrysostomos [Tue, 31 May 2016 13:32:16 +0000 (06:32 -0700)]
[perl #128294] bisect-runner.pl: --no-module-tests

7 years agoUnicode/UCD.t: better handling of errors
Karl Williamson [Mon, 30 May 2016 16:39:05 +0000 (10:39 -0600)]
Unicode/UCD.t: better handling of errors

This now looks for the PERL_DIFF_TOOL environment variable, and if found
uses that to display some problems.  If not found, it uses is(), with a
message that better output is available through setting this variable.

PERL_DIFF_TOOL is a convention I wasn't familiar with.

7 years agoAdd an example of the '0x' string format.
Jarkko Hietaniemi [Sat, 28 May 2016 17:56:27 +0000 (13:56 -0400)]
Add an example of the '0x' string format.

I am not certain that I find the 'leading zero means hex' format
recommendable ('0123' meaning '0x123', the octal format has poisoned
the well); but water under the bridge.

7 years agoModify hints for Hurd per Debian ticket 825020.
Samuel Thibault [Mon, 30 May 2016 15:11:00 +0000 (11:11 -0400)]
Modify hints for Hurd per Debian ticket 825020.

For:  RT #128279

Patch written by Samuel Thibault, forwarded by Dominic Hargreaves.

7 years agoUpdate Test-Simple in blead
Chad Granum [Mon, 30 May 2016 12:56:31 +0000 (05:56 -0700)]
Update Test-Simple in blead

This updates to the latest Test-Simple. This fixes several small bugs
including noisy STDERR in the test suite, and leaking TEMP files.

7 years agoop.c:S_my_kid: Remove obsolete comment
Father Chrysostomos [Sun, 29 May 2016 22:48:24 +0000 (15:48 -0700)]
op.c:S_my_kid: Remove obsolete comment

/* XXX does this let anything illegal in? */

The commit that added that comment indeed allowed ‘our $$x’ and even
‘my $$x’, so it was a problem at the time.  It was this commit:

commit 77ca0c92d2c0e47301d906d355d9ab3afb6f6bcb
Author: Larry Wall <larry@wall.org>
Date:   Fri Sep 24 14:59:37 1999 -0700

    Re: [PATCH 5.005_61] "our" declarations

This commit fixed the problem:

commit b6512f489e761186d508cf0b8b7705805cfefc52
Author: Mark-Jason Dominus <mjd@plover.com>
Date:   Mon Dec 24 13:14:48 2001 -0500

    PATCH: Restore "Can't declare scalar dereference in my" error

so the comment is no longer relevant.

7 years ago[perl #128266] libperl.t: Ignore $UNIX2003 suffix
Father Chrysostomos [Sun, 29 May 2016 21:18:07 +0000 (14:18 -0700)]
[perl #128266] libperl.t: Ignore $UNIX2003 suffix

7 years agoext/POSIX/t/sigaction.t: Skip uid and pid tests on GNU/Hurd
Dominic Hargreaves [Sat, 28 May 2016 14:51:53 +0000 (15:51 +0100)]
ext/POSIX/t/sigaction.t: Skip uid and pid tests on GNU/Hurd

SA_SIGINFO does not include uid and pid on GNU/Hurd, and this is
unlikely to change in the near future, so skip these tests.

Thanks to Samuel Thibault for the report.

Bug-Debian: https://bugs.debian.org/825016

7 years agopodcheck.t: Include tr// and y// detection
Karl Williamson [Wed, 25 May 2016 19:22:26 +0000 (13:22 -0600)]
podcheck.t: Include tr// and y// detection

These are like regular expressions, and for syntactic purposes can be
treated as such.

7 years agoMerge branch to update Pod::Checker into blead
Karl Williamson [Fri, 27 May 2016 17:24:57 +0000 (11:24 -0600)]
Merge branch to update Pod::Checker into blead

This merge branch contains two commits, which should be considered
inseperable.  The first updates Pod::Checker, and the second changes
podcheck.t to use the new Pod::Checker.

This is the biggest remaining step in allowing Pod::Parser to be
removed from core.  podcheck.t still uses Pod::Parser to extract just
the pod from files.  That dependency can be removed when Pod::Simple
changes to allow equivalent functionality, something I myself am working
on.

There are two cpan .t files (both in pod2usage) that use subcomponents
of Pod::Parser (Pod::Find and Pod::PlainText).  There appears to be
similar functionality in Pod::Simple, so that shouldn't be too hard to
fix, but I haven't looked further than finding that these aren't drop-in
replacements.  The pod2usage maintainer has been notified.

7 years agopodcheck.t: Use new Pod::Checker
Karl Williamson [Wed, 25 May 2016 17:10:18 +0000 (11:10 -0600)]
podcheck.t: Use new Pod::Checker

podcheck.t extends the Pod::Checker class.  Pod::Checker has been
rewritten to base off of Pod::Simple instead of Pod::Parser, and so
podcheck.t must switch to use use the completely new methods defined.

7 years agoUpdate Pod::Checker to CPAN version 1.72
Karl Williamson [Wed, 25 May 2016 17:10:23 +0000 (11:10 -0600)]
Update Pod::Checker to CPAN version 1.72

This is now based on Pod::Simple instead of Pod::Parser

podcheck.t will fail until the next commit is done.

7 years agoSubject: Pod::Checker: convert files from DOS to unix
Karl Williamson [Thu, 26 May 2016 23:33:32 +0000 (17:33 -0600)]
Subject: Pod::Checker: convert files from DOS to unix

This is in preparation for applying patches to these.  git am failed on
these.  Only files that need to be DOS should be.

The version is bumped to 1.72, which is what version the real patches
are from.

7 years agopodcheck.t: Move a declaration
Karl Williamson [Wed, 25 May 2016 16:40:51 +0000 (10:40 -0600)]
podcheck.t: Move a declaration

This just moves a variable declaration and initialization to elsewhere
in the file where it can be used in a different place in a future
commit.  And it is now placed where it is more visible, as it really is
a program-level definition.

The code is outdented as well, and the comment unwrapped to be on a
single line, but no other changes were made.

7 years agoregcomp.c: Add shortcuts to some inversion list ops
Karl Williamson [Thu, 3 Mar 2016 21:24:39 +0000 (14:24 -0700)]
regcomp.c: Add shortcuts to some inversion list ops

When taking the union or intersection of two inversion lists, not
infrequently the result is the same as one of the inputs.  An example is
the union of a set that contains all code points with any other set.
The result is the set that contains all code points.  Also, not
infrequently, the result is to overwrite one of the inputs.  If the
other input contributed nothing to the result, the whole operation is
effectively a no-op, as the result has the same contents as the input it
overwrites.

It turns out that it is cheap to keep track of if just one input
contributes to the result.  This commit does that, and short-circuits
the rest of the code if it is going to turn out to be a no-op.

7 years agoext/VMS-DCLsym/DCLsym.pm: Fix missing pod reference
Karl Williamson [Thu, 26 May 2016 01:23:57 +0000 (19:23 -0600)]
ext/VMS-DCLsym/DCLsym.pm: Fix missing pod reference

This looks like it was meant to point to a later heading or item in the
document, but which was removed at some point, with the reference left
dangling.  I confirmed with Craig Berry that what it is referring to is
the text in the next paragraph.

7 years agoDevel::Peek: Fix a couple of pod glitches
Karl Williamson [Wed, 25 May 2016 04:14:59 +0000 (22:14 -0600)]
Devel::Peek: Fix a couple of pod glitches

7 years agoporting/dual-life.t: Clarify test messages
Karl Williamson [Wed, 25 May 2016 01:35:17 +0000 (19:35 -0600)]
porting/dual-life.t: Clarify test messages

This changes the message output by the ok() sub to show precisely what
is being tested

7 years agofix locale.c under -DPERL_GLOBAL_STRUCT(_PRIVATE)
David Mitchell [Wed, 25 May 2016 18:15:27 +0000 (19:15 +0100)]
fix locale.c under -DPERL_GLOBAL_STRUCT(_PRIVATE)

With that build option initialised statics aren't allowed (no BSS).
So just disable using $ENV{PERL_DEBUG_LOCALE_INIT} under
-DPERL_GLOBAL_STRUCT.

7 years agoporting/libperl.t: better diag output
David Mitchell [Wed, 25 May 2016 17:50:10 +0000 (18:50 +0100)]
porting/libperl.t: better diag output

when it complains about unexpected BSS symbols, list them

7 years agoadd missing dVAR in pp_avhvswitch
David Mitchell [Wed, 25 May 2016 17:30:17 +0000 (18:30 +0100)]
add missing dVAR in pp_avhvswitch

make it build under -DPERL_GLOBAL_STRUCT.

7 years agoExtUtils::ParseXS: Silence some pod warnings
Karl Williamson [Wed, 25 May 2016 03:31:13 +0000 (21:31 -0600)]
ExtUtils::ParseXS: Silence some pod warnings

These were found by the new Pod::Checker, soon to be committed.

7 years agoPathTools: fix Pod::Checker warning for pod
Karl Williamson [Wed, 25 May 2016 03:23:59 +0000 (21:23 -0600)]
PathTools: fix Pod::Checker warning for pod

The new Pod::Checker soon to be commited doesn't like lines with only
white space.

7 years agoPod::Functions/Functions_pm.PL: Fix pod error
Karl Williamson [Thu, 28 Apr 2016 22:53:40 +0000 (16:53 -0600)]
Pod::Functions/Functions_pm.PL: Fix pod error

This is trailing white space, that is warned against by the
new version of Pod::Checker that is soon to be committed.

7 years agolocale.c: don't use strcpy()
David Mitchell [Tue, 24 May 2016 22:45:48 +0000 (23:45 +0100)]
locale.c: don't use strcpy()

A recent commit added a strcpy() to locale.c.

This is Frowned Upon, and was making porting/libperl.t fail.

Since PL_strxfrm_min_char appears to be a 3-byte buffer, I've just changed
it to manually copy 3 individual bytes - which is probably more efficient
than a full-blown Copy(). But I haven't looked closely at whether this is
correct - this is more of quick fix to get smoking passing again.

7 years agolocale.c: Make locale collation predictions adaptive
Karl Williamson [Fri, 13 May 2016 17:32:44 +0000 (11:32 -0600)]
locale.c: Make locale collation predictions adaptive

We try to avoid calling strxfrm() more than needed by predicting its
needed buffer size.  This generally works because the size of the
transformed string is roughly linear with the size of the input string.
But the key word here is "roughly".  This commit changes things, so that
when we guess low, we change the coefficients in the equation to guess
higher the next time.

7 years agolocale.c: Not so aggressive collation memory use guess
Karl Williamson [Tue, 12 Apr 2016 20:28:57 +0000 (14:28 -0600)]
locale.c: Not so aggressive collation memory use guess

On platforms where  strxfrm() is not well-behaved, and it fails because
it needs a larger buffer, prior to this commit, the size was doubled
before trying again.  This could require a lot of memory on large
inputs.  I'm uncomfortable with such a big delta on very large strings.
This commit changes it so it is not so aggressive.  Note that this now
only gets called on platforms whose strxfrm() is not well behaved, and I
think the size prediction is better due to a recent commit, and there
isn't really much of a downside in not gobbling up memory so fast.

7 years agolocale.c: Add some debugging statements
Karl Williamson [Wed, 18 May 2016 19:18:01 +0000 (13:18 -0600)]
locale.c: Add some debugging statements

7 years agolocale.c: Minor cleanup
Karl Williamson [Wed, 18 May 2016 19:17:25 +0000 (13:17 -0600)]
locale.c: Minor cleanup

This replaces an expression with what I think is an easier to understand
macro, and eliminates a couple of temporary variables that just
cluttered things up.

7 years agolocale.c: Fix some debugging so will output during init
Karl Williamson [Sun, 15 May 2016 00:23:02 +0000 (18:23 -0600)]
locale.c: Fix some debugging so will output during init

Because the command line options are currently parsed after the locale
initialization is done, an environment variable is read to allow
debugging of the function that is called to do the initialization.
However, any functions that it calls, prior to this commit, were unaware
of this and so did not output debugging.  This commit fixes most of
them.

7 years agomv function from locale.c to mathoms.c
Karl Williamson [Tue, 12 Apr 2016 18:49:36 +0000 (12:49 -0600)]
mv function from locale.c to mathoms.c

The previous commit causes this function being moved to be just a
wrapper not called in core.  Just in case someone is calling it, it is
retained, but moved to mathoms.c

7 years agoDo better locale collation in UTF-8 locales
Karl Williamson [Wed, 18 May 2016 02:50:55 +0000 (20:50 -0600)]
Do better locale collation in UTF-8 locales

On some platforms, the libc strxfrm() works reasonably well on UTF-8
locales, giving a default collation ordering.  It will assume that every
string passed to it is in UTF-8.  This commit changes Perl to make sure
that strxfrm's expectations are met.

Likewise under a non-UTF-8 locale, strxfrm is expecting a non-UTF-8
string.   And this commit makes sure of that as well.

So, simply meeting strxfrm's expectations allows Perl to start
supporting default collation in UTF-8 locales, and fixes it to work on
single-byte locales with UTF-8 input.  (Unicode::Collate provides
tailorable functionality and is portable to platforms where strxfrm
isn't as intelligent, but is a much more heavy-weight solution that may
not be needed for particular applications.)

There is a problem in non-UTF-8 locales if the passed string contains
code points representable only in UTF-8.  This commit causes them to be
changed, before being passed to strxfrm, into the highest collating
character in the locale that doesn't require UTF-8.  They then will sort
the same as that character, which means after all other characters in
the locale but that one.  In strings that don't have that character,
this will generally provide exactly correct operation.  There still is a
problem, if that character, in the given locale, combines with adjacent
characters to form a specially weighted sequence.  Then, the change of
these above-255 code points into that character can skew the results.
See the commit message for 6696cfa7cc3a0e1e0eab29a11ac131e6f5a3469e for
more on this.  But it is really an illegal situation to have above-255
code points in a single-byte locale, so this behavior is a reasonable
degradation when given illegal input.  If two transformed strings
compare exactly equal, Perl already uses the un-transformed versions to
break ties, and there, these faked-up strings will collate so the
above-255 code points sort after everything else, and in code point
order amongst themselves.

7 years agoperllocale: Change headings so two aren't identical
Karl Williamson [Tue, 12 Apr 2016 19:51:48 +0000 (13:51 -0600)]
perllocale: Change headings so two aren't identical

Two html anchors in this pod were identical, which isn't a problem
unless you try to link to one of them, as the next commit does

7 years agoChange calculation of locale collation coefficients
Karl Williamson [Tue, 12 Apr 2016 17:21:40 +0000 (11:21 -0600)]
Change calculation of locale collation coefficients

Every time a new collation locale is set, two coefficients are calculated
that are used in predicting how much space is needed in the
transformation of a string by strxfrm().  The transformed string is
roughly linear with the the length of the input string, so we are
calcaulating 'm' and 'b' such that

    transformed_length = m * input_length + b

Space is allocated based on this prediction.  If it is too small, the
strxfrm() will fail, and we will have to increase the allotted amount
and try again.  It's better to get the prediction right to avoid
multiple, expensive strxfrm() calls.

Prior to this commit, the calculation was not rigorous, and failed on
some platforms that don't have a fully conforming strxfrm().

This commit changes to not panic if a locale has an apparent defective
collation, but instead silently change to use C-locale collation.  It
could be argued that a warning should additionally be raised.

This commit fixes [perl #121734].

7 years agolocale.c: Change algorithm for strxfrm() trials
Karl Williamson [Tue, 12 Apr 2016 01:11:07 +0000 (19:11 -0600)]
locale.c: Change algorithm for strxfrm() trials

It's kind of guess work deciding how big a buffer to give to strxfrm().
If you give it too small a one, it will fail.  Prior to this commit, the
buffer size was doubled and then strxfrm() was called again, looping
until it worked, or we used too much memory.

Each time a new locale is made, we try to minimize the necessity of
doing this by calculating numbers 'm' and 'b' that can be plugged into
the equation

    mx + b

where 'x' is the size of the string passed to strxfrm().  strxfrm() is
roughly linear with respect to its input's length, so this generally
works without us having to do many loops to get a large enough size.

But on many systems, strxfrm(), in failing, returns how much space you
should have given it.  On such systems, we can just use that number on
the 2nd try and not have to keep guessing.  This commit changes to do
that.

But on other systems this doesn't work.  So the original method is
retained if we determine that there are problems with strxfrm(), either
from previous experience, or because using the size returned from the
first trial didn't work

7 years agolocale.c: Free over-allocated space early
Karl Williamson [Sun, 10 Apr 2016 02:40:48 +0000 (20:40 -0600)]
locale.c: Free over-allocated space early

We may over malloc some space in buffers to strxfrm().  This frees it
now instead of waiting for the whole block to be freed sometime later.
This can be a significant amount of memory if the input string to
strxfrm() is long.

7 years agolocale.c: White-space only
Karl Williamson [Sun, 10 Apr 2016 02:36:01 +0000 (20:36 -0600)]
locale.c: White-space only

Outdent and reflow because the previous commit removed an enclosing
block.

7 years agoChange mem_collxfrm() algorithm for embedded NULs
Karl Williamson [Sat, 9 Apr 2016 21:52:05 +0000 (15:52 -0600)]
Change mem_collxfrm() algorithm for embedded NULs

One of the problems in implementing Perl is that the C library routines
forbid embedded NUL characters, which Perl accepts.  This is true for
the case of strxfrm() which handles collation under locale.

The best solution as far as functionality goes, would be for Perl to
write its own strxfrm replacement which would handle the specific needs
of Perl.  But that is not going to happen because of the huge complexity
in handling it across many platforms.  We would have to know the
location and format of the locale definition files for every such
platform.  Some might follow POSIX guidelines, some might not.

strxfrm creates a transformation of its input into a new string
consisting of weight bytes.  In the typical but general case, a 3
character NUL-terminated input string 'A B C 00' (spaces added for
readability) gets transformed into something like:
    A¹ B¹ C¹ 01 A² B² C² 01 A³ B³ C³ 00
where the superscripted characters are weights for the corresponding
input characters.  Superscript 1 represents (essentially) the primary
sorting key; 2, the secondary, etc, for as many levels as the locale
definition gives.  The 01 byte is likely to be the separator between
levels, but not necessarily, and there could be some other mechanisms
used on various platforms.

To handle embedded NULs, the simplest thing would be to just remove them
before passing in to strxfrm().  Then they would be entirely ignored,
which might not be what you want.  You might want them to have some
weight at the tertiary level, for example.  It also causes problems
because strxfrm is very context sensitive.  The locale definition can
define weights for specific sequences of any length (and the weights can
be multi-byte), and by removing a NUL, two characters now become
adjacent that weren't in the input, and they could now form one of those
special sequences and thus throw things off.

Another way to handle NULs, that seemingly ignores them, but actually
doesn't, is the mechanism in use prior to this commit.  The input string
is split at the NULs, and the substrings are independently passed to
strxfrm, and the results concatenated together.  This doesn't work
either.  In our example 'A B C 00', suppose B is a NUL, and should have
some weight at the tertiary level.  What we want is:
    A¹ C¹ 01 A² C² 01 A³ B³ C³ 00

But that's not at all what you get.  Instead it is:
    A¹ 01 A² 01 A³ C¹ 01 C² 01 C³ 00
The primary weight of C comes immediately after the teriary weight of A,
but more importantly, a NUL, instead of being ignored at the primary
levels, is significant at all levels, so that "a\0c" would sort before
"ab".

Still another possibility is to replace the NUL with some other
character before passing it to strxfrm.  That was my original plan, to
replace each NUL with the character that this code determines has the
lowest collation order for the current locale.  On strings that don't
contain that character, the results would be as good as it gets for that
locale.  That character is likely to be ignored at higher weight levels,
but have some small non-ignored weight at the lowest ones.  And
hopefully the character would rarely be encountered in practice.  When
it does happen, it and NUL would sort identically; hardly the end of the
world.  If the entire strings sorted identically, the NUL-containing one
would come out before the other one, since the original Perl strings are
used as a tie breaker.  However, testing showed a problem with this.  If
that other character is part of a sequence that has special weighting,
the results won't be correct.  With gcc, U+00B4 ACUTE ACCENT is the
lowest collating character in many UTF-8 locales.  It combines in
Romanian and Vietnamese with some other characters to change weights,
and hence changing NULs into U+B4 screws things up.

What I finally have come to is to do is a modification of this final
approach, where the possible NUL replacements are limited to just
characters that are controls in the locale.  NULs are replaced by the
lowest collating control.  It would really be a defective locale if this
control combined with some other character to form a special sequence.
Often the character will be a 01, START OF HEADING.  In the very
unlikely case that there are absolutely no controls in the locale, 01 is
used, because we have to replace it with something.

The code added by this commit is mostly utf8-ready.  A few commits from
now will make Perl properly work with UTF-8 (if the platform supports
it).  But until that time, this isn't a full implementation; it only
looks for the lowest-sorting control that is invariant, where the
the UTF8ness doesn't matter.  The added tests are marked as TODO until
then.

7 years agolocale.c: Add, move, clarify comments
Karl Williamson [Wed, 18 May 2016 03:53:53 +0000 (21:53 -0600)]
locale.c: Add, move, clarify comments

This moves a large block of comments to before a block, outdents it, and
adds to it, plus adding another comment

7 years agoKeep track of if collation locale is UTF-8 or not
Karl Williamson [Mon, 16 May 2016 21:19:14 +0000 (15:19 -0600)]
Keep track of if collation locale is UTF-8 or not

This will be used in future commits

7 years agolocale.c: Don't use special locale collation for C locale
Karl Williamson [Mon, 16 May 2016 21:15:26 +0000 (15:15 -0600)]
locale.c: Don't use special locale collation for C locale

We can skip all the locale collation calculations if the locale we are
in is C or POSIX.

7 years agoperllocale: Document NUL collation handling
Karl Williamson [Sat, 21 May 2016 17:35:10 +0000 (11:35 -0600)]
perllocale: Document NUL collation handling

And add a TODO test, because this shortly will be improved upon

7 years agolib/locale.t: Don't calculate value unless needed
Karl Williamson [Fri, 13 May 2016 17:51:55 +0000 (11:51 -0600)]
lib/locale.t: Don't calculate value unless needed

7 years agomathoms.c: Remove obsolete text
Karl Williamson [Mon, 23 May 2016 16:01:41 +0000 (10:01 -0600)]
mathoms.c: Remove obsolete text

makedef.pl no longer needs special handling for any functions that get
moved to mathoms.c

7 years agoUpdate ExtUtils-MakeMaker to CPAN version 7.18
Chris 'BinGOs' Williams [Tue, 24 May 2016 10:39:59 +0000 (11:39 +0100)]
Update ExtUtils-MakeMaker to CPAN version 7.18

  [DELTA]

7.18  Mon May 23 15:55:26 BST 2016

    No changes since 7.17_03

7.17_03 Wed May 11 18:22:06 BST 2016

    Dist fixes:
    - remove build_requires on ourselves

7.17_02 Mon May  9 23:55:09 BST 2016

    Bug fixes:
    - Resolve a regression in c_o with trailing spaces

7.17_01 Mon May  9 20:02:02 BST 2016

    Test fixes:
    - Resolve issues with tests when running in core

7.16  Sat May  7 10:13:05 BST 2016

    No changes since 7.15_03

7.15_03 Sun May  1 14:13:44 BST 2016

    Bug fixes:
    - lazy load Time::HiRes in ExtUtils::Command::MM
    - fix 5.6 compat by removing indexed sprintf

7.15_02 Thu Apr 28 12:54:23 BST 2016

    Bug fixes:
    - Fix regression with small fractional numeric versions

7.15_01 Wed Apr 27 19:13:46 BST 2016

    Bug fixes:
    - Fix regression with SKIP and dynamic and static targets

7.14  Sun Apr 24 13:53:33 BST 2016

  No changes since 7.13_01

7.13_01 Sat Apr 23 16:41:20 BST 2016

    Bug fixes:
    - Make dynamic depend on config again, fixes issues with Inline

7.12 Tue Apr 19 12:24:41 BST 2016

    Enhancements:
    - version ranges are now supported for PREREQS, etc.
    - Metadata is now represented internally as Meta Spec 2.0
    - ExtUtils::Command has been re-incorporated at 1.19 of that module
    - Refactored XS handling
    - XSMULTI=>1 - put multiple *.xs under lib, it "just works" and XSBUILD
      for refined control of XSMULTI
    - can do "make test" without first doing "make"

    Bug fixes:
    - Handle new warnings from File::Path
    - Resolve RT#106572 specifying AUTHOR via command-line is broken
    - Warning on missing TEST_REQUIRES and CONFIGURE_REQUIRES
    - Sanitise make_type on Win32
    - Cygwin rebase fixes
    - Makefile starting comments reflect decoded @ARGV, not raw
    - Add various targets to .PHONY to avoid disk IO with dmake
    - Fixed race condition in realclean
    - improve static-build lib detection
    - Eliminate non-error STDERR
    - Make WriteEmptyMakefile Makefile functional when called in subdir
    - manifypods fixes
    - perllocal.pod generation "Perl in Space" fix
    - PASTHRU fixes
    - Fix distsignature dependencies for parallel make
    - Check exit status for commands in "make ci" target
    - Less noisey output during building sub-modules
    - Fix dos2unix() on Windows
    - stop makeaperl from polluting @ARGV in cases where ARGV contains args with spaces
    - Fix regression when both test.pl and t/*.t are present
    - Refactored internals to remove DirHandle usage
    - MM_Unix::find_perl() dont repeatedly stat the same path in a loop
    - No longer repeatedly attempt to load CPAN::Meta if it is now available

    VMS fixes:
    - Made MM_VMS::oneline build continuation lines properly
    - Implemented XSMULTI and XSBUILD
    - Resurrect PASTHRU on VMS
    - make_macro should handle multiple macros
    - Fix regression with File::Spec changes in previous release

    Win32 fixes:
    - t/echo.t needs SHELL env for Win32 gmake

    Dist fixes:
    - Made %ExtraPrereqs match bundled prereqs
    - Included MANIFEST.SKIP from ExtUtils::Manifest
    - The bundled Encode::Locale has been updated to 1.04

    Test fixes:
    - test PL_FILES of a "module"
    - Various tests no longer require a separate .pm file for testing
    - Support v5.6.1 in various tests
    - test static build if $ENV{AUTHOR_TESTING}
    - XS tests now pluggable
    - test for "Perl in Space"

    Doc fixes:
    - better document for PL_FILES, oneliner method
    - FAQ updated

7 years agoFix class name typo typo in perlootut example
Dagfinn Ilmari Mannsåker [Tue, 24 May 2016 10:25:49 +0000 (11:25 +0100)]
Fix class name typo typo in perlootut example

It's spelled correctly in the body text, but the code had it wrong.

7 years agomathoms.c: consolidate comments
David Mitchell [Mon, 23 May 2016 14:53:05 +0000 (15:53 +0100)]
mathoms.c: consolidate comments

The head of this source file contains quite a few general comment
paragraphs. Consolidate them all into one

  /*
   *
   */

block.

7 years agomathoms.c: add explanation why fns must be kept
David Mitchell [Mon, 23 May 2016 14:45:20 +0000 (15:45 +0100)]
mathoms.c: add explanation why fns must be kept

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

7 years agoPATCH: [perl #128219] typo in perlrecharclass
Karl Williamson [Mon, 23 May 2016 14:04:53 +0000 (08:04 -0600)]
PATCH: [perl #128219] typo in perlrecharclass

Thanks for spotting this.  It was a typo.  Alpha matches XPosixAlpha.

7 years agoCX_POP_SAVEARRAY(): use more distinctive var name
David Mitchell [Mon, 23 May 2016 13:43:56 +0000 (14:43 +0100)]
CX_POP_SAVEARRAY(): use more distinctive var name

Under -Wshadow, CX_POP_SAVEARRAY's local var 'av' can generate this
warning:

    warning: declaration shadows a local variable [-Wshadow]

So rename it to cx_pop_savearay_av to reduce the risk of a clash.

(See http://nntp.perl.org/group/perl.perl5.porters/236444)

7 years agoUpdate release link in epigraph for 5.25.1
Sawyer X [Sun, 22 May 2016 17:10:41 +0000 (19:10 +0200)]
Update release link in epigraph for 5.25.1

7 years agoUpdate Module::CoreList for 5.25.2
Sawyer X [Sun, 22 May 2016 17:00:13 +0000 (19:00 +0200)]
Update Module::CoreList for 5.25.2

7 years agoperldiag: Rewrite a mangled sentence
Father Chrysostomos [Sun, 22 May 2016 01:33:38 +0000 (18:33 -0700)]
perldiag: Rewrite a mangled sentence

7 years agoSort perldiag
Father Chrysostomos [Sun, 22 May 2016 01:31:26 +0000 (18:31 -0700)]
Sort perldiag

7 years agorecognize and reject version control conflict markers (RT #127993)
Lukas Mai [Sat, 21 May 2016 17:12:21 +0000 (19:12 +0200)]
recognize and reject version control conflict markers (RT #127993)

7 years agoFix STRESS_REALLOC after 3caf0269d
Father Chrysostomos [Sat, 21 May 2016 18:36:56 +0000 (11:36 -0700)]
Fix STRESS_REALLOC after 3caf0269d

This commit:

commit 3caf0269dd4c609b8c2bc22b54598c642ba63ed8
Author: David Mitchell <davem@iabyn.com>
Date:   Sun Dec 27 14:07:02 2015 +0000

    offset PL_savestack_max by SS_MAXPUSH

stopped savestack_grow from adding 4 to the allocated amount, which
broke builds with -Accflags=-DSTRESS_REALLOC.

savestack_grow accepts no arguments.  The callers have no way to
tell it how much to allocate; they just assume that it will allocate
enough.  By default, in increases the stack size by 50%, and the stack
starts out at 128 elements, so everything works fine.

Under STRESS_REALLOC, introduced by commit 2ce36478e5 in ’98, the
savestack started out at 1 (later, SS_MAXPUSH; as of 3caf0269d,
PL_savestack_max is 0 initially, though the actual stack size is
SS_MAXPUSH).  And the stack-growing functions in scope.h that default
to 50% instead add 1 element to the stack.

Anything that calls savestack_grow assumes it will allocate enough for
the savestack elements pushed.  The most elements ever pushed at once
is 4, so 2ce36478e5 added a +4 to the size in savestack_grow.

3caf0269d removed that +4, so the stack is only incremented by 1, and
this assertion at the end of scope.h:SS_ADD_END failed:

    if (UNLIKELY(ix > PL_savestack_max)) savestack_grow();      \
    assert(PL_savestack_ix <= PL_savestack_max);

3caf0269d was right in removing the +4, since it is unnecessary for
normal builds.  For STRESS_REALLOC, which is designed to grow stacks
as little as possible, we were allocating one more element than neces-
sary.  So this commit just explicitly grows the stack by SS_MAXPUSH
(the new name for 4) in savestack_grow if STRESS_REALLOC is defined.

7 years agoUpdate for the version thats on the CPAN
Chris 'BinGOs' Williams [Sat, 21 May 2016 15:46:12 +0000 (16:46 +0100)]
Update for the version thats on the CPAN

7 years agoSimplify parser’s handling of my/local
Father Chrysostomos [Sat, 21 May 2016 12:42:55 +0000 (05:42 -0700)]
Simplify parser’s handling of my/local

In Perl 5.000, the same token, LOCAL, was used for both ‘my’ and
‘local’, with a token value, passed to localize() as a second argu-
ment, to distinguish between them.

perl-5.003_07-9-g55497cf (inseparable changes from patch from
perl5.003_07 to perl5.003_08), for no apparent reason, split them into
two tokens, removing the token values and assigning values in perly.y
via $$ = 0 and $$ = 1.  They still ultimately made their way through
the same grammar rule, as there was only one localize() call in
perly.y.  The code still made sense.

perl-5.005_02-1816-g09bef84 (sub : attrlist) changed things, such that
the tokens are separate *and* they get separate token values assigned
to them.  ‘local’ and ‘my’ no longer follow the same grammar rules
in perly.y, so there are separate localize() calls for the different
token types.  Hence, the use of a token value to distinguish them does
not make sense.  It just makes this more complicated that necessary.

So this commit removes the token values.  Since the two token types
follow different paths through perly.y and have separate localize()
calls, we can hard-code the argument to localize() there, instead of
passing the value through from toke.c as a token value.

This does shrink toke.o slightly (for me it went from 876040 to
876000), and it makes this conceptually clearer.

7 years ago[perl #128204] Fix crash with @a &.= etc.
Father Chrysostomos [Sat, 21 May 2016 04:55:40 +0000 (21:55 -0700)]
[perl #128204] Fix crash with @a &.= etc.

The new bitwise operators in their assignment forms were not correctly
catching things like arrays on the lhs at compile time.

At run time, they would either crash or croak with ‘Can’t coerce
ARRAY...’.

This commit puts in the correct compile-time check, simply by flagging
these as scalar modifiers.

7 years agoAnother op description correction: & -> &.
Father Chrysostomos [Sat, 21 May 2016 03:32:48 +0000 (20:32 -0700)]
Another op description correction: & -> &.

The string bitwise ops have dots in them, which should be included
in the op descriptions.

7 years agoCorrect ‘bitiwse’ in two op descriptions
Father Chrysostomos [Sat, 21 May 2016 03:24:50 +0000 (20:24 -0700)]
Correct ‘bitiwse’ in two op descriptions

Oops!

7 years ago[Merge] &CORE::foo() calls with keys, push, etc.
Father Chrysostomos [Sat, 21 May 2016 05:14:08 +0000 (22:14 -0700)]
[Merge] &CORE::foo() calls with keys, push, etc.

The hash and array functions, keys, each, values, push, pop, shift,
unshift and splice, can now be called with ampersand syntax and via
reference.

7 years agoUpdate CORE.pod to reflect &CORE::keys() etc.
Father Chrysostomos [Sat, 21 May 2016 04:57:32 +0000 (21:57 -0700)]
Update CORE.pod to reflect &CORE::keys() etc.

7 years agoAllow assignment to &CORE::keys()
Father Chrysostomos [Sat, 21 May 2016 00:50:23 +0000 (17:50 -0700)]
Allow assignment to &CORE::keys()

7 years agoAllow &CORE::foo() with array functions
Father Chrysostomos [Tue, 17 May 2016 07:27:30 +0000 (00:27 -0700)]
Allow &CORE::foo() with array functions

7 years agoperldiag: Document unknown OA_* panic
Father Chrysostomos [Tue, 17 May 2016 06:32:06 +0000 (23:32 -0700)]
perldiag: Document unknown OA_* panic

7 years agof
Father Chrysostomos [Sat, 21 May 2016 05:13:15 +0000 (22:13 -0700)]
f

7 years agoAllow &CORE::foo() with hash functions
Father Chrysostomos [Tue, 17 May 2016 06:10:17 +0000 (23:10 -0700)]
Allow &CORE::foo() with hash functions

&CORE::keys does not yet work as an lvalue.  (I’m not sure how to make
that work.)