This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
6 years agoregexec.c: Save a conditional per iteration
Karl Williamson [Wed, 27 Dec 2017 00:32:10 +0000 (17:32 -0700)]
regexec.c: Save a conditional per iteration

This commit changes two places where to use a mask instead of a
condition in loops implementing things like /a+/, which can potentially
iterate many times.

This arises under /i matching where we accept either an 'A' or an 'a'
for example.  In most cases, the case folds differ in only a single bit,
so we can mask that bit out during comparisons, yielding two possible
characters, precisely the ones we are interested in.  This means we
don't have to test for the character being 'A', then test for it being
'a'.  We can accomplish this in one conditional.

6 years agoperlre: Note a way to continue long regexes across lines
Karl Williamson [Wed, 27 Dec 2017 01:00:57 +0000 (18:00 -0700)]
perlre: Note a way to continue long regexes across lines

This documents a usage to include \n chars within (?#\n) to easily
break long patterns into smaller chunks that fit on a line.  I was not
familiar with this technique until I saw it used, in some of our core
code, so am documenting it for others.

6 years agoSkip failing exit(0) tests on VMS.
Craig A. Berry [Fri, 29 Dec 2017 22:30:23 +0000 (16:30 -0600)]
Skip failing exit(0) tests on VMS.

It turns out VMS does not have the [perl #2754] bug.  When a call
to Perl_my_exit(0) is made from one of the blocks processed during
perl_parse, STATUS_ALL_SUCCESS sets PL_statusvalue_vms to 1. This
is the value that becomes the return value of perl_parse via
STATUS_EXIT.  That return value, when non-zero, means perl_run is
skipped.  Which seems to be the desired behavior, i.e., exit(0)
from BEGIN, CHECK, and UNITCHECK does actually exit.

The fix on Unix has been rolled back in 857320cbf85e762add18885ae8
temporarily because Module::Install was depending on the bug.  It
doesn't seem worth trying to write a compatible bug for VMS, so
just skip the tests that are enforcing the buggy behavior.

6 years agoperldelta for smartmatch reversion
Zefram [Fri, 29 Dec 2017 13:51:29 +0000 (13:51 +0000)]
perldelta for smartmatch reversion

6 years agorevert smartmatch to 5.27.6 behaviour
Zefram [Fri, 29 Dec 2017 12:39:31 +0000 (12:39 +0000)]
revert smartmatch to 5.27.6 behaviour

The pumpking has determined that the CPAN breakage caused by changing
smartmatch [perl #132594] is too great for the smartmatch changes to
stay in for 5.28.

This reverts most of the merge in commit
da4e040f42421764ef069371d77c008e6b801f45.  All core behaviour and
documentation is reverted.  The removal of use of smartmatch from a couple
of tests (that aren't testing smartmatch) remains.  Customisation of
a couple of CPAN modules to make them portable across smartmatch types
remains.  A small bugfix in scope.c also remains.

6 years agomake experimental.pm test agnostic about switch
Zefram [Fri, 29 Dec 2017 12:19:49 +0000 (12:19 +0000)]
make experimental.pm test agnostic about switch

Anticipating imminent reversion of smartmatch behaviour, make
experimental.pm able to test against either version of the switch feature,
detecting empirically which version the running perl supports.

6 years agomake autodie more agnostic about smartmatch
Zefram [Fri, 29 Dec 2017 12:16:52 +0000 (12:16 +0000)]
make autodie more agnostic about smartmatch

Instead of saying that smartmatch lhs overloading no longer works, say
that it is likely to not work in the future.  This makes it accurate for
the upcoming reversion of smartmatch behaviour, while remaining usefully
open to this kind of smartmatch change in the future.

6 years agominor grammar and punctuation fixes
Karen Etheridge [Fri, 29 Dec 2017 03:29:15 +0000 (19:29 -0800)]
minor grammar and punctuation fixes

6 years agoRemove unused AUTOGEN_FILES Makefile variable
Dagfinn Ilmari Mannsåker [Thu, 28 Dec 2017 18:12:56 +0000 (18:12 +0000)]
Remove unused AUTOGEN_FILES Makefile variable

Commit 36bb303b6ac55df9c2780b48d374c505374dc378 moved the chmod +w that
the variable was used for into regen.pl, but failed to remove the
variable.  The regenerated files are already listed in the comment
above (including which script generates them), so the variable doesn't
even have any informational value, it's just a maintenance burden.

6 years agoSimplify Unicode::UCD::openunicode() and callers
Dagfinn Ilmari Mannsåker [Thu, 28 Dec 2017 17:24:43 +0000 (17:24 +0000)]
Simplify Unicode::UCD::openunicode() and callers

Get rid of the file-global filehandles and the unused filename return
value, instead return the filehandle and assign it to a lexical
variable.  Also don't bother checking the return value; it croaks on
failure anyway.

In passing, eliminate erroneous assignment of {} to %CASESPEC for
Unicode < 2.1.8.

6 years agoFix typo in POD for new Unicode::UCD::num() variant
Dagfinn Ilmari Mannsåker [Thu, 28 Dec 2017 15:14:48 +0000 (15:14 +0000)]
Fix typo in POD for new Unicode::UCD::num() variant

6 years agoFix Pod::Html for EBCDIC
Karl Williamson [Thu, 28 Dec 2017 04:39:50 +0000 (21:39 -0700)]
Fix Pod::Html for EBCDIC

Commit 38e30ca7507a601c2d84596bc51d88c0f3c516b4 introduced a
non-portable regular expression pattern which breaks the module on
EBCDIC.

Any range whose endpoints aren't both digits, both uppercase or both
lowercase will not work on EBCDIC.  /[^ -~]/ can more legibly and
portably be written as /[[:^print:]]/a, which is what this commit does.

6 years agot/op/exec.t: Use diag for errors, so not swallowed
Karl Williamson [Thu, 28 Dec 2017 04:32:33 +0000 (21:32 -0700)]
t/op/exec.t: Use diag for errors, so not swallowed

This test was just doing a printf to STDOUT.

6 years agoFix t/comp/parser_run.t for EBCDIC
Karl Williamson [Thu, 28 Dec 2017 01:55:13 +0000 (18:55 -0700)]
Fix t/comp/parser_run.t for EBCDIC

Commit 36000cd1c47863d8412b285701db7232dd450239 added a test which isn't
portable to EBCDIC, using \xD5.  The is "N" on EBCDIC platforms, whereas
a non-alphabetic character was intended.

Change to use \xB6 which means paragraph sign on both character sets.

6 years agolib/utf8.pm: Further clarification of UTF-8 flavor
Karl Williamson [Thu, 28 Dec 2017 01:34:35 +0000 (18:34 -0700)]
lib/utf8.pm: Further clarification of UTF-8 flavor

Commit 50a85cfe6c852deb0c2f738cb82006623052dc8e clarified that this
module uses Perl's extended UTF-8, but missed the mention fixed in this
commit.

6 years agoPOD fix for perlop
Scott Lanning [Thu, 23 Nov 2017 18:33:13 +0000 (19:33 +0100)]
POD fix for perlop

Commit 33be4c6111bea619c1662 added a line in pod/perlop.pod
for a new Non-capture mode modifier to qr//.
The 2nd paragraph below that line said:

  The last four modifiers listed above, added in Perl 5.14,
  control the character set rules, but C</a> is the only one
  you are likely to want to specify explicitly; the other three
  are selected automatically by various pragmas.

Since the "n" line was added, that paragraph no longer makes sense.  I
changed it to refer to the modifiers explicitly instead of the last four
lines. (An alternative would be to move the "n" line above the other
four.)

6 years agoUnicode::UCD: Add optional paramter to num()
Karl Williamson [Wed, 27 Dec 2017 20:50:43 +0000 (13:50 -0700)]
Unicode::UCD: Add optional paramter to num()

As discussed in http://nntp.perl.org/group/perl.perl5.porters/244444,
this sets the optional scalar ref paramater to the length of the valid
initial portion of the first parameter passed to num().  This is useful
in teasing apart why the input is invalid.

6 years agopostpone perl_parse() exit(0) bugfix
Zefram [Wed, 27 Dec 2017 21:13:59 +0000 (21:13 +0000)]
postpone perl_parse() exit(0) bugfix

Commit 0301e899536a22752f40481d8a1d141b7a7dda82 fixed a long-standing
bug regarding exit(0) during perl_parse().  This turned out to cause
enough trouble to Module::Install, which accidentally relies on the
bug, that the pumpking wants more time to roll out the fix to affected
CPAN distros.  So make perl_parse() once again return 0 for an exit(0).
Reintroduces [perl #2754]; addresses [perl #132577].

6 years agoRemove unused interpreter variable
Karl Williamson [Tue, 26 Dec 2017 19:59:52 +0000 (12:59 -0700)]
Remove unused interpreter variable

This somehow became unused or never got used; I didn't do the research.

6 years agoUpdate META.json after JSON-PP update
Chris 'BinGOs' Williams [Tue, 26 Dec 2017 13:50:56 +0000 (13:50 +0000)]
Update META.json after JSON-PP update

6 years agoUpdate JSON-PP to CPAN version 2.97001
Chris 'BinGOs' Williams [Tue, 26 Dec 2017 13:49:11 +0000 (13:49 +0000)]
Update JSON-PP to CPAN version 2.97001

  [DELTA]

2.97001 to be released
    - tweak internal number detector to always considers a flagged
      value as a string (GH#35, haarg++)
    - clarify json_pp options (RT-123766; Dan Jacobson)

6 years agoUpdate podlators to CPAN version 4.10
Chris 'BinGOs' Williams [Tue, 26 Dec 2017 13:48:01 +0000 (13:48 +0000)]
Update podlators to CPAN version 4.10

  [DELTA]

podlators 4.10 (2017-12-25)

    [Pod::Man] Change man page references and function names to bold
    instead of italic, following the current Linux man page standard.  The
    previous formatting was taken from Solaris, and it seems safe to say
    that the Linux man page formatting conventions are now much more
    widely followed than Solaris's.  Patch from Guillem Jover.

    [Pod::Man] Revert the .IX handling code to the earlier version from
    Bjarni Ingi Gislason but add the trailing backslashes that should
    hopefully avoid blank page issues on HP-UX.  This fixes a warning
    regression when man is run with warnings enabled.  (Debian Bug#847972)

    [Pod::Man] Wrap the output file descriptor in a glob before passing it
    to PerlIO::get_layers so that the layer check works properly.
    Previously, this code would throw a warning if given a scalar not
    wrapped in a glob and not detect layers properly.  Patch from Zefram.
    (#122521)

    Produce a proper diagnostic when given empty input on standard input
    with no other arguments to pod2man or pod2text.  Reported by Guillem
    Jover.

6 years agoUpdate Time-HiRes to CPAN version 1.9750
Chris 'BinGOs' Williams [Tue, 26 Dec 2017 13:44:59 +0000 (13:44 +0000)]
Update Time-HiRes to CPAN version 1.9750

  [DELTA]

1.9750 [2017-12-22]
 - update META.yml and META.json for XSLoader instead of DynaLoader
   [rt.cpan.org #123933]

1.9749 [2017-12-21]
 - CPAN release
 - Quieten Time-HiRes test noise: blead 0f009486
 - Switch some core modules to XSLoader: blead b9a5a78f [rt.cpan.org #129789]
 - disable a flapping test for CI: blead cd2a978d
 - Avoid newGVgen in blead-upstream modules: blead 732d3893
 - Declaration after statement in typemap: blead d269f586
 - semicolon-friendly diagnostic control: blead 7347ee54
 - in macOS (OS X) check properly in runtime whether futimens()
   and utimensat() are available

1.9748 [2017-12-16]
 - bleadperl only
 - semicolon-friendly diagnostic control: blead 7347ee54

1.9747 [2017-09-13]
 - bleadperl only
 - Switch some core modules to XSLoader: blead b9a5a78f [rt.cpan.org #129789]

6 years agoavoid infinite recursion in _perl_abs_path()
Zefram [Tue, 26 Dec 2017 07:46:35 +0000 (07:46 +0000)]
avoid infinite recursion in _perl_abs_path()

If _perl_abs_path() couldn't opendir("..") then it would call
File::Spec->rel2abs, which was liable to call back to Cwd::getcwd() and
thus to _perl_abs_path(), producing an infinite recursion.  The call to
File::Spec->rel2abs is of dubious value anyway, so just turn that into
an error return.  Fixes [perl #132651].

6 years agoUpdate Digest-SHA to CPAN version 6.01
Chris 'BinGOs' Williams [Mon, 25 Dec 2017 19:33:02 +0000 (19:33 +0000)]
Update Digest-SHA to CPAN version 6.01

  [DELTA]

6.01  Mon Dec 25 00:08:08 MST 2017
  - added "--ignore-missing" and "--strict" options to shasum
    -- consistent with GNU coreutils
    -- ref. rt.cpan.org #123897
  - removed PERL_CORE preambles from test scripts
    -- preambles no longer needed for core testing
    -- thanks to Chris Williams for patch
    -- ref. rt.cpan.org #123863

6 years agoregcomp.c: White-space only
Karl Williamson [Mon, 25 Dec 2017 00:12:56 +0000 (17:12 -0700)]
regcomp.c: White-space only

6 years agoregcomp.h: Add comment
Karl Williamson [Mon, 25 Dec 2017 00:11:29 +0000 (17:11 -0700)]
regcomp.h: Add comment

6 years agomutlitconcat: fix non-folding adjacent consts
David Mitchell [Mon, 25 Dec 2017 10:40:58 +0000 (10:40 +0000)]
mutlitconcat: fix non-folding adjacent consts

RT ##132646

v5.27.6-120-gbcc30fd changed multiconcat so that adjacent constants
weren't folded, so that ($overloaded . "a" . "b") is invoked as
    $overloaded->concat("a")->concat("b")
rather than
    $overloaded->concat("ab")

It did this by 'demoting' every second adjacent const as a real arg rather
than adding it to the const string. However, that could leave a
multiconcat op with more than the maximum allowed args.

So include demotion candidates as part of the arg count.

6 years agodisable cwd_enoent test
Zefram [Mon, 25 Dec 2017 06:07:26 +0000 (06:07 +0000)]
disable cwd_enoent test

This test, running getcwd() when cwd is an unlinked directory, was
observed to cause an infinite memory-eating loop on FreeBSD.  As a
temporary measure it must be disabled.  [perl #132651]

6 years agoAdd script_run to perlexperiment
Karl Williamson [Mon, 25 Dec 2017 00:28:55 +0000 (17:28 -0700)]
Add script_run to perlexperiment

6 years agoMerge branch 'Add script_run feature' into blead
Karl Williamson [Mon, 25 Dec 2017 00:21:34 +0000 (17:21 -0700)]
Merge branch 'Add script_run feature' into blead

6 years agoAdd script_run regex feature
Karl Williamson [Sun, 24 Dec 2017 06:15:37 +0000 (23:15 -0700)]
Add script_run regex feature

As explained in the docs, this helps detect spoofing attacks.

6 years agoregcomp.sym: Add nodes for script runs
Karl Williamson [Mon, 18 Dec 2017 22:13:48 +0000 (15:13 -0700)]
regcomp.sym: Add nodes for script runs

To be used in the implementation thereof.

6 years agoAdd warning for script runs being experimental
Karl Williamson [Mon, 18 Dec 2017 22:12:17 +0000 (15:12 -0700)]
Add warning for script runs being experimental

This will be used in later commits.

6 years agoregen/mk_invlists.pl: Generate tables for scx property
Karl Williamson [Sat, 23 Dec 2017 22:15:00 +0000 (15:15 -0700)]
regen/mk_invlists.pl: Generate tables for scx property

6 years agomktables: Generate _Perl_SCX property
Karl Williamson [Sat, 23 Dec 2017 22:08:45 +0000 (15:08 -0700)]
mktables: Generate _Perl_SCX property

6 years agoUnicode::UCD.pm Add undocumented internal feature
Karl Williamson [Sat, 23 Dec 2017 21:45:02 +0000 (14:45 -0700)]
Unicode::UCD.pm Add undocumented internal feature

This allows charprop() to be called on a Perl-internal-only property

6 years agomktables: Canonicalize '-' into '_'
Karl Williamson [Sat, 23 Dec 2017 21:37:37 +0000 (14:37 -0700)]
mktables: Canonicalize '-' into '_'

Some early Unicode releases used a hyphen instead of an underscore in
script names.  This changes all into underscores

6 years agoregen/mk_invlists.pl: Don't generate unneeded #define
Karl Williamson [Sat, 23 Dec 2017 20:34:47 +0000 (13:34 -0700)]
regen/mk_invlists.pl: Don't generate unneeded #define

This was only defined in regexec.c, but is currently unused

6 years agoregen/mk_invlists.pl: Add support of 'sl' formats
Karl Williamson [Sat, 23 Dec 2017 22:25:57 +0000 (15:25 -0700)]
regen/mk_invlists.pl: Add support of 'sl' formats

This commit adds support of creating an inversion map for properties
that are represented by 'sl' formats, that is strings, but some elements
are references to arrays of strings, each subelement thereof is a
possible match.

6 years agoregen/mk_invlists.pl: Simplify handling of early Unicode releases
Karl Williamson [Sat, 23 Dec 2017 19:39:16 +0000 (12:39 -0700)]
regen/mk_invlists.pl: Simplify handling of early Unicode releases

Several Unicode properties are used internally in regex matching, for
example \b{wb} and \X.  The code is supposed to compile and work as best
it can on all Unicode releases.  But the rules for these have been
expanded by Unicode over the years, including new types of boundary
conditions.  Each such type is given an enum value in an enum type for
the given boundary.  For early Unicodes, this enum isn't present.

This commit simplifies how this generating code copes with this,
removing the hard-coded lists in favor of using a different mechanism
already in place for handling slightly different circumstances.

6 years agoregen/mk_invlists.pl: Add defensive check
Karl Williamson [Sat, 23 Dec 2017 20:05:58 +0000 (13:05 -0700)]
regen/mk_invlists.pl: Add defensive check

The code assumes a list has been set up with a particular ending point
that isn't obvious.  Check for that, and die if incorrect.

6 years agoregen/mk_invlists.pl: Fix name clash handler
Karl Williamson [Sat, 23 Dec 2017 17:24:16 +0000 (10:24 -0700)]
regen/mk_invlists.pl: Fix name clash handler

This code increments a string (like 'a' goes to 'b') when it detects a
possible name clash.  But it turns out that the perl magic ++ operator
doesn't get invoked on strings that contain an underscore.  Fix by
splitting on the '_', and incrementing the final portion.

6 years agocorrect error returns from _perl_abs_path()
Zefram [Sun, 24 Dec 2017 11:09:54 +0000 (11:09 +0000)]
correct error returns from _perl_abs_path()

The perl implementation of abs_path(), and hence of getcwd(), was
returning an empty string on error, and sending a diagnostic to stderr.
The diagnostic for failing to find a directory in its parent included a
bogus $! value.  This differed from the XS version, which returns undef
with $! set appropriately.  The documentation, not explicit on the topic,
suggests that errors should be signalled more like what the XS was doing.

Resolve the discrepancy by changing the perl implementation to signal
errors by returning undef with $! set appropriately.  Document getcwd()
and abs_path() as doing this.

Fixes [perl #132648].

6 years agodescribe encoding status of DATA handle
Zefram [Sat, 23 Dec 2017 16:02:51 +0000 (16:02 +0000)]
describe encoding status of DATA handle

6 years agobetter document while condition magic
Zefram [Sat, 23 Dec 2017 11:50:52 +0000 (11:50 +0000)]
better document while condition magic

The operators affected by while-condition magic variously didn't mention
the implicit "defined" part of the magic or didn't mention it at all.
In perlsyn.pod there was a partial mention of the magic in the context
of the "for" loop, but none for the "while" loop.  Describe the magic
more fully on both ends.  [perl #132644]

6 years agobetter doc of hash/array iterators
Zefram [Sat, 23 Dec 2017 10:57:51 +0000 (10:57 +0000)]
better doc of hash/array iterators

Expand L<perlfunc/each> with slightly more explicit description of the
sharing of iterator state, and with caveats regarding the fragility of
while-each loops.  [perl #132644]

6 years agonarrow scope of argsv in sv_vcatpvfn_flags()
Zefram [Sat, 23 Dec 2017 09:07:50 +0000 (09:07 +0000)]
narrow scope of argsv in sv_vcatpvfn_flags()

argsv was being retained between format specifiers, causing incorrect
treatment of format specifiers following one that took an SV argument.
Fixes [perl #132645].

6 years agomake false whereso yield undef in scalar context
Zefram [Sat, 23 Dec 2017 05:47:55 +0000 (05:47 +0000)]
make false whereso yield undef in scalar context

Fixes [perl #132634].

6 years agoutf8.pm: Clarify that UTF-8 is Perl's extended form
Karl Williamson [Fri, 22 Dec 2017 19:32:12 +0000 (12:32 -0700)]
utf8.pm: Clarify that UTF-8 is Perl's extended form

Spotted by Christian Hansen

6 years agomerge branch zefram/cloexec
Zefram [Fri, 22 Dec 2017 16:52:35 +0000 (16:52 +0000)]
merge branch zefram/cloexec

6 years agoperldelta for FD_CLOEXEC changes
Zefram [Fri, 22 Dec 2017 16:48:31 +0000 (16:48 +0000)]
perldelta for FD_CLOEXEC changes

6 years agotest that open()ed filehandles are close-on-exec
Zefram [Fri, 22 Dec 2017 15:45:45 +0000 (15:45 +0000)]
test that open()ed filehandles are close-on-exec

6 years agoset FD_CLOEXEC on debug-leaking-scalars sockets
Zefram [Fri, 22 Dec 2017 15:27:19 +0000 (15:27 +0000)]
set FD_CLOEXEC on debug-leaking-scalars sockets

6 years agomask off SOCK_CLOEXEC in socketpair() emulation
Zefram [Fri, 22 Dec 2017 15:23:11 +0000 (15:23 +0000)]
mask off SOCK_CLOEXEC in socketpair() emulation

In the unlikely situation that we have SOCK_CLOEXEC but are emulating
socketpair(), having the bit set could confuse the emulation.  It's not
worth actually implementing SOCK_CLOEXEC logic for this situation, so
just mask it off.  The higher-level logic of PerlSock_socketpair_cloexec()
will handle the bit being ineffective.

6 years agomake PerlIO handle FD_CLOEXEC
Zefram [Fri, 22 Dec 2017 15:20:26 +0000 (15:20 +0000)]
make PerlIO handle FD_CLOEXEC

Move handling of close-on-exec flag for PerlIO handles into PerlIO itself.
Where PerlIO opens new file descriptors, have them opened in O_CLOEXEC
mode where possible.

6 years agoset FD_CLOEXEC on PL_perlio_debug_fd
Zefram [Wed, 20 Dec 2017 04:29:29 +0000 (04:29 +0000)]
set FD_CLOEXEC on PL_perlio_debug_fd

There's clearly no intent for this to be inherited across exec.

6 years agouse O_CLOEXEC when making fake empty device
Zefram [Wed, 20 Dec 2017 04:05:23 +0000 (04:05 +0000)]
use O_CLOEXEC when making fake empty device

6 years agoPerl_my_mkstemp_cloexec() function
Zefram [Tue, 19 Dec 2017 19:00:07 +0000 (19:00 +0000)]
Perl_my_mkstemp_cloexec() function

Like the other "_cloexec" I/O functions, this guarantees to return a
file descriptor with FD_CLOEXEC set, and will set the flag atomically
if possible.

6 years agouse Perl_my_mkstemp() where appropriate
Zefram [Tue, 19 Dec 2017 18:50:32 +0000 (18:50 +0000)]
use Perl_my_mkstemp() where appropriate

Since commit e48855bdd2fc57fc51156f5e4b8dee6b544456c8 there has been
no need to be conditional about using mkstemp().  Perl_my_mkstemp()
is always available, one way or another.

6 years agoportable Perl_my_mkostemp()
Zefram [Tue, 19 Dec 2017 18:32:05 +0000 (18:32 +0000)]
portable Perl_my_mkostemp()

Akin to the existing Perl_my_mkstemp(), Perl_my_mkostemp() is defined
as a macro for mkostemp() where available, and otherwise as our own
implementation of it.  The guts of our own implementations of the two
functions are shared.  Perl_my_mkostemp() is not guaranteed to handle
O_CLOEXEC: that depends on open() handling it.

6 years agoconfigure probe for mkostemp()
Zefram [Tue, 19 Dec 2017 17:43:21 +0000 (17:43 +0000)]
configure probe for mkostemp()

This is another file descriptor creating function that's needed as an
O_CLOEXEC-handling variant of an existing function.

6 years agoremove broken PerlLIO_mkstemp() definition
Zefram [Tue, 19 Dec 2017 17:12:33 +0000 (17:12 +0000)]
remove broken PerlLIO_mkstemp() definition

This was only defined in non-PERL_IMPLICIT_SYS mode, and not used
anywhere.

6 years agofactor out remaining fcntl F_SETFD calls
Zefram [Tue, 19 Dec 2017 17:11:25 +0000 (17:11 +0000)]
factor out remaining fcntl F_SETFD calls

6 years agoset FD_CLOEXEC atomically in easy cases
Zefram [Tue, 19 Dec 2017 16:53:39 +0000 (16:53 +0000)]
set FD_CLOEXEC atomically in easy cases

In many places where a file descriptor is being opened, open it with
FD_CLOEXEC already set if possible.  This commit covers the easy cases,
where the file descriptor arises without the use of PerlIO, pp_open,
or my_popen.

6 years ago*_cloexec() I/O functions
Zefram [Tue, 19 Dec 2017 09:38:37 +0000 (09:38 +0000)]
*_cloexec() I/O functions

New functions PerlLIO_dup_cloexec(), PerlLIO_dup2_cloexec(),
PerlLIO_open_cloexec(), PerlLIO_open3_cloexec(), PerlProc_pipe_cloexec(),
PerlSock_socket_cloexec(), PerlSock_accept_cloexec(), and
PerlSock_socketpair_cloexec() each do the same thing as their
"_cloexec"-less counterpart, but return with the FD_CLOEXEC flag set on
each new file descriptor.  They set the flag atomically as part of the
file descriptor creation syscall where possible, but will fall back to
setting it separately from creation where necessary.

In all cases, setting the flag atomically depends not only on the correct
syscall interface being defined, but on it being actually implemented
in the runtime kernel.  Each function will experiment to see whether
the atomic flag setting actually works, and is prepared for the flag to
cause EINVAL or ENOSYS or to be ignored.

6 years agoconfigure probes for accept4(), dup3(), pipe2()
Zefram [Tue, 19 Dec 2017 10:35:58 +0000 (10:35 +0000)]
configure probes for accept4(), dup3(), pipe2()

These will shortly be used to implement I/O operations that create file
descriptors with the FD_CLOEXEC flag set atomically.

6 years agoset PERL_EXIT_DESTRUCT_END in all embeddings
Zefram [Fri, 22 Dec 2017 10:07:47 +0000 (10:07 +0000)]
set PERL_EXIT_DESTRUCT_END in all embeddings

The new tests in commit 503bc07b4b9e34ed04a725b2bc8faec1ae0f3be2
showed up platform differences in whether END blocks get run.
Set PERL_EXIT_DESTRUCT_END in all embeddings to make this consistent.

6 years agotest more about exit from special blocks
Zefram [Fri, 22 Dec 2017 07:54:38 +0000 (07:54 +0000)]
test more about exit from special blocks

Commit 0301e899536a22752f40481d8a1d141b7a7dda82 introduced some tests
about ways of exiting from special blocks.  Make those tests more
thorough, checking which kinds of special blocks execute after exiting
from a special block.  This tests, for example, that exiting from a BEGIN
block prevents INIT blocks from running, which when applied to exit(0)
is how that bugfix commit broke Module::Install [perl #132577].

6 years agopreserve numericness of system() args on Win32
Zefram [Fri, 22 Dec 2017 05:32:41 +0000 (05:32 +0000)]
preserve numericness of system() args on Win32

On Windows there's a nasty variation in the meaning of arguments
to Perl's system(), in which a numeric first argument isn't used as
part of the command to run, but instead selects between two different
operations to perform with the command (whether to wait for the command
to complete or not).  Therefore the reduction of argument scalars to
their operative values in the parent process, which was added in commit
64def2aeaeb63f92dadc6dfa33486c1d7b311963, needs to preserve numericness
of arguments on Windows.  Fixes [perl #132633].

6 years agoCogito ergo sum
Chris 'BinGOs' Williams [Thu, 21 Dec 2017 08:59:41 +0000 (08:59 +0000)]
Cogito ergo sum

6 years agofix up faulty perl embeddings
Zefram [Thu, 21 Dec 2017 05:40:49 +0000 (05:40 +0000)]
fix up faulty perl embeddings

Some platform-specific embeddings of perl were misusing the
return values from perl_parse() and perl_run(), in some cases
causing failure due to exit(0) combined with the recent changes
in commit 0301e899536a22752f40481d8a1d141b7a7dda82.  Commit
d4a50999a5525c2681d59cae5fcd94f94ff897fd partially fixed a Windows
embedding.  More fully fix that, along with NetWare and OS/2.  Even in
embeddings with correct logic, stop using a variable named "exitstatus"
to hold the result of perl_parse() or perl_run(), to avoid misleading
people who copy the code.

6 years agoUpdate Module-CoreList for v5.27.8
Chris 'BinGOs' Williams [Wed, 20 Dec 2017 23:49:23 +0000 (23:49 +0000)]
Update Module-CoreList for v5.27.8

6 years agoBump the perl version in various places for v5.27.8
Chris 'BinGOs' Williams [Wed, 20 Dec 2017 23:45:41 +0000 (23:45 +0000)]
Bump the perl version in various places for v5.27.8

6 years agoNew perldelta for v5.27.8
Chris 'BinGOs' Williams [Wed, 20 Dec 2017 23:28:57 +0000 (23:28 +0000)]
New perldelta for v5.27.8

6 years agoInclude epigraph for v5.27.7
Chris 'BinGOs' Williams [Wed, 20 Dec 2017 23:21:53 +0000 (23:21 +0000)]
Include epigraph for v5.27.7

6 years agoadd new release to perlhist v5.27.7
Chris 'BinGOs' Williams [Wed, 20 Dec 2017 20:44:26 +0000 (20:44 +0000)]
add new release to perlhist

6 years agoFinalise perldelta
Chris 'BinGOs' Williams [Wed, 20 Dec 2017 20:17:39 +0000 (20:17 +0000)]
Finalise perldelta

6 years agoUpdate Module::CoreList for v5.27.7
Chris 'BinGOs' Williams [Wed, 20 Dec 2017 19:49:33 +0000 (19:49 +0000)]
Update Module::CoreList for v5.27.7

6 years agoStart finalisation of perldelta
Chris 'BinGOs' Williams [Wed, 20 Dec 2017 19:32:45 +0000 (19:32 +0000)]
Start finalisation of perldelta

6 years agoResolve issue with Win32 caused by 0301e8995
Chris 'BinGOs' Williams [Wed, 20 Dec 2017 19:21:30 +0000 (19:21 +0000)]
Resolve issue with Win32 caused by 0301e8995

From #p5p
[18:12] < xenu> is it just me or is it impossible to build perl using visual c++?
[18:13] < xenu> it fails with 'NMAKE : fatal error U1077: '..\perl.exe' : return code '0x100'"
[18:14] < pink_mist> I'm pretty sure it ought to be possible
[18:14] < xenu> the funny part is that perl.exe built by msvc *always* exits with 255 exit code
[18:14] < xenu> even if you run it like this ..\perl.exe -e "print 1"
[18:14] < xenu> it will print '1' and terminate with exit code 255
[18:42] < xenu> Zefram: 0301e899536a22752f40481d8a1d141b7a7dda82 broke win32
[18:43] < xenu> basically the problem is than PerlRun in win32/perllib.c uses return value of perl_run() as a exit code
[19:08] < BinGOs> xenu: does 'exitstatus = perl_destruct(my_perl);' fix the issue?
[19:20] < xenu> BinGOs: yep
[19:20] < BinGOs> okay cool thanks for confirming.
[19:20] < BinGOs> I'll commit that now.

6 years agot/re/reg_mesg.t: White-space only
Karl Williamson [Fri, 9 Jun 2017 13:27:31 +0000 (07:27 -0600)]
t/re/reg_mesg.t: White-space only

Indent a newly-formed block

6 years agot/re/reg_mesg.t: Test that death actually happens.
Karl Williamson [Fri, 9 Jun 2017 04:05:15 +0000 (22:05 -0600)]
t/re/reg_mesg.t: Test that death actually happens.

Until now, patterns that are supposed to die weren't actually being
checked for that.  Instead the message that was raised was checked
against the expected value, and if they matched, it assumed that death
accompanied it.  But this isn't necessarily true.  Also, some entries
were given an empty expectation, which was wrong.  So this makes sure of
that.  Those empty patterns matched anything at all, so things went
undetected.

To be sure of death, this commit appends a statement with a lingering
effect to the string eval of what's supposed to die.  If the effect
happens, it didn't die.

6 years agoreg_mesg.t: Move some tests to proper places
Karl Williamson [Tue, 19 Dec 2017 18:43:46 +0000 (11:43 -0700)]
reg_mesg.t: Move some tests to proper places

 This was detected in [perl #131522].  Some tests were in the death
 section, but don't die.  The next commit will add tests that actually
 work to detect death.

6 years ago[MERGE] s/// return value fixups
David Mitchell [Tue, 19 Dec 2017 15:40:41 +0000 (15:40 +0000)]
[MERGE] s/// return value fixups

6 years agos/// in boolean context: simplify return value
David Mitchell [Tue, 19 Dec 2017 15:28:06 +0000 (15:28 +0000)]
s/// in boolean context: simplify return value

Normally s/// returns a count of the number of iterations, but
as an optimisation, in boolean context it returns PL_sv_yes/PL_sv_zero
instead. But in the places where it decides which immortal var to return,
the number of iterations is always > 0, so PL_sv_zero never gets returned.
So skip testing whether iters > 0 and always just return PL_sv_yes.

(In non-boolean scalar context, it still returns the iteration count as
before.)

6 years agoavoid tainting boolean return value of s///
David Mitchell [Tue, 19 Dec 2017 14:52:49 +0000 (14:52 +0000)]
avoid tainting boolean return value of s///

RT #132385

s/// normally returns an integer count, but sometimes for efficiency it
will return a boolean instead (PL_sv_yes/PL_sv_zero).

In these cases, don't try to taint the return value, since it will die
with 'Modification of a read-only value'.

6 years agos///: return boolean in not-in-place branch
David Mitchell [Tue, 19 Dec 2017 12:09:15 +0000 (12:09 +0000)]
s///: return boolean in not-in-place branch

A while back, s/// (and other ops) were optimised to return
PL_sv_yes/PL_sv_zero rather than an iteration count in boolean context.

This optimisation was missed in one place in pp_subst(): the 'can modify
in place' branch was done, but the other branch was missed.

This commit fixes that.

6 years agominor punctuation improvement
Karen Etheridge [Tue, 19 Dec 2017 03:01:26 +0000 (19:01 -0800)]
minor punctuation improvement

6 years agoForbid literal \v in /[]/ under re strict, except under /x
Karl Williamson [Tue, 19 Dec 2017 02:04:56 +0000 (19:04 -0700)]
Forbid literal \v in /[]/ under re strict, except under /x

Vertical space in a bracketed character class is likely to be an error;
either a typo or omission of /x.  It will match literally, but be
displayed like /x is in effect.

For now, just add this check to re 'strict', which is experimental,
designed to catch things the current regex parser doesn't.

6 years agoperldiag: Fix obsolete text
Karl Williamson [Tue, 19 Dec 2017 02:03:26 +0000 (19:03 -0700)]
perldiag: Fix obsolete text

Since 5.26.0, code points must fit in a signed integer, not unsigned.

This commit should be considered for backporting to a future 5.26.x
release

6 years agoreg_mesg.t: Fix comment
Karl Williamson [Tue, 19 Dec 2017 02:02:37 +0000 (19:02 -0700)]
reg_mesg.t: Fix comment

6 years agoreg_mesg.t: Fix typo
Karl Williamson [Tue, 19 Dec 2017 02:01:37 +0000 (19:01 -0700)]
reg_mesg.t: Fix typo

6 years agoDemonstrate how File::Spec->catfile('.', @other_args) works.
James E Keenan [Mon, 18 Dec 2017 22:02:55 +0000 (17:02 -0500)]
Demonstrate how File::Spec->catfile('.', @other_args) works.

For:  RT # 131296

6 years agoEmulate C99 int_fast8_t, etc typedefs
Karl Williamson [Fri, 8 Dec 2017 05:10:52 +0000 (22:10 -0700)]
Emulate C99 int_fast8_t, etc typedefs

These are useful if you know you have a variable with a restricted range,
and so could fit in a byte or 16 bits, but speed is more important.
These C99 typedefs allows you to specify the minimal size you need, and
allows the compiler to substitute a wider type if it is faster.

This commit adds typedefs spelled the same as the C99 ones, but upper
cased.  On non-C99 compilers, it just uses 'int' behind the scenes,
which should be safe.

These are currently restricted to core to be sure these aren't a bad
idea before they are made public.

6 years agomktables: Use already set variable
Karl Williamson [Mon, 18 Dec 2017 19:49:55 +0000 (12:49 -0700)]
mktables: Use already set variable

The value for this variable is already known; use that instead of
rederiving it.

6 years agoChange number to mnemonic
Karl Williamson [Sat, 16 Dec 2017 06:41:51 +0000 (23:41 -0700)]
Change number to mnemonic

This is in preparation for future commits that will use it in multiple
places

6 years agoperlxs: Document bitwise calling conventions
Father Chrysostomos [Mon, 18 Dec 2017 17:37:08 +0000 (09:37 -0800)]
perlxs: Document bitwise calling conventions

6 years agoCustomisations for Digest-SHA tests
Chris 'BinGOs' Williams [Mon, 18 Dec 2017 13:31:43 +0000 (13:31 +0000)]
Customisations for Digest-SHA tests

6 years agoUpdate Digest-SHA to CPAN version 6.00
Chris 'BinGOs' Williams [Mon, 18 Dec 2017 13:15:34 +0000 (13:15 +0000)]
Update Digest-SHA to CPAN version 6.00

  [DELTA]

6.00  Fri Dec  8 22:44:44 MST 2017
  - added "tag" option (BSD-style checksums) to shasum
    -- consistent with GNU sha1sum, sha224sum, etc.
    -- thanks to Christopher Tubbs for suggestion
  - modified SHA.pm to use XSLoader
    -- falls back to DynaLoader if necessary
  - decoupled Digest::SHA and Digest::SHA::PurePerl
    -- scripts/tests in each module now fully independent
    -- Digest::SHA::PurePerl to be phased out eventually
      -- past versions will remain available