This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
8 years agoTime-HiRes: no mutex for you due to mistyped USE
Jarkko Hietaniemi [Sun, 13 Mar 2016 00:15:24 +0000 (19:15 -0500)]
Time-HiRes: no mutex for you due to mistyped USE

8 years agoTime-HiRes: remove unused hrt_ualarm
Jarkko Hietaniemi [Sun, 13 Mar 2016 00:07:54 +0000 (19:07 -0500)]
Time-HiRes: remove unused hrt_ualarm

Binary compat with 1.91 would mean roughly 2006-10, which means
either Perl 5.8.8 or 5.9.5.  Time to let go.  No hits in CPAN,
as observed by Tony Cook: http://grep.cpan.me/?q=hrt_ualarm

8 years agoop.c: cosmetic comment changes
Lukas Mai [Sat, 12 Mar 2016 22:54:31 +0000 (23:54 +0100)]
op.c: cosmetic comment changes

8 years agot/re/uniprops.t: Remove wrong test cases
Karl Williamson [Sat, 12 Mar 2016 22:00:45 +0000 (15:00 -0700)]
t/re/uniprops.t: Remove wrong test cases

mktables generates the file used in this test.  Unicode version 9
introduces a numeric value that is an order of magnitude closer to 0
than any previous version had.  This demonstrated a bug in mktables,
where it didn't consider the possibility of floating point numbers being
indistinguishably close to integers.  It did check for being too close
to the rational numbers used in Unicode, but omitted checking for
integers.  This adds that check, which in turn causes some wrong test
cases to not be generated for this .t.

This bug has not shown up in earlier Unicode versions, but is there
nonetheless, so I'm pushing this now instead of waiting.

8 years agoAPItest.xs silence compiler warning
David Mitchell [Sat, 12 Mar 2016 11:09:06 +0000 (11:09 +0000)]
APItest.xs silence compiler warning

On Solaris:
    "APItest.xs", line 1519: warning: integer overflow detected: op "<<"

8 years agoregex sets: fix Solaris optimiser bug
David Mitchell [Sat, 12 Mar 2016 09:39:41 +0000 (09:39 +0000)]
regex sets: fix Solaris optimiser bug

[perl #127455]

On Solaris with -DDEBUGGING, re/regex_sets.t was failing to compile.

This appears to be due to an optimiser bug.

The code in question looked like:

  handle_operand:
    top_index = av_tindex_nomg(stack);
    if (top_index - fence >= 0) {
        ...
    }

printf()ing the value of fence after the av_tindex_nomg() showed that its
value was corrupted (compared with its expected value based on a different
platform with the same debugging print). However, putting a another printf
prior to the av_tindex_nomg() call not only displayed the correct value,
but caused the later printf() to also display the correct value. It seems
that merely accessing fence prior to av_tindex_nomg() avoids the
corruption.

Simplifying the av_tindex_nomg(), the bad behaviour could be reduced to:

    if (!stack) { __assert( "" , "", 1); }

Putting a printf after this gave a corrupted fence; a printf before
made everything work.

So this workaround commit just makes sure that fence is accessed prior to
calling av_tindex_nomg().

8 years agoamigaos4: better popen() + pclose() implementation
Andy Broad [Sat, 12 Mar 2016 01:20:31 +0000 (20:20 -0500)]
amigaos4: better popen() + pclose() implementation

popen(): handle better the case where the popened external
might exit before the child process manages to start.

pclose(): protect with a semaphore.

8 years agoFix various pod errors.
Karl Williamson [Fri, 11 Mar 2016 21:43:33 +0000 (14:43 -0700)]
Fix various pod errors.

Mostly these are too long verbatim lines.

8 years agoinline.h: Fix comment
Karl Williamson [Fri, 11 Mar 2016 16:56:48 +0000 (09:56 -0700)]
inline.h: Fix comment

8 years agoperlvar: Add a couple links
Karl Williamson [Fri, 11 Mar 2016 16:55:55 +0000 (09:55 -0700)]
perlvar: Add a couple links

8 years agoperllocale: Nits, update for 5.24 changes
Karl Williamson [Fri, 11 Mar 2016 16:54:51 +0000 (09:54 -0700)]
perllocale: Nits, update for 5.24 changes

8 years agoperlapi: Clarify Latin1 and ISO-8859-1
Karl Williamson [Fri, 11 Mar 2016 03:14:24 +0000 (20:14 -0700)]
perlapi: Clarify Latin1 and ISO-8859-1

8 years agoExport Winsock error constants from POSIX.pm
Steve Hay [Tue, 16 Feb 2016 13:40:08 +0000 (13:40 +0000)]
Export Winsock error constants from POSIX.pm

8 years agoExport Winsock error constants from Errno.pm
Steve Hay [Tue, 16 Feb 2016 08:50:08 +0000 (08:50 +0000)]
Export Winsock error constants from Errno.pm

8 years agoSet $^E for socket errors on Windows
Steve Hay [Thu, 4 Feb 2016 08:51:21 +0000 (08:51 +0000)]
Set $^E for socket errors on Windows

8 years agoBetter wording.
Jarkko Hietaniemi [Fri, 11 Mar 2016 11:57:56 +0000 (06:57 -0500)]
Better wording.

8 years agogitignore for cscope index files.
Jarkko Hietaniemi [Fri, 11 Mar 2016 01:07:35 +0000 (20:07 -0500)]
gitignore for cscope index files.

8 years agomake target for cscope indexing.
Jarkko Hietaniemi [Fri, 11 Mar 2016 01:05:32 +0000 (20:05 -0500)]
make target for cscope indexing.

8 years agoCPAN release of autouse is now 1.10
Ricardo Signes [Fri, 11 Mar 2016 00:10:16 +0000 (19:10 -0500)]
CPAN release of autouse is now 1.10

this has no changes to code from 1.08; it gets in the test changes
from blead and adds a prereq for Scalar::Util with isdual

8 years agoperlapi: Document ninstr() and rninstr()
Karl Williamson [Thu, 10 Mar 2016 22:52:34 +0000 (15:52 -0700)]
perlapi: Document ninstr() and rninstr()

8 years agot/re/reg_mesg.t: Add some more tests
Karl Williamson [Thu, 10 Mar 2016 19:10:38 +0000 (12:10 -0700)]
t/re/reg_mesg.t: Add some more tests

8 years agouse inequality when checking "tail" in trie compilation
Yves Orton [Wed, 9 Mar 2016 19:03:21 +0000 (20:03 +0100)]
use inequality when checking "tail" in trie compilation

It is possible that a node inside an alternation points out
and past the end of the alternation, using equality on tail
means we don't notice. Its not clear that this is actually
required, but it has been an issue in other contexts so lets
just always use inequalities for this purpose.

8 years agoFix Perl #126206: handle NOTHING regops and EXACTFU_SS regops in make_trie() properly
Yves Orton [Wed, 9 Mar 2016 19:00:53 +0000 (20:00 +0100)]
Fix Perl #126206: handle NOTHING regops and EXACTFU_SS regops in make_trie() properly

... and avoid dereffing non-EXACT nodes unnecessarily at the same
time. This fixes https://rt.perl.org/Ticket/Display.html?id=126206

8 years agoutf8.c: Add missing {}
Karl Williamson [Wed, 9 Mar 2016 01:39:46 +0000 (18:39 -0700)]
utf8.c: Add missing {}

which caused an if's scope to be less than intended.

Spotted by Jarkko Hietaniemi using gcc 6 with the
'-Wmisleading-indentation' option

8 years agoperldelta for c2538af7458
Tony Cook [Wed, 9 Mar 2016 01:02:50 +0000 (12:02 +1100)]
perldelta for c2538af7458

8 years ago[perl #122287] probe in Configure whether dtrace builds an object
Tony Cook [Wed, 9 Mar 2016 00:54:13 +0000 (11:54 +1100)]
[perl #122287] probe in Configure whether dtrace builds an object

When building the object file, newer versions of dtrace (on Illumos
based systems at least) require an input object file that uses
at least one of the probes defined in the .d file.

The test in Makefile.SH didn't provide that definition so the test
would fail, and not build an object file, and fail to link later on,
on systems that *do* need the object file.

Moved the probe to Configure (where it probably belongs) and supplied
an object file that uses a probe.

Tested successfully on OmniOS (with the new dtrace), Solaris 11,
and darwin.

8 years agofix a skip count in cpan/IPC-SysV/t/ipcsysv.t
Tony Cook [Tue, 8 Mar 2016 23:43:57 +0000 (10:43 +1100)]
fix a skip count in cpan/IPC-SysV/t/ipcsysv.t

reported upstream as https://rt.cpan.org/Ticket/Display.html?id=112827

8 years ago[perl #127533] only test semctl() if we have everything needed to use it
Tony Cook [Tue, 1 Mar 2016 00:35:21 +0000 (11:35 +1100)]
[perl #127533] only test semctl() if we have everything needed to use it

In a FreeBSD jail, the semctl() entry point might exist, but can be
disabled by policy, when it is disabled, the Configure code that
tests for the different structures that can be supplied to semctl()
fail.

The code that implements semctl() for perl treats semctl() as
unimplemented if neither structure is available, so avoid testing
semctl() if the structures couldn't be detected.

8 years agoperlvar: Cross reference other pods
Karl Williamson [Tue, 8 Mar 2016 04:37:00 +0000 (21:37 -0700)]
perlvar: Cross reference other pods

Suggested by "kes" in
http://nntp.perl.org/group/perl.perl5.porters/234447

8 years agoConvert to use av_tindex_nomg()
Karl Williamson [Mon, 7 Mar 2016 21:49:54 +0000 (14:49 -0700)]
Convert to use av_tindex_nomg()

I looked at the code I'm familiar with, and converted the av_tindex
calls on arrays I was confident don't have magic to av_tindex_nomg().
This saves a little work each time.

8 years agoAdd av_tindex_nomg()
Karl Williamson [Mon, 7 Mar 2016 21:44:50 +0000 (14:44 -0700)]
Add av_tindex_nomg()

This is like av_tindex, but doesn't handle magic.  I'm not documenting
it for now, in case it turns out this was not a good idea.

Inspired from an observation by Tony Cook.

8 years agoregcomp.c: Silence some compiler warnings
Karl Williamson [Tue, 8 Mar 2016 00:02:04 +0000 (17:02 -0700)]
regcomp.c: Silence some compiler warnings

Some compilers wrongly think these variables can be used uninitialized.

8 years agoperlguts: Slight clarification
Karl Williamson [Mon, 7 Mar 2016 22:50:41 +0000 (15:50 -0700)]
perlguts: Slight clarification

8 years agoperlapi: Slight clarification
Karl Williamson [Mon, 7 Mar 2016 22:45:35 +0000 (15:45 -0700)]
perlapi: Slight clarification

This changes to use 'transfer' to make clear that the reference count is
unchanged.  Some think that the previous wording 'take' is good as-is;
some agree with me.  Daniel Dragan has pointed out that 5 years ago I
changed this line, while retaining 'take'.  Given that 'transfer' is
unambiguous to all, while 'take' is ambiguous to some, I'm making the
change.

8 years agopod/perldelta: Add some Selected Bug Fixes
Karl Williamson [Mon, 7 Mar 2016 18:17:39 +0000 (11:17 -0700)]
pod/perldelta: Add some Selected Bug Fixes

8 years agoregcomp.c: Remove redundant assignment
Karl Williamson [Mon, 7 Mar 2016 21:19:42 +0000 (14:19 -0700)]
regcomp.c: Remove redundant assignment

The assignment removed here is followed immediately by a goto, and the
target of the goto repeats the assignment, so this one is redundant.

Spotted by Tony Cook

8 years agoperlre: Nits, clarifications
Karl Williamson [Mon, 7 Mar 2016 17:41:22 +0000 (10:41 -0700)]
perlre: Nits, clarifications

8 years agoS_study_chunk(): silence compiler warning
David Mitchell [Mon, 7 Mar 2016 15:18:07 +0000 (15:18 +0000)]
S_study_chunk(): silence compiler warning

8 years agoMention bytes::length modern workaround re 01e331e5
Jarkko Hietaniemi [Mon, 7 Mar 2016 11:48:23 +0000 (06:48 -0500)]
Mention bytes::length modern workaround re 01e331e5

Also add an emboldening and parabreak to underline the discouragement.

8 years agoMake open failures little less cryptic.
Jarkko Hietaniemi [Mon, 7 Mar 2016 02:23:50 +0000 (21:23 -0500)]
Make open failures little less cryptic.

8 years agoadd comment explaining a subtlety
Yves Orton [Mon, 7 Mar 2016 08:18:33 +0000 (09:18 +0100)]
add comment explaining a subtlety

Tony caught a bug I made in d5a00e4af6b155495be31a35728b8fef8e671ebe and fixed
it in 2dc40b2d7c20b0d31c4343ac23cda9799f234a65. This comment explains
the subtlety that lead to the bug: the compilation state var
RExC_npar is +1 as compared to the equivalent rex->nparens.

8 years agoAdd test for [perl #126405]
Karl Williamson [Mon, 7 Mar 2016 05:44:09 +0000 (22:44 -0700)]
Add test for [perl #126405]

Commit b297756b5d78ef23f3ebf878d0342947ece424aa did not add a test, but
such a test is possible, and is added here.  The problem only showed up
on some configurations, but nonetheless, it did show up, and so will
fail the added test on those configurations, which turn out to be
regularly smoked.

8 years agoDocument the previous commit in Carp's Changes.
Shlomi Fish [Sun, 6 Mar 2016 18:52:03 +0000 (20:52 +0200)]
Document the previous commit in Carp's Changes.

8 years agoFix RTCPAN#107225 : longmess returns 1 on ref.
Shlomi Fish [Sun, 6 Mar 2016 18:37:25 +0000 (20:37 +0200)]
Fix RTCPAN#107225 : longmess returns 1 on ref.

See: https://rt.cpan.org/Public/Bug/Display.html?id=107225 . Also
discovered as a bug in perl -d by me (= Shlomi Fish) and reported
after the original report. longmess() returns "1" when called in scalar
context if passed a reference.

8 years agoavoid reading/writing beyond the end of RExC_(open|close)_parens
Tony Cook [Mon, 7 Mar 2016 03:58:38 +0000 (14:58 +1100)]
avoid reading/writing beyond the end of RExC_(open|close)_parens

Partly reverts d5a00e4af, which added this change:

-        for ( paren=0 ; paren < RExC_npar ; paren++ ) {
+        for ( paren=0 ; paren <= RExC_npar ; paren++ ) {

but RExC_(open|close)_parens are both allocated with RExC_npar entries,
making this a read/write buffer overflow.

This caused crashes during the build with GCC on Win32, and was
detectable with valgrind and -fsanitize=address on Linux.

With the change, passes all tests with -fsanitize=address -DDEBUGGING
on Linux and finishes the build with GCC on Win32.

8 years agoperldelta for 99fff99d79, af4291a8594
Tony Cook [Mon, 7 Mar 2016 00:43:51 +0000 (11:43 +1100)]
perldelta for 99fff99d79af4291a8594

8 years agomake building without memcpy work (RT #127619)
Lukas Mai [Thu, 3 Mar 2016 23:21:27 +0000 (00:21 +0100)]
make building without memcpy work (RT #127619)

8 years agoutil.c: make my_mem*/my_b* prototypes more like the originals
Lukas Mai [Mon, 29 Feb 2016 07:45:12 +0000 (08:45 +0100)]
util.c: make my_mem*/my_b* prototypes more like the originals

8 years agoUpdate bytes.pm doc
Karl Williamson [Mon, 10 Aug 2015 03:40:21 +0000 (21:40 -0600)]
Update bytes.pm doc

The one legitimate use of this pragma is for debugging.  This changes to
say so, and other minor changes.

8 years agoregcomp.c: fix Perl #126405, segfault regex
Yves Orton [Sun, 6 Mar 2016 16:32:35 +0000 (17:32 +0100)]
regcomp.c: fix Perl #126405, segfault regex

There was a flaw in how we scan regexes for triable sequences.
It is possible that the end of a branch points *past* the tail of
the branch sequences, which was resulting in us constructing
tries when we shouldn't. This patch changes equivalency tests for
an inequality test, which prevents this problem.

I am not sure how to test for this problem as it doesn't actually
segfault for me, but I can see the illegal read in valgrind.

8 years agoregcomp.c: improve diagnostics for TRIE construction
Yves Orton [Sun, 6 Mar 2016 16:31:14 +0000 (17:31 +0100)]
regcomp.c: improve diagnostics for TRIE construction

8 years agofix Perl #126182, out of memory due to infinite pattern recursion
Yves Orton [Sun, 6 Mar 2016 12:56:44 +0000 (13:56 +0100)]
fix Perl #126182, out of memory due to infinite pattern recursion

The way we tracked if pattern recursion was infinite did not work
properly. A pattern like

    "a"=~/(.(?2))((?<=(?=(?1)).))/

would loop forever, slowly eat up all available ram as it added
pattern recursion stack frames.

This patch changes the rules for recursion so that recursively
entering a given pattern "subroutine" twice from the same position
fails the match. This means that where previously we might have
seen fatal exception we will now simply fail. This means that

    "aaabbb"=~/a(?R)?b/

succeeds with $& equal to "aaabbb".

8 years agoUnify GOSTART and GOSUB
Yves Orton [Sat, 5 Mar 2016 21:04:28 +0000 (22:04 +0100)]
Unify GOSTART and GOSUB

GOSTART is a special case of GOSUB, we can remove a lot of offset twiddling,
and other special casing by unifying them, at pretty much no cost.

GOSUB has 2 arguments, ARG() and ARG2L(), which are interpreted as
a U32 and an I32 respectively. ARG() holds the "parno" we will recurse
into. ARG2L() holds a signed offset to the relevant start node for the
recursion.

Prior to this patch the argument to GOSUB would always be >=, and unlike
other parts of our logic we would not use 0 to represent "start/end" of
pattern, as GOSTART would be used for "recurse to beginning of pattern",
after this patch we use 0 to represent "start/end", and a lot of
complexity "goes away" along with GOSTART regops.

8 years agorename RExC_opend RExC_end_op for clarity
Yves Orton [Sat, 5 Mar 2016 22:09:19 +0000 (23:09 +0100)]
rename RExC_opend RExC_end_op for clarity

8 years agofirst step cleaning up regexp recursion "return" logic
Yves Orton [Sat, 5 Mar 2016 19:40:36 +0000 (20:40 +0100)]
first step cleaning up regexp recursion "return" logic

When we do a GOSUB/GOSTART we need to know where the recursion
"returns" to the previous position in the pattern. Currently
this is done by comparing cur_eval->u.eval.close_paren to the
the argument of CLOSE parens, and within END blocks (for GOSTART).

However, there is a problem. The state machinery for GOSUB/GOSTART
is shared with EVAL ( implementing /(??{ ... })/ ), which also sets
cur_eval->u.eval.close_paren to 0. This for instance breaks /(?(R)YES|NO)/
by making it return true within a /(??{ ... })/ when arguably it
shouldn't. It also is confusing.

So we change the meaning of close_paren so that 0 means "from EVAL",
and that otherwise the value is "+1", so 1 means GOSTART (trigger for
END), and 2 means "CLOSE1", etc. In order to make this transparent
this patch adds the EVAL_CLOSE_PAREN_IS( cur_eval, EXPR ) macro which
does the right thing:

    ( cur_eval && cur_eval->u.eval.close_paren &&
      ( ( cur_eval->u.eval.close_paren - 1 ) == EXPR ) )

8 years agoperlebcdic: Update for 5.24
Karl Williamson [Sun, 6 Mar 2016 03:22:44 +0000 (20:22 -0700)]
perlebcdic: Update for 5.24

Fix some typos, and most importantly remove the now-fixed items from the
BUGS section

8 years agoTime-HiRes: record latest changes
Jarkko Hietaniemi [Sat, 5 Mar 2016 21:34:31 +0000 (16:34 -0500)]
Time-HiRes: record latest changes

Assuming that at some point a CPAN release of the new! shinier!
Time-HiRes might be a good thing.

The version bump to 1.9731 was done already in 1625f1d3.  Leave the
day of month open in case more changes come in, no need to constantly
bump the version.

8 years agoPathTools: import Changes file from CPAN
Ricardo Signes [Sat, 5 Mar 2016 19:22:30 +0000 (14:22 -0500)]
PathTools: import Changes file from CPAN

8 years agoamigaos4: execvp() and popen() enhancements
Andy Broad [Sat, 5 Mar 2016 18:18:08 +0000 (13:18 -0500)]
amigaos4: execvp() and popen() enhancements

myexecvp()
Replaces alloca() in execvp() with IExec->AllocVecTags() with the memory
type explicitly set to MEMF_SHARED (alloca allocating on the stack which is
MEMF_PRIVATE and in theory at least you can't share that with the sub
process (in practice this isn't enforced yet, too much old software would
break, but one of these days)).

amigaos_popen()
Alters file opening order to ensure that the write end of the pipe is always
opened first.

Now attempts to pass Input() out Output() (stdin or stout) to the non-pipe
file handles rather than NIL: reverting to NIL: if the above can't be
DupFileHandled() (say if they were redirected to a file opened with an
exclusive lock).

8 years agoPATCH: [perl #127262] assertion fail on malformed UTF8
Karl Williamson [Sat, 5 Mar 2016 00:05:09 +0000 (17:05 -0700)]
PATCH: [perl #127262] assertion fail on malformed UTF8

Add a guard against malformed UTF-8.

8 years agoTime-HiRes: refactor also nanosleep init
Jarkko Hietaniemi [Fri, 4 Mar 2016 02:20:55 +0000 (21:20 -0500)]
Time-HiRes: refactor also nanosleep init

8 years agoTime-HiRes: avoid going negative on struct timespec
Jarkko Hietaniemi [Fri, 4 Mar 2016 02:11:38 +0000 (21:11 -0500)]
Time-HiRes: avoid going negative on struct timespec

8 years agoTime-HiRes: refactor common timespec subtraction code
Jarkko Hietaniemi [Fri, 4 Mar 2016 02:25:30 +0000 (21:25 -0500)]
Time-HiRes: refactor common timespec subtraction code

8 years agoTime-HiRes: for nanosleeps, zero is success
Jarkko Hietaniemi [Thu, 3 Mar 2016 23:23:52 +0000 (18:23 -0500)]
Time-HiRes: for nanosleeps, zero is success

Testing for zero makes it slightly less odd-looking than bang.

8 years agoTime-HiRes: use NV_1E6 and NV_1E9 consistently
Jarkko Hietaniemi [Thu, 3 Mar 2016 23:21:42 +0000 (18:21 -0500)]
Time-HiRes: use NV_1E6 and NV_1E9 consistently

8 years agoTime-HiRes: initialize the unslept timespec
Jarkko Hietaniemi [Thu, 3 Mar 2016 22:29:58 +0000 (17:29 -0500)]
Time-HiRes: initialize the unslept timespec

Found by clang scan-build.

8 years agothreads.xs: create new static fn S_jmpenv_run()
David Mitchell [Fri, 4 Mar 2016 17:36:57 +0000 (17:36 +0000)]
threads.xs: create new static fn S_jmpenv_run()

S_jmpenv_run() replaces 3 similar pieces of code that do
JMPENV_PUSH(); ... stuff ...; JMPENV_POP().

As a side effect of this commit, it gets rid of this annoying warning
under g++:

    warning: variable ‘my_perl’ might be clobbered by ‘longjmp’

8 years agorpeep(): eliminate compiler warning
David Mitchell [Fri, 4 Mar 2016 10:59:21 +0000 (10:59 +0000)]
rpeep(): eliminate compiler warning

    op.c: In function ‘Perl_rpeep’:
    op.c:13692:37: warning: comparison is always false due to limited
    range of data type [-Wtype-limits]
                             ? base : 0) >
                                     ^
replace the '0' with something that still always fails to match but
hopefully won't warn.

8 years agoSimplify _MEM_WRAP_NEEDS_RUNTIME_CHECK()
David Mitchell [Thu, 3 Mar 2016 10:59:57 +0000 (10:59 +0000)]
Simplify _MEM_WRAP_NEEDS_RUNTIME_CHECK()

And at the same time hopefully avoid some false-positive compiler warnings
on HP-UX

8 years agoPATCH: [perl #126141]: qr/]]]]][\\/ fails to raise error
Karl Williamson [Fri, 4 Mar 2016 20:14:30 +0000 (13:14 -0700)]
PATCH: [perl #126141]: qr/]]]]][\\/ fails to raise error

This was due to the trailing \ trying to look at the next character
without verifying that one actually existed.

8 years agoregcomp.c: Fix a memory leak
Karl Williamson [Fri, 4 Mar 2016 18:59:18 +0000 (11:59 -0700)]
regcomp.c: Fix a memory leak

This revises 5751998882d1db1c0f62a32a0b16e58176928a35 so that it works
if a called function fails to return (it was failing if there was
illegal tainting going on).

8 years agolocale.c: Avoid a leak
Karl Williamson [Fri, 4 Mar 2016 17:12:43 +0000 (10:12 -0700)]
locale.c: Avoid a leak

This reorders things to allow a free to be done.  The cause was spotted
by Tony Cook.

8 years agoPOSIX.xs: Avoid a leak in setlocale()
Karl Williamson [Fri, 4 Mar 2016 16:34:40 +0000 (09:34 -0700)]
POSIX.xs: Avoid a leak in setlocale()

Tony Cook suggested this fix.

8 years agoTODO or skip certain failing locale tests on cygwin
Karl Williamson [Mon, 22 Feb 2016 18:27:50 +0000 (11:27 -0700)]
TODO or skip certain failing locale tests on cygwin

This is a known problem which cygwin has fixed in 2.5

Tony Cook tested this and found and fixed several bugs in it before this
final version was made.

8 years agoregcomp.c: Revise, add comments, white-space changes
Karl Williamson [Thu, 3 Mar 2016 21:21:05 +0000 (14:21 -0700)]
regcomp.c: Revise, add comments, white-space changes

8 years agoregcomp.c: Avoid a memory leak
Karl Williamson [Thu, 3 Mar 2016 16:56:41 +0000 (09:56 -0700)]
regcomp.c: Avoid a memory leak

The croak is using heap storage for an argument.  Making that
SAVEFREEPV() will make sure it gets freed.

8 years agoregcomp.c: White-space only
Karl Williamson [Thu, 3 Mar 2016 16:40:55 +0000 (09:40 -0700)]
regcomp.c: White-space only

Outdent and reflow comments because the previous commit removed a
surrounding block.

8 years agoReinstate "PATCH: {perl #127582] Over eager warning for /[.foo.]/""
Karl Williamson [Thu, 3 Mar 2016 05:10:58 +0000 (22:10 -0700)]
Reinstate "PATCH: {perl #127582] Over eager warning for /[.foo.]/""

This reverts commit ab9a4aa72166b26d6c3556107c19ba08ee956a88 which
itself reverted commit a9149dfda17b511d34bb2af869948b677be52fbc, thus
reinstating the original.  But this new commit also adds a check to
avoid going off the end of a buffer, the absence of which was the cause
for the failure of the original commit with address sanitizer.

8 years agolocale.c: Silence HP-UX compiler warning
Karl Williamson [Thu, 3 Mar 2016 16:14:13 +0000 (09:14 -0700)]
locale.c: Silence HP-UX compiler warning

Cast this flag value to a bool, which is what we want anyway here.

8 years agoWarn of the "else syndrome".
Jarkko Hietaniemi [Thu, 3 Mar 2016 14:01:05 +0000 (09:01 -0500)]
Warn of the "else syndrome".

Not that anyone ever reads perlport.

8 years agoClarify what AmigaOS version was broken by 5.8.0
Jarkko Hietaniemi [Thu, 3 Mar 2016 13:57:32 +0000 (08:57 -0500)]
Clarify what AmigaOS version was broken by 5.8.0

8 years agoperl5db.pl version bump
Jarkko Hietaniemi [Thu, 3 Mar 2016 01:11:23 +0000 (20:11 -0500)]
perl5db.pl version bump

8 years agoDefaulting to VMS is probably not right.
Jarkko Hietaniemi [Wed, 2 Mar 2016 23:49:18 +0000 (18:49 -0500)]
Defaulting to VMS is probably not right.

8 years agoamigaos4: use CONSOLE:, not VMS sys$command
Andy Broad [Wed, 2 Mar 2016 23:45:52 +0000 (18:45 -0500)]
amigaos4: use CONSOLE:, not VMS sys$command

8 years agoamigaos4: clean up older style / deprecated AmigaOS calls
Andy Broad [Wed, 2 Mar 2016 23:43:44 +0000 (18:43 -0500)]
amigaos4: clean up older style / deprecated AmigaOS calls

8 years agoreduce number of calls to add_cp_to_invlist()
Tony Cook [Wed, 2 Mar 2016 05:19:43 +0000 (16:19 +1100)]
reduce number of calls to add_cp_to_invlist()

Both S_get_ANYOF_cp_list_for_ssc() and S_put_charclass_bitmap_innards()
have tight loops that iterate over a bitmap and calls add_cp_to_invlist()
for each bit set.

add_cp_to_invlist() is a fairly wrapper around _add_range_to_invlist()
which create a new invlist to hold the range and then calls
_invlist_union() to perform the add.  This is moderately expensive.

Instead of indirectly calling _add_range_to_invlist(), where it's
simple to do so, instead look for ranges of bits set in the bitmaps
and call _add_range_to_invlist() directly.

This changed the cachegrind output from running:

  ./perl -e 'qr/_?[\W_]/;'

from:

==23406== I   refs:      1,752,149
==23406== I1  misses:        5,405
==23406== LLi misses:        3,588
==23406== I1  miss rate:      0.30%
==23406== LLi miss rate:      0.20%
==23406==
==23406== D   refs:        683,242  (414,061 rd   + 269,181 wr)
==23406== D1  misses:       13,370  (  7,646 rd   +   5,724 wr)
==23406== LLd misses:        7,025  (  3,417 rd   +   3,608 wr)
==23406== D1  miss rate:       1.9% (    1.8%     +     2.1%  )
==23406== LLd miss rate:       1.0% (    0.8%     +     1.3%  )
==23406==
==23406== LL refs:          18,775  ( 13,051 rd   +   5,724 wr)
==23406== LL misses:        10,613  (  7,005 rd   +   3,608 wr)
==23406== LL miss rate:        0.4% (    0.3%     +     1.3%  )

to:

==25041== I   refs:      1,189,412
==25041== I1  misses:        5,218
==25041== LLi misses:        3,598
==25041== I1  miss rate:      0.43%
==25041== LLi miss rate:      0.30%
==25041==
==25041== D   refs:        440,339  (283,047 rd   + 157,292 wr)
==25041== D1  misses:       11,872  (  7,257 rd   +   4,615 wr)
==25041== LLd misses:        7,024  (  3,417 rd   +   3,607 wr)
==25041== D1  miss rate:       2.6% (    2.5%     +     2.9%  )
==25041== LLd miss rate:       1.5% (    1.2%     +     2.2%  )
==25041==
==25041== LL refs:          17,090  ( 12,475 rd   +   4,615 wr)
==25041== LL misses:        10,622  (  7,015 rd   +   3,607 wr)
==25041== LL miss rate:        0.6% (    0.4%     +     2.2%  )

ie. from 1.75 million instructions to 1.19 million instructions.

8 years agoPATCH: [perl #127599] Fix regcomp.c assertion
Karl Williamson [Wed, 2 Mar 2016 17:50:01 +0000 (10:50 -0700)]
PATCH: [perl #127599] Fix regcomp.c assertion

I added this assertion in cfbef7dc3.  It asserts that we have more to
parse.  The code in this function is quite complicated, and assumes in a
number of places that there is more to parse.  When we don't have more
to parse, 900 lines later, it throws an error.  It may be that you can't
get to the places where it assumes there is more to parse if this
assertion is false (I don't remember now from my tedious audit of this
code), but even if so, it is fragile to assume so, given the large
distance to where the error is thrown.  So throw the error right away
and avoid any existing or future breakage.

8 years agodocument args of Perl_do_sv_dump()
David Mitchell [Wed, 2 Mar 2016 17:29:31 +0000 (17:29 +0000)]
document args of Perl_do_sv_dump()

8 years agoamigaos4: no sigaction, no si fields
Jarkko Hietaniemi [Wed, 2 Mar 2016 00:56:04 +0000 (19:56 -0500)]
amigaos4: no sigaction, no si fields

8 years agopp_subst(): rename local var
David Mitchell [Wed, 2 Mar 2016 11:23:54 +0000 (11:23 +0000)]
pp_subst(): rename local var

make it clear that is_cow represents the original COW state (which may not
be the current state when checked later), by renaming it to was_cow.

8 years agopp_subst: fix typo
David Mitchell [Wed, 2 Mar 2016 10:25:32 +0000 (10:25 +0000)]
pp_subst: fix typo

8 years agouse cBOOL() in pp_subst()
David Mitchell [Wed, 2 Mar 2016 10:23:43 +0000 (10:23 +0000)]
use cBOOL() in pp_subst()

Now that we have that macro, use it.

8 years agoS_regmatch(): remove dead code
David Mitchell [Wed, 2 Mar 2016 09:16:34 +0000 (09:16 +0000)]
S_regmatch(): remove dead code

The 'sayNO'; follows a croak, so can never be reached.

8 years agoremove some duplicate /* NOTREACHED */
David Mitchell [Wed, 2 Mar 2016 09:08:48 +0000 (09:08 +0000)]
remove some duplicate /* NOTREACHED */

In regexec.c there were several occurrences of

    /* NOTREACHED */
    NOT_REACHED; /* NOTREACHED */

where the first line isn't needed.

8 years agoRevert "PATCH: {perl #127582] Over eager warning for /[.foo.]/"
Karl Williamson [Wed, 2 Mar 2016 05:42:46 +0000 (22:42 -0700)]
Revert "PATCH: {perl #127582] Over eager warning for /[.foo.]/"

This reverts commit a9149dfda17b511d34bb2af869948b677be52fbc.
This is causing failures in blead under clang, so I'm reverting it until
I can work out why.

8 years agoRevert "regcomp.c: White-space only"
Karl Williamson [Wed, 2 Mar 2016 05:41:59 +0000 (22:41 -0700)]
Revert "regcomp.c: White-space only"

This reverts commit 7511771ceb229ce97939f643c6de73c6b1a371be, so that
the next commit can be cleanly reverted

8 years agobump $strict::VERSION and $warnings::VERSION
Tony Cook [Wed, 2 Mar 2016 04:52:06 +0000 (15:52 +1100)]
bump $strict::VERSION and $warnings::VERSION

8 years agonarrow the filename check in strict.pm/warnings.pm
Aristotle Pagaltzis [Wed, 2 Mar 2016 02:30:30 +0000 (03:30 +0100)]
narrow the filename check in strict.pm/warnings.pm

• The code previously assumed that any filename basename besides
  `strict.pm` meant that the user mistyped `use strict` (e.g. as
  `use Strict`). But that could just mean the file was not loaded
  from the filesystem, e.g. due to naïve fatpacking.

  This is fixed by adding a guard to check that an unexpected value
  really is a mis-capitalised variant of `strict.pm`.

• The code previously insisted on either slash or backslash as the
  directory separator, which is not strictly portable (though nobody
  noticed in years; apparently nobody has tried to run a recent-ish
  on a MacOS Classic or RiscOS system).

  This is fixed by switching to \b as a best effort, to avoid going
  down the rabbit hole of platform-specific separators.

• The code previously used an `unless` statement, declared lexical
  variables inside its block, and used ${\EXPR} to interpolate the
  __PACKAGE__ constant into the regexp. Each of these increases the
  size of the optree, which is only ever executed once, then sticks
  around wasting some hundred(s) bytes in almost every single Perl
  program in the world.

  This is fixed for warnings.pm by rewriting the code with no use of
  any temporary variables and single-quoted strings instead of regexp
  literals. In strict.pm, we can do even better by moving the code to
  the BEGIN block, since BEGIN CVs are freed after running. (We do not
  add one to warnings.pm since BEGIN blocks have a creation cost.)

8 years agoregcomp.c: Avoid an empty [] in -Dr output
Karl Williamson [Tue, 1 Mar 2016 22:19:49 +0000 (15:19 -0700)]
regcomp.c: Avoid an empty [] in -Dr output

8 years agoregcomp.c: White-space only
Karl Williamson [Tue, 1 Mar 2016 18:26:49 +0000 (11:26 -0700)]
regcomp.c: White-space only

Outdent and reflow comments because the previous commit removed a
surrounding block.