This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
4 years agoregcomp.c: white-space only
Karl Williamson [Fri, 20 Mar 2020 04:52:38 +0000 (22:52 -0600)]
regcomp.c: white-space only

indent code that the next commit forms a block around

4 years agoregcomp.c: Add a [ to fake string only if original had one
Karl Williamson [Fri, 20 Mar 2020 04:17:58 +0000 (22:17 -0600)]
regcomp.c: Add a [ to fake string only if original had one

This code is assembling a fake string to parse, modified from the
original.  Prior to a future commit, this was only called when there was
a bracketed character class, so it made sense to unconditionally add
the bracket.  But soon this will be called when there isn't a bracket,
so one shouldn't be added.

4 years agomktables: Change named sequences to 5 digits
Karl Williamson [Fri, 20 Mar 2020 04:02:38 +0000 (22:02 -0600)]
mktables: Change named sequences to 5 digits

This makes them correspond to names for single characters, and will make
parsing easier in the next commits.

4 years agoregcomp.c: Fix misspelling
Karl Williamson [Wed, 11 Mar 2020 22:21:31 +0000 (16:21 -0600)]
regcomp.c: Fix misspelling

4 years agoDocument chained oprators in perldelta
Sawyer X [Fri, 20 Mar 2020 13:32:16 +0000 (15:32 +0200)]
Document chained oprators in perldelta

4 years agofixup to free_and_set_cop_warnings()
David Mitchell [Fri, 20 Mar 2020 09:06:57 +0000 (09:06 +0000)]
fixup to free_and_set_cop_warnings()

v5.31.9-156-g94c8b9c1f0 introduced the free_and_set_cop_warnings()
macro. It's first argument expects a COP rather than a COP*. Its usage
in S_restore_cop_warnings(() is to modify PL_cucop, but in order to pass
a COP rather than a COP*, the original commit made a local copy of
PL_curcop and ended up inadvertently updating the copy instead.

This commit changes the maco so it expects a COP*, and updates the bulk
of its callers to use &PL_compiling rather than PL_compiling, and fixes
up S_restore_cop_warnings().

The symptoms were ASAN failures in a few test scripts including
uni/parser.t and ext/XS-APItest/t/handy0*.t.

(The S_restore_cop_warnings() function was only used by
Perl__force_out_malformed_utf8_message(), so didn't cause many issues
outside of test scripts which forced such "malformed "errors).

4 years agovmsish.h: Fix missing semicolon from 2bc5f86
Craig A. Berry [Thu, 19 Mar 2020 18:10:35 +0000 (13:10 -0500)]
vmsish.h: Fix missing semicolon from 2bc5f86

4 years agoCorrect some grammar in README.linux and update it
Shlomi Fish [Wed, 22 May 2019 10:27:32 +0000 (13:27 +0300)]
Correct some grammar in README.linux and update it

Fix GH #17007

(cherry picked from commit b9677ee9a1dd1f5d79c5ab3e2e788eea65c20253)
Signed-off-by: Nicolas R <atoomic@cpan.org>
4 years agolib/unicore/mktables: use function signatures
Nicolas R [Wed, 11 Mar 2020 20:01:44 +0000 (14:01 -0600)]
lib/unicore/mktables: use function signatures

Also regenerate files depending on lib/unicore/mktables

    ./perl -Ilib regen/mk_invlists.pl; ./perl -Ilib regen/regcharclass.pl

4 years agomodernize mkppport with signatures
Nicolas R [Wed, 11 Mar 2020 17:23:52 +0000 (11:23 -0600)]
modernize mkppport with signatures

4 years agoregen/reentr.pl: Add comment
Karl Williamson [Thu, 19 Mar 2020 00:35:08 +0000 (18:35 -0600)]
regen/reentr.pl: Add comment

4 years agoregen/reentr.pl: Rearrange ternary expression
Karl Williamson [Sun, 15 Mar 2020 20:14:34 +0000 (14:14 -0600)]
regen/reentr.pl: Rearrange ternary expression

I and Perl Best Practices agree that this syntax is hard to read.

4 years agoFile-Glob/bsd_glob.c: use PerlEnv_getenv()
Karl Williamson [Sat, 7 Mar 2020 20:01:39 +0000 (13:01 -0700)]
File-Glob/bsd_glob.c: use PerlEnv_getenv()

which has added protections beyond plain getenv()

4 years agoPerl_init_tm: Use mutex to avoid race.
Karl Williamson [Mon, 16 Mar 2020 04:17:32 +0000 (22:17 -0600)]
Perl_init_tm: Use mutex to avoid race.

This locks around localtime (and localtime_r which this call may be
translated into) which are sensitive to locale and environment changes
in their execution.

4 years agoMerge branch 'time64' into blead
Karl Williamson [Thu, 19 Mar 2020 00:09:24 +0000 (18:09 -0600)]
Merge branch 'time64' into blead

This branch refactors a portion of time64.c, simplifying and protecting
against races on threaded perls.

4 years agotime64.c: Add a branch prediction for unlikely event
Karl Williamson [Mon, 16 Mar 2020 13:42:58 +0000 (07:42 -0600)]
time64.c: Add a branch prediction for unlikely event

4 years agotime64.c: Add mutex protection
Karl Williamson [Sun, 15 Mar 2020 18:16:47 +0000 (12:16 -0600)]
time64.c: Add mutex protection

The gmtime_r() and localtime_r() functions are  not thread safe with
regards to changes in the environment and locale while executing.  This
protects them with a mutex, but only from other functions that also
participate in using that mutex.  Future commits will change everything
in the perl core to do that, but there is still a hole if some XS
writer, or alien library doesn't use the mutex.

4 years agotime64.[ch]: Inline only use of another macro
Karl Williamson [Sun, 15 Mar 2020 16:19:18 +0000 (10:19 -0600)]
time64.[ch]: Inline only use of another macro

This macro is now only used once.  It is accessible outside perl because
it is in time64.h, but isn't used in cpan.  Remove it and place its
expansion in time64.c.

Part of the expansion called another function.  That function can be
removed and the expansion simplified, since gmtime() is now
automatically converted into gmtime_r() if available and needed.

4 years agotime64.[ch]: Inline only use of a macro and fcn
Karl Williamson [Sun, 15 Mar 2020 04:34:00 +0000 (22:34 -0600)]
time64.[ch]: Inline only use of a macro and fcn

This macro is now only used once, and was the only caller of a helper
function.  Thus both can be removed and inlined, simplifying things.

Further, most of the function's functionality can be removed, since it
was an attempt to simulate localtime_r(), which is now automatically
furnished by reentrant.[ch] if needed.

4 years agotime64.c: White-space only
Karl Williamson [Sun, 15 Mar 2020 15:36:29 +0000 (09:36 -0600)]
time64.c: White-space only

Indent code blocks created by the previous commit; a few more
white-space adjustments.

4 years agotime64.c: Refactor Perl_localtime64_r()
Karl Williamson [Sat, 14 Mar 2020 20:33:05 +0000 (14:33 -0600)]
time64.c: Refactor Perl_localtime64_r()

There are two main cases in Perl_localtime64_r(), call them A and B.

Prior to this commit, it was structured

if (A) {
 codeA
 return;
}

codeB
return;

The problem this commit solves is that there is common stuff in codeA
and codeB that will now only be specified once.  Currently that common
stuff is minimal, and so acceptable, but the next few commits will make
the common stuff more complex, so making it be only once is helpful.

4 years agotime64.c: Store fcn return in a variable
Karl Williamson [Sat, 14 Mar 2020 20:18:56 +0000 (14:18 -0600)]
time64.c: Store fcn return in a variable

This is in preparation for it being used in more than one place

4 years agoreentr.[ch]: Add gmtime_r, localtime_r
Karl Williamson [Sun, 15 Mar 2020 20:18:53 +0000 (14:18 -0600)]
reentr.[ch]: Add gmtime_r, localtime_r

This now replaces occurrences of the non re-entrant versions of these
two functions  with the reentrant ones.

4 years agoreentr.h: Add way to see if reentrant used
Karl Williamson [Mon, 16 Mar 2020 18:00:51 +0000 (12:00 -0600)]
reentr.h: Add way to see if reentrant used

The reentrant mechanism automatically and silently replaces a given
function by its reentrant version when warranted.  Until now, there was
no direct way to test if it actually happens.  One could infer it,
possibly, but not without the potential for getting it wrong.

Now, for function foo, add #ifdef PERL_REENTR_USING_FOO_R

4 years agoreentr.h: Add clarifying comment
Karl Williamson [Mon, 16 Mar 2020 17:52:59 +0000 (11:52 -0600)]
reentr.h: Add clarifying comment

4 years agoreentr.[ch]: White-space only
Karl Williamson [Mon, 16 Mar 2020 17:13:40 +0000 (11:13 -0600)]
reentr.[ch]: White-space only

This is a follow-on to 7c1815b7942f8c7e3651d98060ca7a0760e6483c,
that adds some more white space indentation fixes

4 years agoperl.h: Add ENV_LOCALE (UN)?LOCK macros
Karl Williamson [Mon, 16 Mar 2020 03:33:19 +0000 (21:33 -0600)]
perl.h: Add ENV_LOCALE (UN)?LOCK macros

These are eventually intended to lock both the environment and locale
mutexes, but it is too late in the current development cycle to do that.
Instead these are, for now, equivalent to a plain ENV mutex.
(On many modern platforms, the locale mutex is a no-op, so not doing it
is not actually a problem.)

In the meantime, this gives significant better thread safety than what
has been in effect.

4 years agopp_match(): output regex debugging info
Karl Williamson [Thu, 5 Mar 2020 03:58:28 +0000 (20:58 -0700)]
pp_match(): output regex debugging info

This fixes #17612

This adds an inline function to pp_hot to be called to determine if
debugging info should be output or not, regardless of whether it comes
from -Dr, or from a 'use re Debug' statement

4 years agoregcomp.h: Add macro
Karl Williamson [Thu, 5 Mar 2020 03:52:57 +0000 (20:52 -0700)]
regcomp.h: Add macro

This macro is for files outside of regcomp.c/regexec.c (and
re_comp.c/re_exec.c) to have access to the re.pm Debug options.

Right now pp_match could benefit from this.

4 years agopp_match: Use 'z' length modifier to format sizes
Karl Williamson [Thu, 5 Mar 2020 03:13:27 +0000 (20:13 -0700)]
pp_match: Use 'z' length modifier to format sizes

This makes things easier to read.

4 years agoPOSIX.xs: Never pass NULL to ctermid()
Karl Williamson [Tue, 17 Mar 2020 17:39:02 +0000 (11:39 -0600)]
POSIX.xs: Never pass NULL to ctermid()

Doing so can cause races.

It is interesting that POSIX:ctermid() takes a parameter, but the
pod doesn't indicate that it does.  Prior to this commit the parameter
was ignored if and only if the platform contains a ctermid_r()
function, and hence on such platforms there was no possibility of a race
here.  The man pages I've seen for ctermid_r() indicate that it differs
from regular ctermid() only in that it will fail if the input is NULL,
and hence a race could occur if it didn't immediately fail.

The situation prior to this commit wa that if you followed the pod on a
non-ctermid_r() platform, and called this without a parameter, it would
call ctermid with NULL, creating a potential race.  This commit changes
so that a race is never possible.

4 years agoRegne reentr.c.
Karl Williamson [Wed, 18 Mar 2020 20:53:05 +0000 (14:53 -0600)]
Regne reentr.c.

Commit 727613455d53416b197154b7b3cad20fe26372bb failed to regenerate
reentr.c after changes.

4 years agoreentr.c: revise handling of several wrapped fcns
Karl Williamson [Wed, 11 Mar 2020 20:35:44 +0000 (14:35 -0600)]
reentr.c: revise handling of several wrapped fcns

Prior to this commit, the code in this function had generic variables,
like p0, and malloc'd them using void *, and then cast to what it
thought were the proper types.  This was failing on solaris g++, because
of the stricter casting rules in C++.

This commit actually simplifies the code, by getting rid of the generic
stuff, and for each group of related functions, declares the appropriate
names for the variables, and mallocs them using the correct type as
expressed in the __DATA__ section of regen/reentr.pl.  The casting is
eliminated, except for one case for gethostbyaddr().  Tony Cook pointed
out that the 2001 POSIX standard used a type name for this that may be
shorter than Size_t.  This could be a potential issue, but not on the
platforms tested as of now.

And this fixes #17482, so works where the previous didn't.

4 years agoreentr.c: Handle getspnam()
Karl Williamson [Wed, 11 Mar 2020 18:24:33 +0000 (12:24 -0600)]
reentr.c: Handle getspnam()

This has never worked to increase the buffer size if necessary.
Apparently the default has always been big enough.  But this commit
fixes it to retry if too small.

I don't think there is a way to write tests for this.  getspnam is
called only as a small part of pp_gpwent, and is not part of the API,
and is called only when run as root.

I did test it on my box, with gdb, starting with a buffer size of 1, and
single stepping and observing that it works as I expected.

4 years agoreentr.c: Use keywords, not ops
Karl Williamson [Wed, 11 Mar 2020 18:05:01 +0000 (12:05 -0600)]
reentr.c: Use keywords, not ops

The parameter to this function is a string containing the name of the
wrapped function.  Prior to this commit, it was assumed, without
checking, that PL_op->op_type corresponded to this name.  This
assumption can't be always correct because at least one of the wrapped
functions doesn't have an op, getspnam.  That means it never would have
worked for that function to increase its buffer size.  When I was
examining this some years ago (and didn't follow up until now), ISTR
that there were other cases where the correspondence was wrong, but I
couldn't reproduce that now.

There is no easy conversion from string to OP code, but there is from
string to keyword number.  This commit changes to use that conversion
function, and switches based on the keyword number.  A later commit
fixes getspnam.

4 years agofixup to "avoid identical stack traces" - try 2
David Mitchell [Thu, 12 Mar 2020 14:14:24 +0000 (14:14 +0000)]
fixup to "avoid identical stack traces" - try 2

GH #15109, #17567

[ this commit was originally applied as v5.31.9-121-gfb8188b84d, but was
quickly reverted by v5.31.9-124-g6311900a66. I'm now -re-applying it,
but with a 'SAVEFREEOP(PL_curcop)' added, which was missing from the
original commit. ]

My original fix for this issue, v5.31.6-141-gf2f32cd638
made a shallow copy of &PL_compiling. However, for non-default
warning bits, this made two COPs share the malloced() cop_warnings,
and bad things ensured. In particular this was flagged up in:

    GH #17567: "BBC: AYOUNG/OpenVZ-0.01.tar.gz"

The fix in this commit is to do a deep copy of the COP using
newSTATEOP().

4 years agoFix pod errors
Karl Williamson [Tue, 17 Mar 2020 03:13:39 +0000 (21:13 -0600)]
Fix pod errors

introduced by cd7ac46508e1b2b346c339417237ef487bf59c74

4 years agoperlre: Note savepv() allocations need to be freed
Karl Williamson [Mon, 16 Mar 2020 20:27:49 +0000 (14:27 -0600)]
perlre: Note savepv() allocations need to be freed

4 years agoswitch_category_locale_to_template: Fix use-after-free under -DLv
Dagfinn Ilmari Mannsåker [Mon, 16 Mar 2020 19:40:00 +0000 (19:40 +0000)]
switch_category_locale_to_template: Fix use-after-free under -DLv

Coverity CID 288709

4 years agoDynaloader: Add, fix comments
Karl Williamson [Sat, 7 Mar 2020 19:42:23 +0000 (12:42 -0700)]
Dynaloader: Add, fix comments

4 years agoiperlsys.h: White-space only
Karl Williamson [Sun, 8 Mar 2020 00:02:37 +0000 (17:02 -0700)]
iperlsys.h: White-space only

4 years agoAdd macro to free and set cop_warnings
Nicolas R [Tue, 10 Mar 2020 17:14:04 +0000 (11:14 -0600)]
Add macro to free and set cop_warnings

This is avoiding the boilerplate to free
the cop_warning string when setting it.

4 years agoreentr.[ch]: White-space only
Karl Williamson [Wed, 11 Mar 2020 17:33:39 +0000 (11:33 -0600)]
reentr.[ch]: White-space only

I changed the preprocessor directive indentation to make it easier to
grasp the nesting levels, and added blank lines for readability.

Some of the changes are for future commits that will remove some
nesting.

4 years agoregen/reentr.pl: Add some comments
Karl Williamson [Tue, 10 Mar 2020 23:16:23 +0000 (17:16 -0600)]
regen/reentr.pl: Add some comments

4 years agoFix language referring to GitHub issue tracker in various places
Dave Rolsky [Sat, 14 Mar 2020 17:59:09 +0000 (12:59 -0500)]
Fix language referring to GitHub issue tracker in various places

There were a number of spots that used language more appropriate for an email
address than a web-based tracker.

I noticed this because of the recent 5.30.2 release, which has a perldelta
containing the sentence "If you find any we have missed, send email to
https://github.com/Perl/perl5/issues."

But I think that was because the 5.30.2 branch did not include
8166b4e0bc220e759aa233af54ac1e60cc510f0c.

4 years agoFill in link for 5.30.2 epigraph
Steve Hay [Sat, 14 Mar 2020 17:59:21 +0000 (17:59 +0000)]
Fill in link for 5.30.2 epigraph

4 years agoImport perl5302delta.pod
Steve Hay [Sat, 14 Mar 2020 17:49:42 +0000 (17:49 +0000)]
Import perl5302delta.pod

4 years agoModule::CoreList - Add entry for forthcoming 5.31.10 to Changes
Steve Hay [Sat, 14 Mar 2020 17:42:23 +0000 (17:42 +0000)]
Module::CoreList - Add entry for forthcoming 5.31.10 to Changes

This got missed by 4b9ba9feb3.

4 years agoModule::CoreList - Fix date of 5.30.2
Steve Hay [Sat, 14 Mar 2020 17:40:14 +0000 (17:40 +0000)]
Module::CoreList - Fix date of 5.30.2

This got missed by 30107e92e6 on the maint-5.30 branch.

4 years agoUpdate Module-CoreList with data for 5.30.2
Steve Hay [Sat, 14 Mar 2020 17:36:26 +0000 (17:36 +0000)]
Update Module-CoreList with data for 5.30.2

4 years agoTick off 5.30.2
Steve Hay [Sat, 14 Mar 2020 17:17:28 +0000 (17:17 +0000)]
Tick off 5.30.2

4 years agoAdd epigraph for 5.30.2
Steve Hay [Sat, 14 Mar 2020 17:16:13 +0000 (17:16 +0000)]
Add epigraph for 5.30.2

4 years ago5.30.2 today
Steve Hay [Sat, 14 Mar 2020 12:25:24 +0000 (12:25 +0000)]
5.30.2 today

4 years agoperlop - Avoid $a and $b
Dan Book [Sat, 14 Mar 2020 00:19:20 +0000 (20:19 -0400)]
perlop - Avoid $a and $b

4 years agoFetch git history to run tests like t/porting/cmp-version.t
Nicolas R [Fri, 13 Mar 2020 21:41:14 +0000 (15:41 -0600)]
Fetch git history to run tests like t/porting/cmp-version.t

Make sure t/porting/cmp-version.t is run by GitHub workflow
in order to catch issues on Pull Requests.

Setup a larg diff.renameLimit to avoid git warnings from
multiple unit tests.

Note: the i386 workflow cannot use checkout@v2 and need to keep
using checkout@v1.

4 years agoBump IPC-Open3 versions to fix cmp_version.t
Nicolas R [Fri, 13 Mar 2020 18:00:11 +0000 (12:00 -0600)]
Bump IPC-Open3 versions to fix cmp_version.t

4 years agoExplain that a shell isn’t always used with qx/STRING/.
Peter Oliver [Sat, 7 Mar 2020 19:47:09 +0000 (19:47 +0000)]
Explain that a shell isn’t always used with qx/STRING/.

4 years agoSilence test failure by updating AUTHORS.
Peter Oliver [Wed, 5 Feb 2020 18:34:12 +0000 (18:34 +0000)]
Silence test failure by updating AUTHORS.

4 years agoClarify when qx/STRING/ returns undef
Peter Oliver [Fri, 31 Jan 2020 18:42:38 +0000 (18:42 +0000)]
Clarify when qx/STRING/ returns undef

Fixes #16572.

4 years agoperlrun - Update PERLIO documentation
Dan Book [Thu, 12 Mar 2020 02:09:49 +0000 (22:09 -0400)]
perlrun - Update PERLIO documentation

- Remove mention of several layers that have no business being set in PERLIO
- Clarify the role of :crlf and :stdio
- Update mentioned versions to indicate state of things in 5.30
- Consistently refer to layers with a leading colon

4 years agoIPC::Open2 and IPC::Open3 documentation updates
Dan Book [Wed, 18 Dec 2019 21:35:01 +0000 (16:35 -0500)]
IPC::Open2 and IPC::Open3 documentation updates

* Remove direct usage of bareword filehandles and use lexical filehandles for the first example in each synopsis.
* Add examples using STDIN and STDOUT filehandles, and examples using already open filehandles, with explicit examples of where these handles come from.
* Declare variables with 'my' where appropriate and condense declarations inline.
* Add comments in synopsis describing the purpose of each example.
* Consistency of referencing synopsis variables from the description.
* Replace ambiguous phrase 'null string' with 'empty string or undefined' which is also more correct here.
* Add links to referenced CPAN modules and manpages.
* Better describe the reason for using gensym in IPC::Open3 and how to use it.

4 years agoAdd strict and warnings to some .PL files
Nicolas R [Wed, 11 Mar 2020 21:40:01 +0000 (15:40 -0600)]
Add strict and warnings to some .PL files

use a convoluted incantation to be able to set
'use strict; use warnings' only for Perl > 5.6

4 years agoAdd strict and warnings to a few utils
Nicolas R [Thu, 12 Mar 2020 22:42:24 +0000 (16:42 -0600)]
Add strict and warnings to a few utils

4 years agoop.c: change Optype to I32 for cmpchain functions
Yves Orton [Sat, 8 Feb 2020 09:51:48 +0000 (10:51 +0100)]
op.c: change Optype to I32 for cmpchain functions

Optype appears to be almost completely unused, and on Win32 builds
we saw warnings from the cmpchain patches:

    perly.y(1063) : warning C4244: 'function' : conversion from 'I32' to 'Optype', possible loss of data
    perly.y(1065) : warning C4244: 'function' : conversion from 'I32' to 'Optype', possible loss of data
    perly.y(1079) : warning C4244: 'function' : conversion from 'I32' to 'Optype', possible loss of data
    perly.y(1081) : warning C4244: 'function' : conversion from 'I32' to 'Optype', possible loss of data

Reviewing the code I noticed that functions like Perl_newBINOP() have
an I32 type argument, and functions like OpTYPE_set() coerce such
arguments into type OPCODE:

#define OpTYPE_set(o,type) \
STMT_START {                                \
    o->op_type = (OPCODE)type;              \
    o->op_ppaddr = PL_ppaddr[type];         \
} STMT_END

this patch changes the signature to the new cmpchain functions so that
they do they same, and change the type for storage for op_type values
to also use OPCODE like most of the other op.c code.

4 years agopod/perlop.pod: cross-precedence chaining
Zefram [Fri, 7 Feb 2020 11:49:07 +0000 (11:49 +0000)]
pod/perlop.pod: cross-precedence chaining

Warn explicitly that chainable operators don't chain with operators of
different precedence.

4 years agopod/perlop.pod: expand doc on chained comparisons
Zefram [Fri, 7 Feb 2020 09:30:21 +0000 (09:30 +0000)]
pod/perlop.pod: expand doc on chained comparisons

4 years agochained comparisons
Zefram [Wed, 5 Feb 2020 07:43:14 +0000 (07:43 +0000)]
chained comparisons

4 years agopp_sort.c: silence the "unused parameter" warning
Tomasz Konojacki [Thu, 12 Mar 2020 23:15:37 +0000 (00:15 +0100)]
pp_sort.c: silence the "unused parameter" warning

The 'flags' argument has been unused since
044d25c73ce10d2b29008b875209d414303ccff7 but we can't remove it
because it's a public API.

Fixes #17632

4 years agoPerlIO bump VERSION for t/porting/cmp_version
Nicolas R [Fri, 13 Mar 2020 01:10:34 +0000 (19:10 -0600)]
PerlIO bump VERSION for t/porting/cmp_version

4 years agoUpdate $VERSION
James E Keenan [Fri, 7 Feb 2020 01:26:44 +0000 (20:26 -0500)]
Update $VERSION

To keep make test_porting happy.

4 years agoB::Deparse fixup uninitialized error in deparsing weird glob statement
Yves Orton [Thu, 6 Feb 2020 06:11:20 +0000 (07:11 +0100)]
B::Deparse fixup uninitialized error in deparsing weird glob statement

This fixes issue #17537, and adds tests

4 years agoI think "program scope" is clearer here than "current file scope"
Tony Cook [Wed, 4 Mar 2020 05:27:35 +0000 (16:27 +1100)]
I think "program scope" is clearer here than "current file scope"

Further clarified it has no effect on modules.

"main program scope" is even clearer, credit to github comments.

Clarifies a documentation nit discussed in #17458

4 years agoRework PerlIO documentation
Dan Book [Wed, 11 Mar 2020 00:31:27 +0000 (20:31 -0400)]
Rework PerlIO documentation

- Add Layers section in the description, giving details of how layers work and encompassing the list of built-in layers
- Add various information relevant to modern usage of each layer
- Consistently refer to layers with a leading colon
- Redo :utf8 and :bytes layer descriptions
- Remove references to using the :utf8 layer for UTF-8 translation
- Add :scalar layer
- Move description of default layers that was oddly in "Querying" section to the end of "Defaults" section
- Correct default layers to specify that PERLIO=:stdio will always result in default layers of :stdio
- Update all examples to be strict-safe and check for open/binmode failure
- Capitalize references to Perl consistently

4 years agoRevert "fixup to "avoid identical stack traces""
Nicolas R [Thu, 12 Mar 2020 21:14:26 +0000 (15:14 -0600)]
Revert "fixup to "avoid identical stack traces""

This reverts commit fb8188b84d8a8f34f90aa9a8d9837892967f6b93.

Unfortunately this is causing some errors during global destruction
like:

Unbalanced string table refcount: (1) for "open_IN" during global destruction

It seems to be flapping, and recompiling Perl could see or not the
issue.

Upstream-URL: https://github.com/Perl/perl5/commit/fb8188b84d8a8f34f90aa9a8d9837892967f6b93

4 years agoIsolate broken 32bit gcc smokers
Nicolas R [Thu, 12 Mar 2020 15:04:14 +0000 (09:04 -0600)]
Isolate broken 32bit gcc smokers

32bits smokers are broken and installing
'dpkg --add-architecture i386' fails on all debian.

Isolate them in order to avoid to have to install i386
architecture.

4 years agodocs: clarify effect of $^H, %^H, ${^WARNING_BITS}
David Mitchell [Thu, 12 Mar 2020 15:41:24 +0000 (15:41 +0000)]
docs: clarify effect of $^H, %^H, ${^WARNING_BITS}

See http://nntp.perl.org/group/perl.perl5.porters/257128

4 years agofixup to "avoid identical stack traces"
David Mitchell [Thu, 12 Mar 2020 14:14:24 +0000 (14:14 +0000)]
fixup to "avoid identical stack traces"

GH #15109, #17567

My original fix for this issue, v5.31.6-141-gf2f32cd638
made a shallow copy of &PL_compiling. However, for non-default
warning bits, this made two COPs share the malloced() cop_warnings,
and bad things ensured. In particular this was flagged up in:

    GH #17567: "BBC: AYOUNG/OpenVZ-0.01.tar.gz"

The fix in this commit is to do a deep copy of the COP using
newSTATEOP().

4 years agoCI do not abort a build too early
Nicolas R [Thu, 12 Mar 2020 14:57:59 +0000 (08:57 -0600)]
CI do not abort a build too early

Currently the 32bit smokers are broken due to some
deps issues. We could consider disable them but it's
better that they do not impact other smokers.

4 years agoRevert "Avoid failures from Install 32bit dependencies issues"
Nicolas R [Thu, 12 Mar 2020 14:56:36 +0000 (08:56 -0600)]
Revert "Avoid failures from Install 32bit dependencies issues"

This reverts commit 29a8ce81089f5cf0be406bc203e22cbe4dc52584.

4 years agogh#10059 - potentially reduce -Wall warnings on plan9. Not tested.
Richard Leach [Sat, 15 Feb 2020 01:34:57 +0000 (01:34 +0000)]
gh#10059 - potentially reduce -Wall warnings on plan9. Not tested.

4 years agoAvoid failures from Install 32bit dependencies issues
Nicolas R [Wed, 11 Mar 2020 22:12:14 +0000 (16:12 -0600)]
Avoid failures from Install 32bit dependencies issues

Multiple CI build failed due to 32 bits dependencies
issues. Let's try to move them as optional.

4 years agoop.c: S_fold_constants_eval can't be inlined
Karl Williamson [Tue, 10 Mar 2020 04:27:34 +0000 (22:27 -0600)]
op.c: S_fold_constants_eval can't be inlined

Because it uses setjmp, is what g++ says

4 years agoStop requesting inlining some functions in recomp.c
Karl Williamson [Tue, 10 Mar 2020 00:28:47 +0000 (18:28 -0600)]
Stop requesting inlining some functions in recomp.c

Pattern compilation is not a performance critical process; there's no
need to request these to be inlined.  Let the compiler decide, given
they are static anyway.  This came up because g++ was warning they
weren't getting inlined anyway.

4 years agoRevert "croak_memory_wrap is an inline function."
Karl Williamson [Mon, 9 Mar 2020 23:47:09 +0000 (17:47 -0600)]
Revert "croak_memory_wrap is an inline function."

This reverts commit 6c714a09cc08600278e72aea1fcdf83576d061b4.
croak_memory_wrap is designed to save a few bytes of memory, and was
never intended to be inlined.  This commit moves it to util.c where the
other croak functions are.

4 years agoregexec.c: Clean up debug call
Hugo van der Sanden [Tue, 10 Mar 2020 19:05:55 +0000 (13:05 -0600)]
regexec.c: Clean up debug call

The code this replaces relies on the internal structure of a macro,
which can change and break things.  This commit changes to use a more
straight forward way of accomplishing the same thing.

4 years agoRmv obsolete function
Karl Williamson [Wed, 11 Mar 2020 22:16:18 +0000 (16:16 -0600)]
Rmv obsolete function

Use of this function was removed as part of adding wildcarding to the
Unicode name property

4 years agouse re qw(debug foo) should warn
Karl Williamson [Fri, 6 Mar 2020 00:25:26 +0000 (17:25 -0700)]
use re qw(debug foo) should warn

Instead, foo was silently ignored

4 years agoAllow debugging from regexec.c back to regcomp.c
Karl Williamson [Tue, 25 Feb 2020 05:25:07 +0000 (22:25 -0700)]
Allow debugging from regexec.c back to regcomp.c

The compilation of User-defined properties in a regular expression that
haven't been defined at the time that pattern is compiled is deferred
until execution time.  Until this commit, any request for debugging info
on those was ignored.

This fixes that by

4 years agoregcomp.c: Update comments
Karl Williamson [Thu, 20 Feb 2020 20:14:56 +0000 (13:14 -0700)]
regcomp.c: Update comments

4 years agolib/charnames.t: White-space only
Karl Williamson [Thu, 20 Feb 2020 19:27:53 +0000 (12:27 -0700)]
lib/charnames.t: White-space only

4 years agoregen/opcodes: Clarify comment
Karl Williamson [Wed, 11 Mar 2020 20:23:18 +0000 (14:23 -0600)]
regen/opcodes: Clarify comment

4 years agomake_ext.pl should use current Perl to run Makefile.PL
Nicolas R [Wed, 11 Mar 2020 17:15:26 +0000 (11:15 -0600)]
make_ext.pl should use current Perl to run Makefile.PL

4 years agoAdd thread safety to some environment accesses
Karl Williamson [Fri, 6 Mar 2020 21:18:45 +0000 (14:18 -0700)]
Add thread safety to some environment accesses

The previous commit added a mutex specifically for protecting against
simultaneous accesses of the environment.  This commit changes the
normal getenv, putenv, and clearenv functions to use it, to avoid races.

This makes the code simpler in places where we've gotten burned and
added stuff to avoid races.  Other places where we haven't known we were
getting burned could have existed until now.  Now that comes
automatically, and we can remove the special cases we earlier stumbled
over.

getenv() returns a pointer to static memory, which can be overwritten at
any moment from another thread, or even another getenv from the same
thread.  This commit changes the accesses to be under control of a
mutex, and in the case of getenv, a mortalized copy is created so that
there is no possible race.

4 years agoAdd mutex for accessing ENV
Karl Williamson [Thu, 20 Feb 2020 23:51:31 +0000 (16:51 -0700)]
Add mutex for accessing ENV

4 years agoCreate new PUSHSTACKi for regcomp.c
Karl Williamson [Tue, 10 Mar 2020 04:21:31 +0000 (22:21 -0600)]
Create new PUSHSTACKi for regcomp.c

See previous commit.

4 years agocop.h: Add comment
Karl Williamson [Mon, 9 Mar 2020 23:29:22 +0000 (17:29 -0600)]
cop.h: Add comment

4 years agoImplement \p{Name=/.../} wildcards
Karl Williamson [Sat, 15 Feb 2020 21:28:32 +0000 (14:28 -0700)]
Implement \p{Name=/.../} wildcards

This commit adds wildcard subpatterns for the Name and Name Aliases
properties.

4 years agocharnames.pm: Make a variable ReadOnly
Karl Williamson [Mon, 9 Mar 2020 22:57:23 +0000 (16:57 -0600)]
charnames.pm: Make a variable ReadOnly

This is in preparation for exporting it in the next commit.

4 years agomktables: Calculate legal chars in algorithmic names
Karl Williamson [Mon, 24 Feb 2020 20:35:01 +0000 (13:35 -0700)]
mktables: Calculate legal chars in algorithmic names

Many ideographic character names are of the form 'prefix-code_point'.
For these, we know that the legal names are just the ones in the prefix,
the dash, and uppercase hex digits.  This commit for each series of
these types of names figures out what characters are legal in that
series, and adds that info to the hash describing the series.  This will
be used in a later commit to rule out entire series when matching
under some circumstances, without having to try any individual matches
within it.

4 years agolib/_charnames.pm: Fix comment
Karl Williamson [Mon, 9 Mar 2020 22:26:52 +0000 (16:26 -0600)]
lib/_charnames.pm: Fix comment