This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
8 years agomktables: Fix bug with early Unicode versions
Karl Williamson [Thu, 17 Mar 2016 20:27:34 +0000 (14:27 -0600)]
mktables: Fix bug with early Unicode versions

An array had 2 optional elements at the end.  I got confused about
handling them.  This change first deals with the final one, pops it and
saves it separately if found.  Then only one optional element needs to
be dealt with in the course of the code.

This only gets executed for very early Unicode versions

8 years agomktables: Unicode 1.5 only had 2**16 code points
Karl Williamson [Tue, 15 Mar 2016 22:19:30 +0000 (16:19 -0600)]
mktables: Unicode 1.5 only had 2**16 code points

Therefore, we shouldn't add any above that.

8 years agoThe public_html directory on dromedary is working again.
Abigail [Thu, 17 Mar 2016 11:30:32 +0000 (12:30 +0100)]
The public_html directory on dromedary is working again.

So, I removed the references that it wasn't working in December 2015.

8 years agoAdd contributing info to Carp.
Shlomi Fish [Thu, 10 Mar 2016 19:32:41 +0000 (21:32 +0200)]
Add contributing info to Carp.

It lacked a link to the VCS repository so I had to ask rjbs about it on
the #p5p IRC channel. And one should always fix a problem twice:

* http://www.joelonsoftware.com/articles/customerservice.html .

8 years agoharmonize S_dump_exec_pos()'s last arg type
David Mitchell [Mon, 14 Mar 2016 19:11:08 +0000 (19:11 +0000)]
harmonize S_dump_exec_pos()'s last arg type

embed.fnc declared it as "U32 depth", while it was defined as "const U32
depth".

8 years agoavoid generating an empty statement outside a function on non-clang
Tony Cook [Tue, 15 Mar 2016 00:26:26 +0000 (11:26 +1100)]
avoid generating an empty statement outside a function on non-clang

On non-clang compilers, the code:

CLANG_DIAG_RESTORE;

outside a function generated a simple empty statement (or empty
declaration), which is invalid syntax outside a function in C,
causing a warning from the solaris studio compiler.

8 years agofix "bad match" issue reported in perl #127705
Yves Orton [Mon, 14 Mar 2016 22:30:02 +0000 (23:30 +0100)]
fix "bad match" issue reported in perl #127705

In 24be310237a0f8f19cfdb71de1b068b4ce9572a0 I reworked how
we stored the close_paren info in the regexp match state
structure. Unfortunately I missed a subtle aspect of the
logic which meant that in certain cases we were relying
on close_paren being true to avoid comparing it against
a false ARG value for things like CURLYX, which meant that
sometimes we would exit an stack frame prematurely. This
patch fixes that logic and makes it more clear (via macros)
what is going on.

8 years agofix perl #127705, incorrect restoration of state during EVAL/GOSUB
Yves Orton [Mon, 14 Mar 2016 19:03:22 +0000 (20:03 +0100)]
fix perl #127705, incorrect restoration of state during EVAL/GOSUB

We were not restoring the cur_curlyx property properly during our funky
stack traversal when we really need to. This was a longstanding bug in this
code which my patches appear to have "tickled", although I am not sure why.

8 years agoadd consistency with other union members
Yves Orton [Mon, 14 Mar 2016 18:58:33 +0000 (19:58 +0100)]
add consistency with other union members

In most cases the curlyx member is the first thing after the yes state
member, but eval was reversed. While debugging perl #127705 I switched
them to see what would happen, which changed the bug, and ultimately
revealed the cause of the problem. So I am going to leave them in the
"consistent" order.

8 years agofixup broken diagnostic
Yves Orton [Mon, 14 Mar 2016 17:10:19 +0000 (18:10 +0100)]
fixup broken diagnostic

we shouldnt show this in normal re debug mode, just when debugging the stack,
also the macro wasnt using the STR argument like it should

8 years agoamigaos4: avoid PerlIO_findFILE() in popen/plcose
Andy Broad [Mon, 14 Mar 2016 21:43:30 +0000 (17:43 -0400)]
amigaos4: avoid PerlIO_findFILE() in popen/plcose

Merges amigaos_popen / amigaos_pclose with the amigaos specific
version of the Perl_my_popen / Perl_my_pclose functions and uses PerlIO
directly for the perl facing end of the PIPE:s thus avoid the issues
of PerlIO_findFILE() completely.

Also fixes a couple of warnings.

8 years agoConfigure: silence some try.c warnings
David Mitchell [Mon, 14 Mar 2016 16:49:05 +0000 (16:49 +0000)]
Configure: silence some try.c warnings

On one of the try.c compilations, redirect stderr to /dev/null, since
the code can legitimately warn without there being a problem.

The try.c in question is probing for what symbols the compiler supports.
The clang extensions __has_include and __has_include_next are designed
only to be used in .h files, so they warn if used from try.c

8 years agos/ar rcu/ar rc/ during linking
David Mitchell [Mon, 14 Mar 2016 15:41:46 +0000 (15:41 +0000)]
s/ar rcu/ar rc/ during linking

The are a few places in Makefile.SH which do (approximately):

    rm $libfile
    ar rcu $libfile *.o

The 'u' in 'rcu' seems redundant since the old lib file is always deleted
just before being recreated; and more to the point, it generates warnings
on recent Linux builds:

    /bin/ar: `u' modifier ignored since `D' is the default (see `U')

This is because the 'u' modifier updates the archive, i.e. only replaces
the objects which are newer in an existing archive. On my Linux system,
ar by default operates in 'deterministic' mode, which means that it
doesn't add timestamps etc (so that repeated builds will give identical
binaries). In this mode 'u' can't work, hence the warning.

So this commit just removes the 'u' flag.

8 years agoHOPBACKc(pos, off): silence compiler warning
David Mitchell [Mon, 14 Mar 2016 15:24:35 +0000 (15:24 +0000)]
HOPBACKc(pos, off): silence compiler warning

This macro does (amongst other things)
    reghopmaybe3(..., -off, ...)

When passed an off that is unsigned (e.g. prog->gofs, which is STRLEN),
The MSWin32 smoker complains:

    ..\regexec.c(2939) : warning C4146: unary minus operator applied to
    unsigned type, result still unsigned

Chane the arg to (SSize_t)0-off and hope that integer conversion rules
make the expression legal.

8 years agoonly call Perl_re_printf() under -DDEBUGGING
Tony Cook [Mon, 14 Mar 2016 01:56:32 +0000 (12:56 +1100)]
only call Perl_re_printf() under -DDEBUGGING

This caused link failures on Win32 with MSVC.

8 years agoTime-HiRes: recent changes
Jarkko Hietaniemi [Mon, 14 Mar 2016 00:20:23 +0000 (20:20 -0400)]
Time-HiRes: recent changes

8 years agoTime-HiRes: version bump
Jarkko Hietaniemi [Mon, 14 Mar 2016 00:05:15 +0000 (20:05 -0400)]
Time-HiRes: version bump

8 years agoTime-HiRes: the mutex needs init
Jarkko Hietaniemi [Mon, 14 Mar 2016 00:01:17 +0000 (20:01 -0400)]
Time-HiRes: the mutex needs init

8 years agoTime-HiRes: also hrt_ualarm_itimer() is unused
Jarkko Hietaniemi [Sun, 13 Mar 2016 23:55:56 +0000 (19:55 -0400)]
Time-HiRes: also hrt_ualarm_itimer() is unused

8 years agoTime-HiRes: MUTEX_LOCK, not PERL_MUTEX_LOCK
Jarkko Hietaniemi [Sun, 13 Mar 2016 23:53:17 +0000 (19:53 -0400)]
Time-HiRes: MUTEX_LOCK, not PERL_MUTEX_LOCK

8 years agoautouse: update tests to match new v1.11 CPAN release
Ricardo Signes [Sun, 13 Mar 2016 22:47:18 +0000 (18:47 -0400)]
autouse: update tests to match new v1.11 CPAN release

8 years agoTime-HiRes: aim for CPAN release of 1.9731 today
Jarkko Hietaniemi [Sun, 13 Mar 2016 21:26:06 +0000 (17:26 -0400)]
Time-HiRes: aim for CPAN release of 1.9731 today

8 years agodont call re_printf() with %*s if you arent going to pass it in
Yves Orton [Sun, 13 Mar 2016 17:43:31 +0000 (18:43 +0100)]
dont call re_printf() with %*s if you arent going to pass it in

8 years agoonce more for the win
Yves Orton [Sun, 13 Mar 2016 17:12:29 +0000 (18:12 +0100)]
once more for the win

Apparently I have to pass in the context explicitly for this type of
sub, since we cant do a proper macro wrap for subs using ... (va_args/va_list)
so we have to do everything explicitly. Hopefully this fixes the smoke reports

8 years agolib/warnings.t: Skip an ASCII-centric test on EBCDIC
Karl Williamson [Sun, 13 Mar 2016 16:08:36 +0000 (10:08 -0600)]
lib/warnings.t: Skip an ASCII-centric test on EBCDIC

This test is for a specific UTF-8 malformation, but UTF-EBCDIC is
different, so just skip it there.

8 years agofixup definitions and usage of new re debugging subs
Yves Orton [Sun, 13 Mar 2016 15:59:32 +0000 (16:59 +0100)]
fixup definitions and usage of new re debugging subs

this should fix the smoke failures on threaded builds,
also it renames re_indentfo which was a terrible name in the first
place, and now what i have had to strip the Perl_prefixes from
these subs with a perl -i -pe, I took the opportunity to rename
it to re_exec_indent, which self documents much better.

8 years ago[perl #126182] rework pattern GOSUB infinite recursion detection
Yves Orton [Sun, 13 Mar 2016 10:15:30 +0000 (11:15 +0100)]
[perl #126182] rework pattern GOSUB infinite recursion detection

In ba6840fbf2fdde3e7f1bda1a26f46c901f36d5ec I tried to fix
[perl #126182] which is a bug about us failing to detect regex
left recursion in some cases.

There were two problems with that patch, both pointed out by
Zefram. The first is that I made left recursion a match fail,
instead of throwing an exception, this makes left-recursion match
sometimes, but at least sometimes in what is arguably the wrong
way. Zefram was able to convince me that dying is better than
matching incorrectly.

The second patch was that it ignored some subtleties in how
the backtracking stack works, which affected how the patch
restored the recurse_locinput[] data which is used to track
what position a GOSUB was entered from. This meant that in
various cases it would not be restored correctly, and we would
still infinite recurse. I believe that it works correctly now.

Thanks for Zefram for the feedback on the original patch.

8 years agoRework diagnostics in the regex engine
Yves Orton [Fri, 11 Mar 2016 09:36:25 +0000 (10:36 +0100)]
Rework diagnostics in the regex engine

This introduces three new subs:

Perl_re_printf() which is a wrapper for

    PerlIO_printf( Perl_debug_log, ... ),

which cuts down on clutter in the code. Arguably this could be moved
to util.c and renamed something like PerlIO_debugf() and then we could
declutter all the statements that write to the Perl_debug_log
filehandle. But that is a bit too ambituous for me right now, so
I leave this as a regex engine only sub for now.

Perl_re_indentf() which is a wrapper for PerlIO_re_printf(),
which adds an indent argument and automatically indents the
line appropriately, and is used in regcomp.c for trace diagnostics
during compilation.

Perl_re_indentfo() which is similar to Perl_re_indentf() but
is used in regexec.c which adds a specific prefix to each indented
line to account for the fact that during execution we normally have
string position information on the left.

The end result of this patch is that a lot of clutter in the debugging
statements in the regex engine is reduced, exposing what is actually
going on. It should also now be easier to add new diagnostics which
"do the right thing".

Over time the debugging trace output in regexec has become
very cluttered and confusing. This patch cleans much of it up,
if something happens at a given recursion depth it is output
at the right depth, etc, and formats have been changed to not have
leading spaces so you can actually see the indentation properly.

8 years agoTime-HiRes: record recent changes
Jarkko Hietaniemi [Sun, 13 Mar 2016 00:57:24 +0000 (19:57 -0500)]
Time-HiRes: record recent changes

8 years agoTime-HiRes: not_used is unused
Jarkko Hietaniemi [Sun, 13 Mar 2016 00:17:20 +0000 (19:17 -0500)]
Time-HiRes: not_used is unused

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.