This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
5 years ago(perl #132925) don't use $0 to get the name of mk_invlists.pl
Tony Cook [Thu, 1 Mar 2018 04:42:56 +0000 (15:42 +1100)]
(perl #132925) don't use $0 to get the name of mk_invlists.pl

Other regen scripts simply embed the name as a literal, using $0
means that the output varies depending on the path used to call
regen/mk_invlists.pl.

5 years ago(perl #132925) correct path handling in mktables
Tony Cook [Thu, 1 Mar 2018 04:26:22 +0000 (15:26 +1100)]
(perl #132925) correct path handling in mktables

the lexical my $file inside the loop masked the for loop $file,
wasting the work done to canonicalize the path names.

The grep on length is required since splitdir() can return empty
strings.

5 years agoRevert "charclasslists.h: script enums visible to CORE,EXT"
Karl Williamson [Tue, 6 Mar 2018 00:17:38 +0000 (17:17 -0700)]
Revert "charclasslists.h: script enums visible to CORE,EXT"

This reverts commit fea79782ed31ac4faa71eb6193faff54b4bbe249.

This bloats perl, and is not now necessary for 5.28.

5 years agoEBCDIC conditional compilation fixes
Karl Williamson [Mon, 5 Mar 2018 18:16:15 +0000 (11:16 -0700)]
EBCDIC conditional compilation fixes

The recent changes fixed by this commit neglected to take into account
EBCDIC differences.

Mostly, the algorithms apply only to ASCII platforms, so the EBCDIC is
ifdef'd out.  In a couple cases, the algorithm mostly applies, so the
scope of the ifdefs is smaller.

5 years agoregexec.c: White-space only
Karl Williamson [Mon, 5 Mar 2018 18:12:14 +0000 (11:12 -0700)]
regexec.c: White-space only

Properly indent preprocessor directives

5 years agoinline.h: White-space only
Karl Williamson [Mon, 5 Mar 2018 18:08:58 +0000 (11:08 -0700)]
inline.h: White-space only

Properly indent preprocessor directives

5 years agoperldiag: Rewrap an entry for better splain output
Father Chrysostomos [Mon, 5 Mar 2018 17:55:34 +0000 (09:55 -0800)]
perldiag: Rewrap an entry for better splain output

The splain utility (aka diagnostics.pm) blindly strips out pod formatting
without rewrapping the text (I think rewrapping would be overkill).  This
means that formatting like ‘L<Note [5] in
perlrecharclass|perlrecharclass/[5]>’ turns into a simple ‘Note [5] in
perlrecharclass’, which can mess up the indentation.

Rewrap the entry to compensate, plus a few other tweaks to improve
the appearance of the right margin.

5 years agoMore AUTHORS sorting
Father Chrysostomos [Mon, 5 Mar 2018 17:35:21 +0000 (09:35 -0800)]
More AUTHORS sorting

5 years agoAUTHORS: sorting; consistent indent
Father Chrysostomos [Mon, 5 Mar 2018 16:58:09 +0000 (08:58 -0800)]
AUTHORS: sorting; consistent indent

5 years agoIncrease ExtUtils::ParseXS(::*) version to 3.39
Father Chrysostomos [Mon, 5 Mar 2018 16:46:41 +0000 (08:46 -0800)]
Increase ExtUtils::ParseXS(::*) version to 3.39

5 years agoAdd Shoichi Kaji to AUTHORS
Father Chrysostomos [Mon, 5 Mar 2018 16:39:36 +0000 (08:39 -0800)]
Add Shoichi Kaji to AUTHORS

5 years agoRT #132935: correctly check VERSIONs in ExtUtils::ParseXS
Shoichi Kaji [Mon, 5 Mar 2018 14:25:49 +0000 (23:25 +0900)]
RT #132935: correctly check VERSIONs in ExtUtils::ParseXS

The following version check does not work correctly:

BEGIN { $VERSION = '3.38' }
use ExtUtils::ParseXS::Constants $VERSION;

The reason is that we must use version "literals",
not "variables" in `use Module VERSION`.
For the sake of ease of maintenance,
we use "require" and "->VERSION", instead of "use" here.

5 years agoperldiag typo
Father Chrysostomos [Mon, 5 Mar 2018 06:05:46 +0000 (22:05 -0800)]
perldiag typo

5 years agoRT #132834: prevent duplicate Config.pm vars
Aaron Crane [Mon, 5 Mar 2018 09:22:46 +0000 (09:22 +0000)]
RT #132834: prevent duplicate Config.pm vars

Commit 6c2ae6421675ba5ff81dd43f9167136f02dfe9d9 introduced variables whose
need was forced by configpm (for compatibility with older software), but
incorrectly added those variables to the generated Config_heavy.pl even when
they were already in use.

The resulting duplicate variables are clearly wrong, and in addition they
broke ExtUtils::InferConfig.

5 years agoloc_tools.pl: Properly exclude iffy locales
Karl Williamson [Sun, 4 Mar 2018 19:51:25 +0000 (12:51 -0700)]
loc_tools.pl: Properly exclude iffy locales

This code (fragiley) uses the wording of a warning message to determine
if a locale has issues or not.  Commit
578a6a873a320fe64743b060dbd467f1865d205c updated the message this is
looking for, but failed to update this file correspondingly.

5 years agoperlapi: utf8_to_uvuni_buf() Add clarification
Karl Williamson [Sun, 4 Mar 2018 17:57:16 +0000 (10:57 -0700)]
perlapi: utf8_to_uvuni_buf() Add clarification

5 years agot/run/locale.t: Add, revise tests
Karl Williamson [Sun, 4 Mar 2018 17:47:08 +0000 (10:47 -0700)]
t/run/locale.t: Add, revise tests

This enhances the test added in bee74f4b9818f0ca72926dd6b4dfdbc6b75c59ef
so that it is doing a valid setlocale, and adds a similar test for doing
an invalid one.

5 years agot/loc_tools.pl: Add fcn to return valid locale cats
Karl Williamson [Sun, 4 Mar 2018 17:45:05 +0000 (10:45 -0700)]
t/loc_tools.pl: Add fcn to return valid locale cats

This new function will return the locale categories known to this
platform.

5 years agot/run/locale.t: Update skip count
Karl Williamson [Sun, 4 Mar 2018 17:43:03 +0000 (10:43 -0700)]
t/run/locale.t: Update skip count

This should have been updated by
bee74f4b9818f0ca72926dd6b4dfdbc6b75c59ef.

5 years agolocale.c: Fix bug in parsing a locale
Karl Williamson [Sun, 4 Mar 2018 02:21:03 +0000 (19:21 -0700)]
locale.c: Fix bug in parsing a locale

This was not handling the case where there is a semi-colon separated
list of individual locales, except the last one had no trailing
semi-colon.

Thanks to Sergey Aleynikov for finding this

5 years agolocale.c: Check return code
Karl Williamson [Sun, 4 Mar 2018 02:17:43 +0000 (19:17 -0700)]
locale.c: Check return code

In cases like these, we should give up if the called function fails.

5 years agolocale.c: Replace an 'if' by an assert
Karl Williamson [Sun, 4 Mar 2018 02:15:07 +0000 (19:15 -0700)]
locale.c: Replace an 'if' by an assert

This should be true if we get to here.

5 years agolocale.c: Increase debug buffer size
Karl Williamson [Sun, 4 Mar 2018 01:56:25 +0000 (18:56 -0700)]
locale.c: Increase debug buffer size

A case was found where this was too small

5 years agolocale.c: Rmv spurious Safefree
Karl Williamson [Sun, 4 Mar 2018 01:54:26 +0000 (18:54 -0700)]
locale.c: Rmv spurious Safefree

I misread the documentation, and Perl_form doesn't need its return value
freed; it's already declared to be temporary, so if this code actually
got executed, there'd be a wrong pool panic

5 years agolocale.c: Remove redundant SAVE_ERRNO
Karl Williamson [Sun, 4 Mar 2018 01:52:07 +0000 (18:52 -0700)]
locale.c: Remove redundant SAVE_ERRNO

The errnos were already saved just above

5 years agoperlguts: Clarify an example.
Karl Williamson [Sun, 4 Mar 2018 00:27:48 +0000 (17:27 -0700)]
perlguts: Clarify an example.

5 years agoReword warning for deviations from UTF-8 locales
Karl Williamson [Fri, 2 Mar 2018 19:13:55 +0000 (12:13 -0700)]
Reword warning for deviations from UTF-8 locales

Some locales are UTF-8, but not exactly what Perl is expecting.  Revise
the message raised in this circumstance.

Originally I thought these were violations of Unicode, but based on
feedback from Craig Berry, I came to realize that these are legitimate
interpretations of the Unicode standard.  But perl persists with its own
interpretation that differs from these, hence the warning.

5 years agoBump version of POSIX.pm to 1.83; warnings to 1.42
Karl Williamson [Fri, 2 Mar 2018 19:30:09 +0000 (12:30 -0700)]
Bump version of POSIX.pm to 1.83; warnings to 1.42

These were made using the old version number, and the error was not
caught, because of the lateness in getting 5.27.9 tagged

5 years agoperldelta typo
Father Chrysostomos [Fri, 2 Mar 2018 18:52:45 +0000 (10:52 -0800)]
perldelta typo

5 years agoperldelta for Carp changes since 5.27.9
Father Chrysostomos [Fri, 2 Mar 2018 18:50:55 +0000 (10:50 -0800)]
perldelta for Carp changes since 5.27.9

Most of the commits that modified Carp.pm were either minor fix-ups
for previous commits or fixes for bugs introduced by previous commits.
Hence, there are validly only three entries, even though it seems
a small number for such a flurry of activity.

All significant Carp changes prior to this commit are accounted for.

5 years agoRemove 5.27.9 entries from 5.27.10’s delta
Father Chrysostomos [Fri, 2 Mar 2018 18:30:51 +0000 (10:30 -0800)]
Remove 5.27.9 entries from 5.27.10’s delta

5 years agoregen
Sawyer X [Fri, 2 Mar 2018 18:11:13 +0000 (20:11 +0200)]
regen

5 years agoBump Module::CoreList
Sawyer X [Fri, 2 Mar 2018 18:11:08 +0000 (20:11 +0200)]
Bump Module::CoreList

5 years agoBump version
reneeb [Tue, 20 Feb 2018 21:41:22 +0000 (22:41 +0100)]
Bump version

5 years agoNew Perldelta
reneeb [Tue, 20 Feb 2018 21:31:17 +0000 (22:31 +0100)]
New Perldelta

5 years agoTick release in release schedule
reneeb [Tue, 20 Feb 2018 21:24:23 +0000 (22:24 +0100)]
Tick release in release schedule

5 years agoUpdate epigraph.pod
reneeb [Tue, 20 Feb 2018 21:23:18 +0000 (22:23 +0100)]
Update epigraph.pod

5 years agomg.c: Fix isSCRIPT_RUN call
Karl Williamson [Fri, 2 Mar 2018 15:04:00 +0000 (08:04 -0700)]
mg.c: Fix isSCRIPT_RUN call

Commit 49cd072660b3b1858be5f27df107b3b42498a3f3 failed to fix up this
call to isSCRIPT_RUN, which is typically only compiled on Windows.

5 years ago[MERGE] fixups for attributes-before-signatures
David Mitchell [Fri, 2 Mar 2018 13:37:45 +0000 (13:37 +0000)]
[MERGE] fixups for attributes-before-signatures

RT #132760

v5.27.7-212-g894f226 recently moved subroutine attributes from after
the signature to before the signature.

This small branch performs some minor tweaks to that; principally:

* splits the parser rules for subs into separate rules for subs
within and without the scope of 'use feature "signatures";

* makes the parser and toker recognise the possibility of attributes
following the signature, so that a targeted error message can be given,
rather than a general 'syntax error' and follow-on dross.

5 years agodetect sub attributes following a signature
David Mitchell [Mon, 26 Feb 2018 18:52:23 +0000 (18:52 +0000)]
detect sub attributes following a signature

RT #132760

A recent commit (v5.27.7-212-g894f226) moved subroutine attributes back
before the subroutine's signature: e.g.

    sub foo :prototype($$) ($a, $b) { ... }  # 5.18 and 5.28 +
    sub foo ($a, $b) :prototype($$) { ... }  # 5.20 .. 5.26

This change means that any code still using an attribute following the
signature is going to trigger a syntax error. However, the error, followed
by error recovery and further warnings and errors, is very unfriendly and
gives no indication of the root cause. This commit introduces a new error,
"Subroutine attributes must come before the signature".

For example, List::Lazy, the subject of the ticket, failed to compile
tests, with output like:

    Array found where operator expected at blib/lib/List/Lazy.pm line 43,
    near "$$@)" (Missing operator before @)?)
    "my" variable $step masks earlier declaration in same statement at
    blib/lib/List/Lazy.pm line 44.
    syntax error at blib/lib/List/Lazy.pm line 36, near ") :"
    Global symbol "$generator" requires explicit package name (did you
    forget to declare "my $generator"?) at blib/lib/List/Lazy.pm line 38.
    Global symbol "$state" requires explicit package name (did you forget
    to declare "my $state"?) at blib/lib/List/Lazy.pm line 39.
    Global symbol "$min" requires explicit package name (did you forget to
    declare "my $min"?) at blib/lib/List/Lazy.pm line 43.
    Global symbol "$max" requires explicit package name (did you forget to
    declare "my $max"?) at blib/lib/List/Lazy.pm line 43.
    Global symbol "$step" requires explicit package name (did you forget
    to declare "my $step"?) at blib/lib/List/Lazy.pm line 43.
    Invalid separator character '{' in attribute list at
    blib/lib/List/Lazy.pm line 44, near "$step : sub "
    Global symbol "$step" requires explicit package name (did you forget
    to declare "my $step"?) at blib/lib/List/Lazy.pm line 44.

But following this commit, it now just outputs:

    Subroutine attributes must come before the signature at
    blib/lib/List/Lazy.pm line 36.
    Compilation failed in require at t/append.t line 5.
    BEGIN failed--compilation aborted at t/append.t line 5.

It works by:

1) adding a boolean flag (sig_seen) to the parser state to indicate that a
   signature has been parsed;
2) at the end of parsing a signature, PL_expect is set to XATTRBLOCK
   rather than XBLOCK.

Then if something looking like one or more attributes is encountered
by the lexer immediately afterwards, it scans it as if it were an
attribute, but then if sig_seen is true, it croaks.

5 years agosubtly change meaning of XATTRBLOCK, XATTRTERM
David Mitchell [Mon, 26 Feb 2018 13:50:50 +0000 (13:50 +0000)]
subtly change meaning of XATTRBLOCK, XATTRTERM

Currently they tell the toker that the next thing will be attributes,
followed by an XBLOCK or XTERMBLOCK respectively.

This commit subtly changes their meanings so that they indicate that
attributes legally *might* follow. This makes the code which initially
sets them slightly simpler (no need to check whether the next char is
':'), and the code elsewhere in yylex() which handles XATTR* only triggers
if the next char is ':' anyway.

Doing it this way will shortly make detection simpler of an attribute
illegally following a signature.

5 years agorationalise subroutine parsing rules
David Mitchell [Thu, 22 Feb 2018 14:44:51 +0000 (14:44 +0000)]
rationalise subroutine parsing rules

Now that the parser rules have been split into separate rules for subs
under 'use feature "signatures"' and not, refine the rules to reflect the
different regimes. In particular:

1) no longer include 'proto' in the signature variants: as it happens the
toker would never return a proto THING under signatures anyway, but
removing it from the grammar makes it clearer what's expected and not
expected.

2) Remove 'subsignature' from non-sig rules: what used to happen before
was that outside of 'use feature "signatures"', it might still try to
parse a signature, e.g.

    $ perl5279 -we 'sub f :lvalue ($$@) { $x = 1 }'
    Illegal character following sigil in a subroutine signature at -e line
    1, near "($"
    syntax error at -e line 1, near "$$@"

Now it's just a plain syntax error.

5 years agoparse subs and signature subs separately
David Mitchell [Thu, 22 Feb 2018 12:23:52 +0000 (12:23 +0000)]
parse subs and signature subs separately

Currently the toker returns a SUB or ANONSUB token at the beginning
of a sub (or BEGIN etc). Change it so that in the scope of
'use feature "signatures"', it returns a SIGSUB / ANON_SIGSUB token
instead.

Then in perly.y, duplicate the 2 rules containing SUB / ANONSUB
to cope with these two new tokens.

The net effect of this is to use different rules in the parser for
parsing subs when signatures are in scope.

Since the two sets of rules have just been cut and pasted, there should
be no functional changes yet, but that will change shortly.

5 years agoadd Perl_init_named_cv() functiom
David Mitchell [Thu, 22 Feb 2018 12:11:26 +0000 (12:11 +0000)]
add Perl_init_named_cv() functiom

This moves a block of code out from perly.y into its own function,
because it will shortly be needed in more than one place.

Should be no functional changes.

5 years agoMerge remote-tracking branch 'renee/release-5.27.9' into blead
Sawyer X [Fri, 2 Mar 2018 12:55:14 +0000 (14:55 +0200)]
Merge remote-tracking branch 'renee/release-5.27.9' into blead

5 years agoperl.h: Add comment about clang warnings
Karl Williamson [Fri, 2 Mar 2018 02:30:42 +0000 (19:30 -0700)]
perl.h: Add comment about clang warnings

Commit b2f82b52000c3bfe6e6df200c775e2a639d91552 failed to document
details about the clang warnings.  This commit adds a link to clang's
documentation

5 years agoRemove parameter from isSCRIPT_RUN
Karl Williamson [Fri, 2 Mar 2018 02:11:43 +0000 (19:11 -0700)]
Remove parameter from isSCRIPT_RUN

Daniel Dragan pointed out that this parameter is unused (the commits
that want it didn't get into 5.28), and is causing a table to be
duplicated all over the place, so just remove it for now.

5 years agoSilence wrong clang warnings
Karl Williamson [Mon, 26 Feb 2018 04:38:21 +0000 (21:38 -0700)]
Silence wrong clang warnings

Clang thread-safety analysis fails to correctly work in this situation
(and is documented as failing), so turn off that warning here.

5 years agonumeric.c: Refactor code to use only one RESTORE
Karl Williamson [Fri, 2 Mar 2018 01:09:42 +0000 (18:09 -0700)]
numeric.c: Refactor code to use only one RESTORE

This code saves and restores the LC_NUMERIC locale.  This commit
refactors it so that only one RESTORE is done.  The reason is because
having two, depending on various data confuses clang's static analysis
of thread safety, leading to false positive scary warnings.

5 years agoregen/regcomp.pl: close FH before unlink
Daniel Dragan [Thu, 1 Mar 2018 00:42:19 +0000 (19:42 -0500)]
regen/regcomp.pl: close FH before unlink

On Win32, regen.pl failed if something caused different checksum for
perldebguts.pod and the old file was attempted to be unlinked/renamed, but
that was failing because the FH is still open (Win32 specific thing).
So close the FH before renaming the file instead of having scope exit close
the FH after close_and_rename() executes.

the fixed error console log:

changed 'pod/perldebguts.pod-new' to 'pod/perldebguts.pod'
Couldn't unlink pod/perldebguts.pod: Permission denied
renaming pod/perldebguts.pod-new to pod/perldebguts.pod: Permission denied at ./
regen/regen_lib.pl line 120, <$oldguts> line 1046.
Changed: pod/perldebguts.pod
C:\perl\bin\perl.exe -I. regen/regcomp.pl -v failed: 3328 at regen.pl line 20, <
DATA> line 8.

5 years agoremove unused var in sv_eq_flags
Daniel Dragan [Sun, 18 Feb 2018 07:57:39 +0000 (02:57 -0500)]
remove unused var in sv_eq_flags

svrecode became unused in commit 8df0e7a28b
"Remove IN_ENCODING macro, and all code dependent on it" but there was
still a SvREFCNT_dec(NULL) executed at the end of the function. This
commit will reduce size of Perl_sv_eq_flags by the CC not having to
save var eq to a non-volatile register or stack location around the
SvREFCNT_dec func call and instead store var eq in the return register
directly. Also remove the eq var completly, since initializing the var
so early means it has to be stored on the stack around alot func calls,
so just do a direct return of const zero on the only "fall off the end"
path in the func.

5 years ago(perl #132893) don't probe for Storable recursion limits on old Win32
Tony Cook [Wed, 28 Feb 2018 05:43:07 +0000 (16:43 +1100)]
(perl #132893) don't probe for Storable recursion limits on old Win32

5 years agoWe hope to release 5.26.2 and 5.24.4 together in March
Steve Hay [Wed, 28 Feb 2018 21:25:04 +0000 (21:25 +0000)]
We hope to release 5.26.2 and 5.24.4 together in March

5 years agorework Carp/t/stack_after_err.t to not use perl -e
Yves Orton [Wed, 28 Feb 2018 15:02:17 +0000 (16:02 +0100)]
rework Carp/t/stack_after_err.t to not use perl -e

5 years agoCarp: Speed up longmess some more
Father Chrysostomos [Tue, 27 Feb 2018 19:24:09 +0000 (11:24 -0800)]
Carp: Speed up longmess some more

Commit 915a6810d added a UNIVERSAL::isa check to format_arg (used by
longmess, which generates stack traces) to see whether an argument is
blessed before trying CARP_TRACE, to speed things up when the argu-
ment is not blessed.

Because this would cause infinite recursion when the UNIVERSAL::isa
module is loaded, a check was put in place to avoid this problem.  But
the check was a run-time check, and so the speed-up was minimal.

If we move the check to compile time (and save the original
&UNIVERSAL::isa in case the module gets loaded later), then the speed-
up is signifant.  That is what this patch does.

Before this patch, the following one-liner runs on my machine in 6
seconds on average:

$ ./perl -MCarp -Ilib -e 'sub f { my $c = shift; if ($c == 100) { Carp::longmess() } else { f($c+1,{}) } } f(0,{}) for 1..500'

If I disable the isa check (just to see how much it was speeding
things up), it averages 6.5 seconds, not much of a difference.

If I move the $UNIVERSAL::isa::VERSION safety check to compile time
instead of run time, I can reduce the time to 4.9 seconds.

5 years agot/re/regexp.t: Silence HP-UX warnings
Karl Williamson [Tue, 27 Feb 2018 20:08:07 +0000 (13:08 -0700)]
t/re/regexp.t: Silence HP-UX warnings

The tests that use t/re/re_tests may use a locale.  It doesn't much
matter which locale, except we want one that isn't going to generate
warnings.

5 years agoperlapi: Fix typo
Karl Williamson [Tue, 27 Feb 2018 18:27:46 +0000 (11:27 -0700)]
perlapi: Fix typo

5 years agoremove unreferenced copies of char * swash_property_names[]
Daniel Dragan [Mon, 26 Feb 2018 02:31:26 +0000 (21:31 -0500)]
remove unreferenced copies of char * swash_property_names[]

Due to some MSVC bug or perl's not using MS specific CC options that I've
never figured out, MSVC does not remove unreferenced by a single .obj or
combine identical, static const data vars. MSVC funcs get removed &
combined correctly. Since for var swash_property_names removing it from
.objs that dont need it is very easy, do it. It saves some memory space.
Perhaps some other platforms/OSes/CCs have similar problems removing
unreferenced symbols from final binaries so this patch would help on those
CCs too.

regexec.c stopped using swash_property_names in commit 2a16ac9277 in 5.19.8
"regexec.c: Use compiled-in POSIX definitions"

regcomp.c stopped using swash_property_names in commit bcb875216f in 5.19.8
"regcomp.c: Rmv code for delayed 'til runtime POSIX defns"

with MSVC 2008 64, before

miniperl.exe disk file size 1761KB .rdata virtual size 0xBC354 bytes
perl527.dll disk file size 2040KB .rdata virtual size 0xC9421 bytes

after this commit

miniperl.exe disk file size 1761KB .rdata virtual size 0xBC2C4 bytes
perl527.dll disk file size 2040KB .rdata virtual size 0xC9381 bytes

~144 bytes saved by removing unused copies of swash_property_names array.

There are other cases of large duplicate static const data vars still in
the perl527.dll binary but this patch covers a very simple case.

5 years agowarnings.pm: _at_level functions and chunky handles
Father Chrysostomos [Mon, 26 Feb 2018 17:23:28 +0000 (09:23 -0800)]
warnings.pm: _at_level functions and chunky handles

The _at_level functions, which have to bypass Carp, were not
reporting non-line-based filehandles correctly.  The perl core
does:

    ..., <fh> chunk 7.

if $/ is not "\n".  warnings.pm should do the same.  It was using
‘line’.

5 years agoCarp: Avoid run-time mods; StrVal workarounds
Father Chrysostomos [Mon, 26 Feb 2018 09:23:53 +0000 (01:23 -0800)]
Carp: Avoid run-time mods; StrVal workarounds

Carp needs to avoid loading modules while reporting errors, because
it may be invoked via $SIG{__DIE__} after a syntax error, when BEGIN
blocks are forbidden.

Before this commit (as of v5.27.8-360-gc99363a) it was doing just that
for reference arguments within stack traces.

That means we either need to load overload.pm at start-up so that
overload::StrVal is already available, or avoid overload::StrVal
altogether.

It turns out that various versions of overload::StrVal have
their own problems that prevent Carp from using them (out-
lined in the comments added to Carp.pm and also described at
<https://rt.perl.org/Ticket/Display.html?id=132902#txn-1535564>).

So we now follow two approaches:  If overloading.pm is available, use
that; otherwise, use a hideous workaround inspired by ancient imple-
entations of overload::StrVal and Scalar::Util::blessed, while avoid-
ing the bugs in those old versions.

5 years agoop.h: remove spurious # define indent
David Mitchell [Tue, 27 Feb 2018 15:32:25 +0000 (15:32 +0000)]
op.h: remove spurious #  define indent

whitespace-only change

5 years agoext/File-Glob/t/rt131211.t: fix timing issues
David Mitchell [Tue, 27 Feb 2018 14:58:18 +0000 (14:58 +0000)]
ext/File-Glob/t/rt131211.t: fix timing issues

This test file occasionally fails test numbers 1 and/or 2 on smokes.
These two tests measure how long it takes to do a matching and
non-matching glob() with a lot of "a*a*a*...." and fail if the
match and non-matching times differ too much (the original bug was that
non-match went exponential on number of "a*"'s).

However, on good systems, the timings returned are typically
sub-millisecond, so I'm guessing the occasional failures are due to

(small measured noise) * 100  > (another small measured noise).

So this commit avoids tests 1&2 failing unless the values measured
are large enough not to be merely noise.

This is just speculation on my part though - I couldn't reproduce a
failure myself.

5 years ago(perl #127743) don't probe Storable limits so much (Win32 makefiles)
Tony Cook [Mon, 26 Feb 2018 23:50:35 +0000 (10:50 +1100)]
(perl #127743) don't probe Storable limits so much (Win32 makefiles)

Win32 port of the changes in 8175eebc32

5 years agoAPItest/t/locale.t: Add detail to test names
Karl Williamson [Mon, 26 Feb 2018 04:40:35 +0000 (21:40 -0700)]
APItest/t/locale.t: Add detail to test names

This detail can help in interpreting the results.

5 years agoFix Perl_langinfo currency symbol for non-nl_langinfo systems
Karl Williamson [Mon, 26 Feb 2018 04:28:42 +0000 (21:28 -0700)]
Fix Perl_langinfo currency symbol for non-nl_langinfo systems

Commit 628ff75a4a7ac013dad43df7a53fcb55bf758ed7 broke this.

5 years agosuppress error messages from the shell when probing Storable limits
Tony Cook [Mon, 19 Feb 2018 23:10:34 +0000 (10:10 +1100)]
suppress error messages from the shell when probing Storable limits

5 years agomake the Storable stacksize messages less scary
Tony Cook [Mon, 19 Feb 2018 23:09:44 +0000 (10:09 +1100)]
make the Storable stacksize messages less scary

5 years ago(perl #127743) don't probe Storable limits so much
Tony Cook [Mon, 26 Feb 2018 04:04:20 +0000 (15:04 +1100)]
(perl #127743) don't probe Storable limits so much

Previously any rebuild on the perl executable or the shared library
would re-run the Storable recursion limit probing.  Only do so
if the Storable binary or Storable.pm is rebuilt.

This needs to be ported to the Win32 makefiles too.

5 years ago[perl #132910] Carp: Avoid ->can
Father Chrysostomos [Mon, 26 Feb 2018 02:19:54 +0000 (18:19 -0800)]
[perl #132910] Carp: Avoid ->can

If a module has its own ‘can’ (or even UNIVERSAL::can) implementation,
it may impede Carp’s use of ->can to detect overloading.  Instead,
use UNIVERSAL::can directly, or, in the presence of an override,
use overload::mycan.  Don’t use overload::Overloaded, since old
versions of overload call ->can.

5 years agomove init_i18nl10n(1) to after the ENTER in perl_construct
Yves Orton [Mon, 26 Feb 2018 00:42:22 +0000 (01:42 +0100)]
move init_i18nl10n(1) to after the ENTER in perl_construct

init_i18nl10n(1) uses SAVEFREEPV, before any ENTER is performed. Move it afterwards

5 years agoRevert "Storable: when building in core do not run stacksize every time"
Yves Orton [Mon, 26 Feb 2018 00:40:19 +0000 (01:40 +0100)]
Revert "Storable: when building in core do not run stacksize every time"

This reverts commit 345db0f66ed0ac7b609bb6bcceaf3a48b5f8e25b.

5 years agoUpgrade ExtUtils::MakeMaker to 7.33_03
Father Chrysostomos [Sun, 25 Feb 2018 21:31:34 +0000 (13:31 -0800)]
Upgrade ExtUtils::MakeMaker to 7.33_03

5 years agosync-with-cpan: Allow relative dir for tarball
Father Chrysostomos [Sun, 25 Feb 2018 21:29:36 +0000 (13:29 -0800)]
sync-with-cpan: Allow relative dir for tarball

5 years agoFix Perl_langinfo() for non-nl_langinfo() systems
Karl Williamson [Sun, 25 Feb 2018 19:51:59 +0000 (12:51 -0700)]
Fix Perl_langinfo() for non-nl_langinfo() systems

Commit 628ff75a4a7ac013dad43df7a53fcb55bf758ed7 caused the return value
to not be set for some paths through the function on platforms, like
Windows, that don't have nl_langinfo()

5 years agolocale.c: Silence compiler warning
Karl Williamson [Sun, 25 Feb 2018 18:56:44 +0000 (11:56 -0700)]
locale.c: Silence compiler warning

The Windows compiler no longer raises a warning if we change this UV to
a plain unsigned.

5 years agolocale.c: Save needed value before destroying it
Karl Williamson [Sat, 24 Feb 2018 23:32:44 +0000 (16:32 -0700)]
locale.c: Save needed value before destroying it

This moves up the copying of a needed value to before the place where it
could get destroyed.  This only happened on some configurations under
some circumstances, which is why it got missed.

5 years agolocale.c: Let static fcn take a NULL argument
Karl Williamson [Sat, 24 Feb 2018 23:22:22 +0000 (16:22 -0700)]
locale.c: Let static fcn take a NULL argument

It turns out that it will be convenient in a future commit to have this
function handle NULL input.  That also means that every call should use
the return value of this function.

5 years agoStorable: when building in core do not run stacksize every time
Yves Orton [Sun, 25 Feb 2018 14:03:57 +0000 (15:03 +0100)]
Storable: when building in core do not run stacksize every time

5 years agoif an SV IsCOW_shared_hash then we can assume it has a null at the end
Yves Orton [Sun, 25 Feb 2018 13:29:03 +0000 (14:29 +0100)]
if an SV IsCOW_shared_hash then we can assume it has a null at the end

5 years agoCorrect (re)wording on defective HP-UX locales
H.Merijn Brand [Sun, 25 Feb 2018 15:57:33 +0000 (16:57 +0100)]
Correct (re)wording on defective HP-UX locales

5 years agoadd a svleak.t test for RT #132892
Yves Orton [Sun, 25 Feb 2018 09:46:48 +0000 (10:46 +0100)]
add a svleak.t test for RT #132892

This tests the change applied in
910a6a8be166fb3780dcd2520e3526e537383ef2

I tested that when that commit is reverted this test fails,
and when it is in place it does not.

5 years agoAllow goto into glob’s arg
Father Chrysostomos [Sun, 25 Feb 2018 01:47:25 +0000 (17:47 -0800)]
Allow goto into glob’s arg

$ ./perl -Ilib  -Xe 'goto foo; glob do { foo:  $1}'
Can't "goto" into a binary or list expression at -e line 1.

What binary or list expression?  True, glob has the *precedence* of a list operator, but so does not:

$ ./perl -Ilib  -Xe 'goto foo; not do { foo:  $1}; prt "ok\n"'
ok

Glob seems to be the only exception, due to its ‘special’ op tree.

5 years agoperlfunc:goto: Correct and clarify
Father Chrysostomos [Sun, 25 Feb 2018 01:43:26 +0000 (17:43 -0800)]
perlfunc:goto: Correct and clarify

5 years agolocale.c: Properly return LC_ALL locale names
Karl Williamson [Fri, 23 Feb 2018 18:13:09 +0000 (11:13 -0700)]
locale.c: Properly return LC_ALL locale names

On systems using POSIX 2008 functions that don't have querylocale(),
perl has to keep track of the locale names currently in effect.  There
was code to invalidate LC_ALL as a single name if one or more of its
components aren't all the same.  But omitted was code to re-validate it
when they later do become the same.  This commit adds that omitted code.

5 years agolocale.c: Fix dangling set of LC_NUMERIC to C
Karl Williamson [Fri, 23 Feb 2018 18:06:45 +0000 (11:06 -0700)]
locale.c: Fix dangling set of LC_NUMERIC to C

In the past, we've kept LC_NUMERIC in the C locale, because so much code
relies on the radix character being a dot.  5.27.9 added an enhancement
that checks if the current locale already has it be a dot.  If so, it's
fine to keep the locale in that one.

The spot fixed by this commit didn't get updated to account for this
change.

(I realize that the docs also need to be updated; that will be in a
future commit)

5 years agot/loc_tools.pl: 8859-16 is legit; 8859-0 isn't
Karl Williamson [Fri, 23 Feb 2018 18:02:40 +0000 (11:02 -0700)]
t/loc_tools.pl: 8859-16 is legit; 8859-0 isn't

This adjusts the loop boundaries looking for come common locale names.
It was failing to look for 8859-16; instead looking for latin0, 8859-0,
which don't exist

5 years agoperlapi: Clarify Perl_langinfo()
Karl Williamson [Fri, 23 Feb 2018 17:59:33 +0000 (10:59 -0700)]
perlapi: Clarify Perl_langinfo()

5 years agot/loc_tools.pl: Consider recently added warning
Karl Williamson [Fri, 23 Feb 2018 17:46:53 +0000 (10:46 -0700)]
t/loc_tools.pl: Consider recently added warning

This file has functions that look for and return the valid locales on
the current system.  A new incompatibility was discovered and a warning
generated for in 8b7358b96caf71db3213a7d72fc401e42ee0b2d.

This file should have been updated at that time to look for that message
to mean it the locale is not compatible.  This commit updates it.

5 years agoPerl_langinfo(): Need to save return under more circumstances
Karl Williamson [Fri, 23 Feb 2018 00:43:16 +0000 (17:43 -0700)]
Perl_langinfo(): Need to save return under more circumstances

I forgot that the internal static buffers returned from nl_langinfo()
and localconv() can be destroyed if the locale changes, and not just
from a subsequent call to the function.  Therefore save the results
always.

5 years agoCarp: add test for overloads without overload.pm
Yves Orton [Sun, 25 Feb 2018 03:15:23 +0000 (04:15 +0100)]
Carp: add test for overloads without overload.pm

5 years agoCarp: overloads can be enabled with via ::() as well as ::((
Yves Orton [Sun, 25 Feb 2018 03:07:15 +0000 (04:07 +0100)]
Carp: overloads can be enabled with via ::() as well as ::((

5 years agoexplain compile time effects of require
Yves Orton [Sun, 25 Feb 2018 03:04:02 +0000 (04:04 +0100)]
explain compile time effects of require

there is a difference between

   require Foo::Bar;

and

   require "Foo/Bar.pm";

in that the former will autovivify the Foo::Bar namespace at compile
time, but the latter will not. Populating the namespace is left to run
time in both cases.

This doc adds some details about this to the require entry in perlfunc

5 years agoSpelling correction.
James E Keenan [Sat, 24 Feb 2018 19:01:23 +0000 (14:01 -0500)]
Spelling correction.

Addresses https://github.com/mhx/Devel-PPPort/pull/50/files.

5 years agoPathTools/Changes: Retroactively mention CPAN RT #114236
Father Chrysostomos [Sat, 24 Feb 2018 18:14:45 +0000 (10:14 -0800)]
PathTools/Changes: Retroactively mention CPAN RT #114236

So that new releases will have a more complete and helpful
change log.

5 years agosilence warnings when using zaphod32 on 64 bit builds
Yves Orton [Sat, 24 Feb 2018 16:42:00 +0000 (17:42 +0100)]
silence warnings when using zaphod32 on 64 bit builds

if STRLEN is 64 bit, then there is truncation when using key_len to initialize the state.
This causes problems with windows compilers especially. See comments from bulk88 in
perl #132860 (which is not directly related to this patch, but is where it was discussed)

5 years agoCarp: add comment explaining the fix for perl #131046
Yves Orton [Sat, 24 Feb 2018 11:48:46 +0000 (12:48 +0100)]
Carp: add comment explaining the fix for perl #131046

In 4764858cb80e76fdba33cc1b3be8fcdef26df754 I added code that
eval's the argument extraction from DB::args() (code written by
both Pali and myself independently).

Unfortunately the commit message for that commit was somewhat
misleading, making it sound like the patch was a complete fix for
the underlying problem of stack-not-refcounted bugs, when in fact
it is actually a workaround, and a not-universally popular one
either due to its incompleteness. For more details of why it is
not popular see Zeframs commentary in
https://rt.perl.org/Public/Bug/Display.html?id=131046

Despite the concerns expressed by Zefram when considered from the
POV of a large enterprise using Carp to trap exceptions from
application code, having Carp throw its own exceptions about
stack-not-refcounted bugs and thus hiding the applications error
data is a significant issue.

So in 4764858cb80e76fdba33cc1b3be8fcdef26df754 we use eval to
handle those cases where Perl /can/ detect a stack-not-refcounted
error, and thus preserve as much of the applications error data
as possible.

This commit adds a comment to Carp which spells all of this out.

5 years agoFix perl #132902 - Carp: avoid infinite loops when checking for overloads
Yves Orton [Sat, 24 Feb 2018 11:37:29 +0000 (12:37 +0100)]
Fix perl #132902 - Carp: avoid infinite loops when checking for overloads

We use $obj->can("((") to see if a package has enabled overloads,
however in some cases can() is overridden with a custom implementation,
which may be unaware of these methods and then call Carp itself. This
then results in an infinite loop. An example is Class::Std v0.013.
While technically this is a bug in whatever overrides UNIVERSAL::can(),
Carp is so prolific in its use that we might as well treat it as a Carp
bug also and avoid the problem outright.

See also: https://github.com/chorny/Class-Std/pull/2

5 years agoRevert "Revert "Carp: Avoid string eval""
Yves Orton [Sat, 24 Feb 2018 04:42:51 +0000 (05:42 +0100)]
Revert "Revert "Carp: Avoid string eval""

This reverts commit f61fbe7bb36915d6a598df82ede2511d261e41d3.

After further research it appears that this does NOT break .pmc's

The docs on .pmc's leave much to be desired.

5 years agoRevert "Carp: Avoid string eval"
Yves Orton [Sat, 24 Feb 2018 03:59:50 +0000 (04:59 +0100)]
Revert "Carp: Avoid string eval"

This reverts commit 7bb6e12450c58b7094ccdfa7025fa495d3996bcf.

This patch breaks the behavior of .pmc's. :-(

Until we decide if breaking this rarely used feature is ok I am reverting.

5 years agoCarp: Avoid string eval
Father Chrysostomos [Sat, 24 Feb 2018 03:32:51 +0000 (19:32 -0800)]
Carp: Avoid string eval

Carp’s particular use of string eval is unnecessary in this case, and
slower than the alternative.  Carp’s reason for using string eval is
to avoid the effect of bareword require vivifying a package.  But that
only applies to bareword require, and not other forms of require:

$ perl -le 'print $::{"overload::"}||"nothing"; require overload'
*main::overload::
$ perl -le 'print $::{"overload::"}||"nothing"; require "overload.pm"'
nothing

Since string eval has to set up a parser and a new scope, it is much
slower that require, and quite unnecessary here.