This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
6 years agoMake VMS CRTL features work for embedders.
Craig A. Berry [Sun, 21 Jan 2018 18:47:45 +0000 (12:47 -0600)]
Make VMS CRTL features work for embedders.

The various run-time features of the CRTL that Perl uses were being
fetched at image activation time and stored in static variables
for later reference.  That works ok when Perl is the program, but
not when Perl is the library since in the latter case attempts by
an embedder to alter the feature settings before invoking Perl were
being ignored.

So store the feature index, not its value, and use that index to
get the current value via decc$feature_get_value whenever we need
it.  This means function calls rather than data references, but
there is no measurable impact on performance.

Also fix a bug in the handling of the feature to disable the POSIX
root; we were saying we were disabling it but weren't really doing
so because its current value cannot be set for some reason (only
its default value).  Since the feature only affects the conversion
of filenames between Unix and VMS format and we don't use the CRTL's
functions for that, it's unlikely this bug ever caused trouble.

6 years agoloc_tools.pl: untaint _source_location's return value and fix a warning
Tomasz Konojacki [Sat, 20 Jan 2018 22:54:34 +0000 (23:54 +0100)]
loc_tools.pl: untaint _source_location's return value and fix a warning

Some of our tests are running with -T and it turns out that something in
File::Spec::Unix is the tainting the return value of _source_location().

Additionally, when warnings are enabled globally (with either $^W or -W),
not passing the last argument (filename) to File::Spec->catpath results in
an undefined variable warning.

6 years agoFix typos in script_run documentation
Tom Wyant [Sat, 20 Jan 2018 22:09:00 +0000 (15:09 -0700)]
Fix typos in script_run documentation

6 years agoBibbidi-Bobbidi-Boo
Chris 'BinGOs' Williams [Sat, 20 Jan 2018 11:06:19 +0000 (11:06 +0000)]
Bibbidi-Bobbidi-Boo

6 years agoUpdate Module::CoreList for 5.27.9
Abigail [Sat, 20 Jan 2018 04:18:09 +0000 (05:18 +0100)]
Update Module::CoreList for 5.27.9

6 years agoBump the perl version in various places for 5.27.9
Abigail [Sat, 20 Jan 2018 04:12:23 +0000 (05:12 +0100)]
Bump the perl version in various places for 5.27.9

6 years agoNew perldelta for 5.27.9
Abigail [Sat, 20 Jan 2018 03:57:46 +0000 (04:57 +0100)]
New perldelta for 5.27.9

6 years agoTick release schedule
Abigail [Sat, 20 Jan 2018 03:51:34 +0000 (04:51 +0100)]
Tick release schedule

6 years agoEpigraph for 5.27.8
Abigail [Sat, 20 Jan 2018 03:49:55 +0000 (04:49 +0100)]
Epigraph for 5.27.8

6 years agoPerlhist entry for 5.27.8 v5.27.8
Abigail [Sat, 20 Jan 2018 01:35:07 +0000 (02:35 +0100)]
Perlhist entry for 5.27.8

6 years agoFixup for perldelta.
Abigail [Sat, 20 Jan 2018 01:29:00 +0000 (02:29 +0100)]
Fixup for perldelta.

Removed a XXX section.

6 years agoUpdated modules for perldelta.
Abigail [Sat, 20 Jan 2018 01:22:33 +0000 (02:22 +0100)]
Updated modules for perldelta.

6 years agoAcknowledgements for perldelta
Abigail [Sat, 20 Jan 2018 00:51:29 +0000 (01:51 +0100)]
Acknowledgements for perldelta

6 years agoUpdate Module::CoreList for 5.27.8
Abigail [Fri, 19 Jan 2018 23:18:05 +0000 (00:18 +0100)]
Update Module::CoreList for 5.27.8

6 years agoperldelta: Clarify entry
Karl Williamson [Fri, 19 Jan 2018 22:24:31 +0000 (15:24 -0700)]
perldelta: Clarify entry

Spotted by Dan Book

6 years agoDon’t vivify elems when putting array on stack
Father Chrysostomos [Fri, 19 Jan 2018 21:47:53 +0000 (13:47 -0800)]
Don’t vivify elems when putting array on stack

6661956a2 was a little too powerful, and, in addition to fixing the
bug that @_ did not properly alias nonexistent elements, also broke
other uses of nonexistent array elements.  (See the tests added.)

This commit changes it so that putting @a on the stack does not vivify
all ‘holes’ in @a, but creates defelem (deferred element) scalars, but
only in lvalue context.

6 years agoApply the mod flag to @a in \(@a)
Father Chrysostomos [Fri, 19 Jan 2018 20:41:15 +0000 (12:41 -0800)]
Apply the mod flag to @a in \(@a)

The next commit will depend on it.

6 years agoperldelta for signatures/attribute order flip
David Mitchell [Fri, 19 Jan 2018 21:11:24 +0000 (21:11 +0000)]
perldelta for signatures/attribute order flip

6 years agomove sub attributes before the signature
David Mitchell [Thu, 18 Jan 2018 09:44:10 +0000 (09:44 +0000)]
move sub attributes before the signature

RT #132141

Attributes such as :lvalue have to come *before* the signature to ensure
that they're applied to any code block within the signature; e.g.

    sub f :lvalue ($a = do { $x = "abc"; return substr($x,0,1)}) {
        ....
    }

So this commit moves sub attributes to come before the signature.  This is
how they were originally, but they were swapped with v5.21.7-394-gabcf453.
This commit is essentially a revert of that commit (and its followups
v5.21.7-395-g71917f6, v5.21.7-421-g63ccd0d), plus some extra work for
Deparse, and an extra test.

See:
    RT #123069 for why they were originally swapped
    RT #132141 for why that broke :lvalue
    http://nntp.perl.org/group/perl.perl5.porters/247999
               for a general discussion about RT #132141

6 years agonewSVpvn(): Fix pod
Karl Williamson [Fri, 19 Jan 2018 20:02:36 +0000 (13:02 -0700)]
newSVpvn(): Fix pod

There is no "buffer" argument; don't refer to one.

Spotted by KES

6 years agoRaise deprecation for qr/(?foo})/
Karl Williamson [Thu, 4 Jan 2018 19:53:29 +0000 (12:53 -0700)]
Raise deprecation for qr/(?foo})/

An unescaped left brace that is meant to be taken literally is
officially deprecated, though there are no plans to remove it in contexts
where we don't expect to use it to mean something else, and no warning
is raised in those contexts.

reg_mesg.t tests the known set of these contexts, currently (after this
commit):

 /^{/
 /foo|{/
 /foo|^{/
 /foo(:?{bar)/
 /\s*{/
 /a{3,4}{/

 This commit deprecates this context:

 /foo({bar})/

 This probably should have been illegal all along when 'bar' is a valid
 quantifier, as we do with the other quantifiers that follow a left
 paren whose illegality we haven't already taken advantage of to mean
 something else:

    qr/(+0)/
    Quantifier follows nothing in regex

This deprecation will allow ({...}) to be usable for a possible future
regex extension

6 years agodoop.c: White-space only
Karl Williamson [Tue, 19 Dec 2017 23:14:01 +0000 (16:14 -0700)]
doop.c: White-space only

Indent to correspond with the new block placed by the previous commit.

6 years agoDeprecate above \xFF in bitwise string ops
Karl Williamson [Tue, 19 Dec 2017 23:03:39 +0000 (16:03 -0700)]
Deprecate above \xFF in bitwise string ops

This is already a fatal error for operations whose outcome depends on
them, but in things like

  "abc" & "def\x{100}"

the wide character doesn't actually need to participate in the AND, and
so perl doesn't.  As a result of the discussion in the thread beginning
with http://nntp.perl.org/group/perl.perl5.porters/244884, it was
decided to deprecate these ones too.

6 years agodoop.c: Use MIN()
Karl Williamson [Tue, 19 Dec 2017 23:03:57 +0000 (16:03 -0700)]
doop.c: Use MIN()

This is slightly cleaner than hand rolling the min.

6 years agoop/bop.t: Fix typo in test name
Karl Williamson [Tue, 19 Dec 2017 22:49:47 +0000 (15:49 -0700)]
op/bop.t: Fix typo in test name

6 years agoUpdate Copyright years in README and perl.c.
Abigail [Fri, 19 Jan 2018 15:36:57 +0000 (16:36 +0100)]
Update Copyright years in README and perl.c.

Now, 2018 is included.

6 years agoperldelta: add recent tr/// changes
David Mitchell [Fri, 19 Jan 2018 14:27:07 +0000 (14:27 +0000)]
perldelta: add recent tr/// changes

6 years ago[MERGE] various tr/// fixups, esp for /c and /d
David Mitchell [Fri, 19 Jan 2018 14:08:28 +0000 (14:08 +0000)]
[MERGE] various tr/// fixups, esp for /c and /d

This branch does the following:

Fixes an issue with tr/non_utf8/long_non_utf8/c, where
length(long_non_utf8) > 0x7fff.

Fixes an issue with tr/non_utf8/non_utf8/cd: basically, the
implicit \x{100}-\x{7fffffff} added to the searchlist by /c wasn't being
added.

Adds a lot of code comments to the various tr/// functions.

Adds tr///c tests - basically /c was almost completely untested.

Changes the layout of the op_pv transliteration table: it used to be roughly

      256 x short  - basic table
        1 x short  - length of extended table (n)
        n x short  - extended table

where the 2 and 3rd items were only present under /c. Its now

        1 x Size_t - length of table (256+n)
  (256+n) x short  - table - both basic and extended

where n == 0 apart from under /c.

The new table format also allowed the tr/non_utf8/non_utf8/ code branches
to be considerably simplified.

op_dump() now dumps the contents of the (non-utf8 variant) transliteration
table.

Removes I32's from the tr/non_utf8/non_utf8/ code paths, making it fully
64-bit clean.

Improves the pod for tr///.

6 years agoperlop: improve tr/// documentation
David Mitchell [Fri, 19 Jan 2018 13:33:14 +0000 (13:33 +0000)]
perlop: improve tr/// documentation

Specifically, explain more clearly what the /csd modifiers do.

6 years agotr///: eliminate I32 from the do_trans*() fns
David Mitchell [Fri, 19 Jan 2018 12:56:33 +0000 (12:56 +0000)]
tr///: eliminate I32 from the do_trans*() fns

Replace each with a more appropriate type

6 years agotr///: return Size_t count rather than I32
David Mitchell [Fri, 19 Jan 2018 12:45:37 +0000 (12:45 +0000)]
tr///: return Size_t count rather than I32

Change the signature of all the internal do_trans*() functions to return
Size_t rather than I32, so that the count returned by tr//// can cope with
strings longer than 2Gb.

6 years agotr///: remove some I32 from S_pmtrans()
David Mitchell [Fri, 19 Jan 2018 12:18:39 +0000 (12:18 +0000)]
tr///: remove some I32 from S_pmtrans()

I32 to hold char counts etc is generally a bug. I've replaced with Size_t.
I've left the swash part of the code alone.

6 years agotr/nonutf8/nonutf8/c: simplify GROW calc
David Mitchell [Fri, 19 Jan 2018 12:01:56 +0000 (12:01 +0000)]
tr/nonutf8/nonutf8/c: simplify GROW calc

When, for each slot,  deciding whether to set OPpTRANS_GROWS, the
calculation is only done in one of 4 possible branches. It turns out that
in the other branches, the condition can never be true; but determining
that is subtle, and the assumption might break for future changes.  Move
the test outside the if/else tree so it can be seen to always apply.

So in theory this commit makes no function difference.

6 years agoop_dump(): dump tr/// translation table
David Mitchell [Thu, 4 Jan 2018 16:27:46 +0000 (16:27 +0000)]
op_dump(): dump tr/// translation table

previously it just displayed its address.
Also, when the table is in fact a swash, don't display its address
on threaded builds, as its actually just a padix.

6 years agotr///; simplify $utf8 =~ tr/nonutf8/nonutf8/
David Mitchell [Mon, 15 Jan 2018 15:29:27 +0000 (15:29 +0000)]
tr///; simplify $utf8 =~ tr/nonutf8/nonutf8/

The run-time code to handle a non-utf8 tr/// against a utf8 string
is complex, with many variants of similar code repeated depending on the
presence of the /s and /c flags.

Simplify them all into a single code block by changing how the translation
table is stored. Formerly, the tr struct contained possibly two tables:
the basic 0-255 slot one, plus in the presence of /c, a second one
to map the implicit search range (\x{100}...) against any residual
replacement chars not consumed by the first table.

This commit merges the two tables into a single unified whole. For example

    tr/\x00-\xfe/abcd/c

is equivalent to

    tr/xff-\x{7fffffff}/abcd/

which generates a 259-entry translation table consisting of:

    0x00  => -1
    0x01  => -1
    ...
    0xfe  => -1
    0xff  =>  a
    0x100 =>  b
    0x101 =>  c
    0x102 =>  d

In addition we store:
    1) the size of the translation table (0x103 in the example above);
    2) an extra 'wildcard' entry stored 1 slot beyond the main table,
       which specifies the action for any codepoints outside the range of
       the table (i.e. chars 0x103..0x7fffffff). This can be either:
        a) a character, when the last replacement char is repeated;
        b) -1 when /c isn't in effect;
        c) -2 when /d is in effect;
        c) -3 identity: when the replacement list is empty but not /d.

       In the example above, this would be
            0x103 =>  d

The addition of -3 as a valid slot value is new.

This makes the main runtime code for the utf8 string with non-utf8 tr//
case look like, at its core:

    size = tbl->size;
    mapped_ch = tbl->map[ch >= size ? size : ch];

which then processes mapped_ch based on whether its >=0, or -1/-2/-3.

This is a lot simpler than the old scheme, and should generally be faster
too.

6 years agotr///c: handle len(replacement charlist) > 32767
David Mitchell [Fri, 12 Jan 2018 16:21:48 +0000 (16:21 +0000)]
tr///c: handle len(replacement charlist) > 32767

RT #132608

In the non-utf8 case, the /c (complement) flag to tr adds an implied
\x{100}-\x{7fffffff} range to the search charlist. If the replacement list
contains more chars than are paired with the 0-255 part of the search
list, then the excess chars are stored in an extended part of the table.
The excess char count was being stored as a short, which caused problems
if the replacement list contained more than 32767 excess chars: either
substituting the wrong char, or substituting for a char located up to
0xffff bytes in memory before the real translation table.

So change it to SSize_t.

Note that this is only a problem when the search and replacement charlists
are non-utf8, the replacement list contains around 0x8000+ entries, and
where the string being translated is utf8 with at least one codepoint >=
U+8000.

6 years agoB, Deparse fixups for tr///c
David Mitchell [Fri, 12 Jan 2018 14:35:03 +0000 (14:35 +0000)]
B, Deparse fixups for tr///c

Recent commits slightly changed the layout of the extended map table: it
now always stores a repeat count, and there are now two structs defined,
rather than treating certain slots, like tbl[0x101], specially.

Update B and Deparse to reflect this.

6 years agoadd two structs for OP_TRANS
David Mitchell [Fri, 12 Jan 2018 12:00:30 +0000 (12:00 +0000)]
add two structs for OP_TRANS

Originally, the op_pv of an OP_TRANS op pointed to a 256-slot array of
shorts, which contained the translations. However, in the presence of
tr///c, extra information needs to be stored to handle utf8 strings.
The 256 slot array was extended, with slot 0x100 holding a length,
and slots 0x101 holding some extra chars.

This has made things a bit messy, so this commit adds two structs,
one being an array of 256 shorts, and the other being the same but with
some extra fields. So for example tbl->[0x100] has been replaced with
tbl->excess_len.

This commit should make no functional difference, but will allow us
shortly to fix a bug by changing the type of the excess_len field from
short to something bigger, for example.

6 years agoS_do_trans_complex(): re-indent
David Mitchell [Thu, 11 Jan 2018 14:41:33 +0000 (14:41 +0000)]
S_do_trans_complex(): re-indent

outdent a code block following previous commit.

6 years agofix "\x{100}..." =~ tr/.../.../cd
David Mitchell [Thu, 11 Jan 2018 11:45:49 +0000 (11:45 +0000)]
fix "\x{100}..." =~ tr/.../.../cd

In transliterations where the search and replacement charlists are
non-utf8, but where the string being modified contains codepoints >=
0x100, then tr/.../.../cd would always delete all such codepoints, rather
than potentially mapping some of them.

In more detail: in the presence of /c (complement), an implicit
0x100..0x7fffffff is added to a non-utf8 search charlist. If the
replacement list is longer than the < 0x100 part of the search list, then
the last few replacement chars should in principle be paired off against
the first few of (\x100, \x101, ...). However, this wasn't happening. For
example,

    tr/\x00-\xfd/ABCD/cd

should be equivalent to

    tr/\xfe-\x{7fffffff}/ABCD/d

which should
    map:
        \xfe    => A,
        \xff    => B,
        \x{100} => C,
        \x{101} => D,
    and delete \x{102} onwards.

But instead, it behaved like

    tr/\xfe-\x{7fffffff}/AB/d

and deleted all codepoints >= 0x100.

This commit fixes that by using the extended mapping table format
for all /c variants (formerly it excluded /cd).

I also changed a variable holding the mapped char from being I32 to UV:
principally to avoid a casting mess in the fixed code. This may (or may
not), as a side-effect, have fixed possible issues with very large
codepoints.

6 years agoOP_TRANS: change extended table format
David Mitchell [Tue, 9 Jan 2018 10:05:33 +0000 (10:05 +0000)]
OP_TRANS: change extended table format

For non-utf8, OP_TRANS(R) ops have a translation table consisting of an
array of 256 shorts attached. For tr///c, this table is extended to hold
information about chars in the replacement list which aren't paired with
chars in the search list.  For example,

    tr/\x00-AE-\xff/bcdefg/c

is equivalent to

    tr/BCD\x{100}-\x{7fffffff}/bcdefg/

which is equivalent to

    tr/BCD\x{100}-\x{7fffffff}/bcdefggggggggg..../

Only the BCD => bcd mappings can be stored in the basic 256-slot table,
so potentially the following extra information needs recording in an
extended table to handle codepoints > 0xff in the string being modified:

    1) the extra replacement chars ("efg");
    2) the number of extra replacement chars (3);
    3) the "repeat" char ('g').

Currently 2) and 3) are combined: the repeat char is found as the last
extra char, and if there are no extra chars, the repeat char is treated
as an extra char list of length 1.
Similarly, an 'extra chars' length value of 1 can imply either one extra
char, or no extra chars with the repeat char being faked as an extra char.
An 'extra chars' length of 0 implies an empty replacement list, i.e.
tr/....//c.

This commit changes it so that the repeat char is *always* stored (in slot
0x101), with the extra chars stored beginning at slot 0x102.
The 'extra chars' length value (located at slot 0x0100) has changed its
meaning slightly: now
    -1 implies tr/....//c
     0  implies no more replacement chars than search chars
    1+ the number of excess replacement chars.

This (should) make no function difference, but the extra information
stored will make it easier to fix some bugs shortly.

6 years agoS_pmtrans(): add assert and simplify conditional
David Mitchell [Mon, 8 Jan 2018 16:14:17 +0000 (16:14 +0000)]
S_pmtrans(): add assert and simplify conditional

in tr/search/replace/c, the number of 'paired' replacement chars
will always be <= length(replace). Assert this, and thus simplify a couple
of conditionals from >= to ==.

It should make no difference to execution, but reduces the cognitive
load.

6 years agot/op/tr.t: add tr///c tests
David Mitchell [Thu, 4 Jan 2018 13:20:59 +0000 (13:20 +0000)]
t/op/tr.t: add tr///c tests

The /c (complement) flag is almost completely untested. Indeed, for the
all non-utf8 case, nothing in core exercises a plain tr///c.

So this commit adds reasonably comprehensive tests for tr//c and variants
(/cs, /cd, /csd) where the search and replacement ranges are non-utf8, and
the string being matched may or may not be utf8.

A few tests are TODO for now as I've exposed some bugs - to be fixed
shortly.

6 years agoS_pmtrans(): always use op_private flag variables
David Mitchell [Mon, 8 Jan 2018 15:42:23 +0000 (15:42 +0000)]
S_pmtrans(): always use op_private flag variables

Various flag vars are set early on, such as:

    const I32 complement = o->op_private & OPpTRANS_COMPLEMENT;

but sometimes these vars weren't being used, and op_private was being
tested again.

6 years agoremove fossil debugging statement from do_trans()
David Mitchell [Tue, 26 Dec 2017 16:43:31 +0000 (16:43 +0000)]
remove fossil debugging statement from do_trans()

This:

    DEBUG_t( Perl_deb(aTHX_ "2.TBL\n"));

has been around in one form or another since perl1, but it makes no sense
since perl5,000, where -Dt now shows the name of the op being executed.

6 years agoS_pmtrans(): remove some whitespace
David Mitchell [Tue, 26 Dec 2017 17:11:01 +0000 (17:11 +0000)]
S_pmtrans(): remove some whitespace

Removal of MAD a long time ago left a couple of lines with very weird
indentation.

6 years agotr/// functions: add some basic code comments
David Mitchell [Tue, 26 Dec 2017 16:40:14 +0000 (16:40 +0000)]
tr/// functions: add some basic code comments

For the various C functions which implement the compile-time and
run-time aspects of OP_TRANS, add some basic code comments at the top of
each function explaining what its purpose is.

Also add lots of code comments to the body of S_pmtrans() (which compiles
a tr///).

Also comment what the OPpTRANS_ private flag bits mean.

No functional changes.

6 years agoFix original version of Socket in perldelta
Dagfinn Ilmari Mannsåker [Fri, 19 Jan 2018 11:17:13 +0000 (11:17 +0000)]
Fix original version of Socket in perldelta

The upgrade from 2.020_04 to 2.025 was not noted manually in
perldelta, since there was nothing particularly noteworthy in the
update, and the comment at the top of the section says this will
happen automatically as part of the release process.

6 years agoperldelta 60fa46621ae5d0d44c802aedc205274584701fa0
Zefram [Fri, 19 Jan 2018 06:38:07 +0000 (06:38 +0000)]
perldelta 60fa46621ae5d0d44c802aedc205274584701fa0

6 years agofix F0convert() on edge cases
Zefram [Fri, 19 Jan 2018 05:05:07 +0000 (05:05 +0000)]
fix F0convert() on edge cases

The F0convert() function used to implement the %.0f format specifier
more cheaply went wrong on some edge cases.  Its rounding went wrong
when the exponent is such that fractional values are not representable,
making the "+= 0.5" invoke floating point rounding.  Fix that by only
invoking that rounding logic for values that start out fractional.
That fixes the output part of [perl #47602].  It also failed to emit the
sign for negative zero.  Fix that by making it not apply to zero values.

6 years agoperldelta for 7d97880ddc4f275caa3eeab435a4f5a8cf601971
James E Keenan [Fri, 19 Jan 2018 03:26:35 +0000 (22:26 -0500)]
perldelta for 7d97880ddc4f275caa3eeab435a4f5a8cf601971

6 years agoSync Socket with CPAN (2.025 -> 2.027).
James E Keenan [Fri, 19 Jan 2018 03:05:45 +0000 (22:05 -0500)]
Sync Socket with CPAN (2.025 -> 2.027).

Addresses RT # 132737.

6 years agoGetting perldelta for 5.27.8 into shape.
Abigail [Fri, 19 Jan 2018 02:22:03 +0000 (03:22 +0100)]
Getting perldelta for 5.27.8 into shape.

6 years agoAdditional fix-ups for configure.com.
Craig A. Berry [Thu, 18 Jan 2018 21:59:09 +0000 (15:59 -0600)]
Additional fix-ups for configure.com.

Some things VMS doesn't have and one that it does.  All were
missing from the config.sh we generate.

6 years agooverride autodetection of mkostemp() on Darwin
Zefram [Thu, 18 Jan 2018 21:31:42 +0000 (21:31 +0000)]
override autodetection of mkostemp() on Darwin

On Darwin 15.6.0, mkostemp() was observed to be autodetected as present
but actually be unlinkable.  It is unknown what other Darwin versions
are affected, so for the time being just override the autodetection on
all versions.

6 years agoRevert "Revert "make PerlIO handle FD_CLOEXEC""
Zefram [Thu, 18 Jan 2018 21:23:55 +0000 (21:23 +0000)]
Revert "Revert "make PerlIO handle FD_CLOEXEC""

This reverts commit 523d71b314dc75bd212794cc8392eab8267ea744, reinstating
commit 2cdf406af42834c46ef407517daab0734f7066fc.  Reversion is not the
way to address the porting problem that motivated that reversion.

6 years agotick off release 5.27.7
Karen Etheridge [Thu, 18 Jan 2018 21:06:33 +0000 (13:06 -0800)]
tick off release 5.27.7

6 years agoCorrect pad.c pod: PadARRAY, not PAD_ARRAY
Father Chrysostomos [Thu, 18 Jan 2018 20:26:54 +0000 (12:26 -0800)]
Correct pad.c pod: PadARRAY, not PAD_ARRAY

6 years agoperl -Dr: avoid coredump in \1
David Mitchell [Thu, 18 Jan 2018 15:27:25 +0000 (15:27 +0000)]
perl -Dr: avoid coredump in \1

When displaying each reg node being executed, the code that dumps a REF
node assumed that a capture was valid if progs->offs[n].start != -1.
In fact during backtracking after a failure, a capture is "undone" by
merely setting progs->offs[n].end = -1.

So make the dump code account for that too.

This was causing a test in t/re/pat.t to coredump:

    use re qw(Debug EXECUTE);
    "x" =~ m{ () y | () \1 }x;

Although given that neither the test nor the REF code in regprop() have
changed recently, I'm not sure why this has only recently started crashing.

6 years agoRevert "make PerlIO handle FD_CLOEXEC"
Abigail [Thu, 18 Jan 2018 16:11:15 +0000 (17:11 +0100)]
Revert "make PerlIO handle FD_CLOEXEC"

This reverts commit 2cdf406af42834c46ef407517daab0734f7066fc.

The reason for the revert is that with this commit, perl fails to
compile on darwin (or at least, one some versions of it):

    ./miniperl -Ilib make_ext.pl lib/auto/DB_File/DB_File.bundle  MAKE="/Applications/Xcode.app/Contents/Developer/usr/bin/make" LIBPERL_A=libperl.a LINKTYPE=dynamic
    Parsing config.in...
    Looks Good.
    dyld: lazy symbol binding failed: Symbol not found: _mkostemp
      Referenced from: /private/tmp/perl/cpan/DB_File/../../miniperl
      Expected in: flat namespace

    dyld: Symbol not found: _mkostemp
      Referenced from: /private/tmp/perl/cpan/DB_File/../../miniperl
      Expected in: flat namespace

    Unsuccessful Makefile.PL(cpan/DB_File): code=5 at make_ext.pl line 518.
    make: *** [lib/auto/DB_File/DB_File.bundle] Error 2

6 years agoVMS does have sendmsg and recvmsg.
Craig A. Berry [Thu, 18 Jan 2018 03:55:57 +0000 (21:55 -0600)]
VMS does have sendmsg and recvmsg.

6 years agoVMS does have readv and writev.
Craig A. Berry [Thu, 18 Jan 2018 00:49:23 +0000 (18:49 -0600)]
VMS does have readv and writev.

6 years agoVMS does have mbrlen and mbrtowc.
Craig A. Berry [Wed, 17 Jan 2018 13:09:52 +0000 (07:09 -0600)]
VMS does have mbrlen and mbrtowc.

6 years agofix perlipc example regarding process group
Zefram [Thu, 18 Jan 2018 03:05:10 +0000 (03:05 +0000)]
fix perlipc example regarding process group

Fixes [perl #54412].

6 years ago(perl #131878) don't call croak() with a potential format string
Tony Cook [Thu, 12 Oct 2017 03:51:23 +0000 (14:51 +1100)]
(perl #131878) don't call croak() with a potential format string

Since this has security implications, explain the change in
perldelta.

6 years agoexpand documentation of $DB::sub
Zefram [Wed, 17 Jan 2018 23:07:06 +0000 (23:07 +0000)]
expand documentation of $DB::sub

6 years agodocument that argv strings must be writable for $0
Zefram [Wed, 17 Jan 2018 21:44:15 +0000 (21:44 +0000)]
document that argv strings must be writable for $0

Resolves [perl #44129].

6 years agoremove unused constant from test
Zefram [Wed, 17 Jan 2018 21:05:25 +0000 (21:05 +0000)]
remove unused constant from test

6 years agoskip cwd_enoent test on Cygwin
Zefram [Wed, 17 Jan 2018 21:03:00 +0000 (21:03 +0000)]
skip cwd_enoent test on Cygwin

Some of the getcwd() functions don't produce error responses when they
should on Cygwin, which is [perl #132733], and that causes cwd_enoent.t
to fail.  Pending actual fix of that bug, just skip this test on Cygwin.
This should allow [perl #132648] to be resolved.

6 years agohandy.h: Add comment
Karl Williamson [Tue, 16 Jan 2018 23:55:07 +0000 (16:55 -0700)]
handy.h: Add comment

6 years agoperlapi: Clarification
Karl Williamson [Mon, 15 Jan 2018 03:26:44 +0000 (20:26 -0700)]
perlapi: Clarification

6 years agore/pat_psycho.t: Allow override of watchdog timer count
Karl Williamson [Wed, 17 Jan 2018 18:48:48 +0000 (11:48 -0700)]
re/pat_psycho.t: Allow override of watchdog timer count

Like re/fold_grind.t, this test can take a long time to execute.  A
timer was added to keep the test suite running along.  But sometimes we
want to allow extra time for this test to complete, and this commit adds
the same mechanism that fold_grind already has, an environment variable,
PERL_TEST_TIME_OUT_FACTOR, that can be set to increase the watchdog
time.

6 years agoPPPort: silence a recent compiler warning
David Mitchell [Wed, 17 Jan 2018 14:15:11 +0000 (14:15 +0000)]
PPPort: silence a recent compiler warning

RealPPPort.c: In function ‘XS_Devel__PPPort_die_sv’:
RealPPPort.xs:1522:9: warning: variable ‘op’ set but not used [-Wunused-but-set-variable]
     OP *op;

6 years agoperldelta for 57bd660029
Tony Cook [Wed, 17 Jan 2018 01:01:03 +0000 (12:01 +1100)]
perldelta for 57bd660029

6 years ago(perl #131954) don't initialize mark before a possible move of the stack
Tony Cook [Thu, 24 Aug 2017 05:52:33 +0000 (15:52 +1000)]
(perl #131954) don't initialize mark before a possible move of the stack

6 years agoadditional test for lazy array element creation
Zefram [Tue, 16 Jan 2018 18:45:40 +0000 (18:45 +0000)]
additional test for lazy array element creation

6 years agotest for IO handle in localised glob
Zefram [Tue, 16 Jan 2018 18:08:57 +0000 (18:08 +0000)]
test for IO handle in localised glob

Tests the case in [perl #16113] that failed prior to Perl 5.19.10.

6 years agoFix -> inside C<> in perl58[89]delta
Dagfinn Ilmari Mannsåker [Tue, 16 Jan 2018 16:19:13 +0000 (16:19 +0000)]
Fix -> inside C<> in perl58[89]delta

6 years agoFix stray > in L<perlapi/sv_usepvn_flags>
Dagfinn Ilmari Mannsåker [Tue, 16 Jan 2018 16:18:24 +0000 (16:18 +0000)]
Fix stray > in L<perlapi/sv_usepvn_flags>

6 years agoFix broken POD markup in perlapi/Pad Data Structures
Dagfinn Ilmari Mannsåker [Tue, 16 Jan 2018 15:55:38 +0000 (15:55 +0000)]
Fix broken POD markup in perlapi/Pad Data Structures

6 years agofix parsing of braced subscript after parens
Zefram [Tue, 16 Jan 2018 08:04:08 +0000 (08:04 +0000)]
fix parsing of braced subscript after parens

Where an arrow is omitted between subscripts, if a parenthesised
subscript is followed by a braced one, PL_expect was getting set to
XBLOCK due to code intended for "foreach (...) {...}".  This broke
bareword autoquotation, and the parsing of operators following the
braced subscript.  Alter PL_expect from XBLOCK to XOPERATOR following
a parenthesised subscript.  Fixes [perl #8045].

6 years agovivify array elements when putting them on stack
Zefram [Tue, 16 Jan 2018 06:22:17 +0000 (06:22 +0000)]
vivify array elements when putting them on stack

When the elements of an array are put on the stack, by a padav, rv2av,
or padrange op, null pointers in the AvARRAY were being pushed as
&PL_sv_undef, which was OK in rvalue contexts but caused misbehaviour
in lvalue contexts.  Change this to vivify these elements.  There's no
attempt here to limit the vivification to lvalue contexts: the existing
op flags aren't enough to detect \(@a), and attempting to catch all
cases where a new flag needs to be set would be an error-prone process.
Fixes [perl #8910].

6 years agocorrect error returns from fast_abs_path()
Zefram [Tue, 16 Jan 2018 05:16:41 +0000 (05:16 +0000)]
correct error returns from fast_abs_path()

fast_abs_path() is documented as behaving like abs_path(), and is even
used as the main version of abs_path() on Cygwin, so it should indicate
errors in the same manner.  It was croaking; change this to return undef
with $! set.  Leave croaking for the error that breaks the abs_path()
rules, where fast_abs_path() has changed cwd and fails to change back.
Problem noted on [perl #132648].

6 years agoSet more sensible -O optimization on FreeBSD origin/tonyc/132704-freebsd-optimize
Tom Hukins [Wed, 10 Jan 2018 18:53:24 +0000 (18:53 +0000)]
Set more sensible -O optimization on FreeBSD

FreeBSD's /usr/share/mk/sys.mk specifies -O2 for architectures other
than arm and mips.  By default, compile perl with the same optimization
levels.

6 years ago(perl #132533) updates to Devel::PPPort
Tony Cook [Mon, 15 Jan 2018 23:56:37 +0000 (10:56 +1100)]
(perl #132533) updates to Devel::PPPort

6 years ago(perl #132533) bump $Devel::PPPort::VERSION
Tony Cook [Mon, 15 Jan 2018 23:28:53 +0000 (10:28 +1100)]
(perl #132533) bump $Devel::PPPort::VERSION

6 years ago(perl #132533) add missing generated file updates
Tony Cook [Mon, 15 Jan 2018 23:18:51 +0000 (10:18 +1100)]
(perl #132533) add missing generated file updates

6 years agoFix test warning: Use of uninitialized value
Pali [Sun, 3 Dec 2017 16:42:14 +0000 (17:42 +0100)]
Fix test warning: Use of uninitialized value

Function ok() compares values as strings which leads to stringification of
undef and throwing warning.

6 years agoFix security problem: CWE-134: Use of Externally-Controlled Format String
Pali [Sun, 3 Dec 2017 16:02:53 +0000 (17:02 +0100)]
Fix security problem: CWE-134: Use of Externally-Controlled Format String

Function croak() takes printf-like formatted string, so passing arbitrary
char* can leads to buffer overflow. Use croak_sv() which is now available
and avoids converting SV* to char*.

6 years agoUse croak_sv in threads
Pali [Sun, 3 Dec 2017 16:01:10 +0000 (17:01 +0100)]
Use croak_sv in threads

Now when croak_sv is available, there is no need to use croak() with SV* to
char* conversion.

6 years agoImplement mess
Pali [Sun, 3 Dec 2017 15:57:46 +0000 (16:57 +0100)]
Implement mess

This patch provides implementation of the following functions:
croak_sv, die_sv, mess_sv, warn_sv, mess, vmess, warn_nocontext,
croak_nocontext, croak_no_modify, croak_memory_wrap, croak_xs_usage

TonyC: add parts/inc/mess to MANIFEST

6 years agoAvoid some branches
Karl Williamson [Sat, 13 Jan 2018 22:40:34 +0000 (15:40 -0700)]
Avoid some branches

This replaces some looping with branchless code in two places: looking
for the first UTF-8 variant byte in a string (which is used under
several circumstances), and looking for an ASCII or non-ASCII character
during pattern matching.

Recent commits have changed these operations to do word-at-a-time look-
ups, essentially vectorizing the problem into 4 or 8 parallel probes.
But when the word is found which contains the desired byte, until this
commit, that word would be scanned byte-at-a-time in a loop.

I found some bit hacks on the internet, which when stitched togther, can
find the first desired byte in the word without branching, while doing
this while the word is still loaded, without having to load each byte.

6 years agoinline.h: Add comment.
Karl Williamson [Mon, 15 Jan 2018 22:15:14 +0000 (15:15 -0700)]
inline.h: Add comment.

6 years agoperldiag: miscapitalization
Father Chrysostomos [Mon, 15 Jan 2018 20:59:27 +0000 (12:59 -0800)]
perldiag: miscapitalization

6 years agoSort perldiag
Father Chrysostomos [Mon, 15 Jan 2018 20:57:41 +0000 (12:57 -0800)]
Sort perldiag

6 years agoVMS does have fchmod and fchown.
Craig A. Berry [Sun, 14 Jan 2018 19:42:05 +0000 (13:42 -0600)]
VMS does have fchmod and fchown.

The test for fchmod in t/io/fs.t does, however, reveal a wrinkle
that is also true of chmod on VMS: a mode argument of zero does
not mean turn off all permisions but rather set permissions to the
user's default.  This is probably an ancient behavior from
pre-standard days.  For now, just skip the affected test and
document what's different.

6 years agoregexec.c: Complement the correct operand
Karl Williamson [Mon, 15 Jan 2018 03:40:54 +0000 (20:40 -0700)]
regexec.c: Complement the correct operand

This was complementing the & mask which looks like 0x808080...
hence anding 0x7f7f7f... which is TRUE for all operands execpt the
0x808080....  It is being used to scan a string to find an ASCII
character, so it would return TRUE inappropriately, but never wrongly
returning FALSE.  Since the result is then checked for matching, this
didn't actually cause an error; just unnecessary work.

6 years agoperllocale: Wording/formatting nits
Karl Williamson [Mon, 15 Jan 2018 03:14:50 +0000 (20:14 -0700)]
perllocale: Wording/formatting nits

6 years agoperllocale: Fix typo
Karl Williamson [Sun, 14 Jan 2018 18:44:22 +0000 (11:44 -0700)]
perllocale: Fix typo

6 years agoDevel-PPPort: Rmv impediment to compiling under C++11
Karl Williamson [Sat, 19 Nov 2016 12:57:46 +0000 (05:57 -0700)]
Devel-PPPort: Rmv impediment to compiling under C++11

C++11 changed from earlier versions to require space between the end of
a string literal and a macro, so that a feature can unambiguously be
added to the language.  Starting in g++ 6.2, the compiler emits a
deprecation warning when there isn't a space (presumably so that future
versions can support C++11).

Although not required by the C++11 change, this patch also makes sure
there is space after a macro call, before a string literal.

Code and modules included with the Perl core need to be compilable using
C++.  This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.)  So we need to accommodate
changes to the C++ language.