This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
18 months agoadd perlhist entry for 5.37.5 v5.37.5
Todd Rinaldo [Thu, 20 Oct 2022 03:08:07 +0000 (03:08 +0000)]
add perlhist entry for 5.37.5

18 months agoUpdate perldelta for 5.37.5 release.
Todd Rinaldo [Wed, 19 Oct 2022 21:50:16 +0000 (21:50 +0000)]
Update perldelta for 5.37.5 release.

- New modules.
- Provide thanks.
- Removed empty sections.
- VMS configure changes.

18 months agoUpdate Module::CoreList for 5.37.5
Todd Rinaldo [Wed, 19 Oct 2022 22:18:20 +0000 (22:18 +0000)]
Update Module::CoreList for 5.37.5

18 months agoAdd some perldelta entries for 5.37.5
Karl Williamson [Thu, 20 Oct 2022 13:10:14 +0000 (07:10 -0600)]
Add some perldelta entries for 5.37.5

18 months agoFuture proof archname on VMS
Craig A. Berry [Wed, 19 Oct 2022 12:29:14 +0000 (07:29 -0500)]
Future proof archname on VMS

OpenVMS x86_64 is out and should be getting a native (not cross)
C compiler Real Soon Now.  So prepare for that and try to get the
archname in a fashion that will work for any future architectures.

18 months agoUpdate Memoize to CPAN version 1.14
Todd Rinaldo [Wed, 19 Oct 2022 17:42:37 +0000 (17:42 +0000)]
Update Memoize to CPAN version 1.14

[DELTA]

1.14  Sun 16 Oct 2022
  * No recursion depth warning from the Memoize wrapper function.
    This was a backcompat breakage in 1.09

1.13  Tue 30 Aug 2022
  * No functional changes
  * Further test fixes

1.12  Mon 29 Aug 2022
  * No functional changes
  * Test fixes

1.11  Sun 28 Aug 2022
  * Large test suite refactor
  * Additional tests
  * Updated packaging and package metadata

18 months agoUpdate Net-Ping to CPAN version 2.75
Todd Rinaldo [Wed, 19 Oct 2022 16:11:34 +0000 (16:11 +0000)]
Update Net-Ping to CPAN version 2.75

[DELTA]

2.75  2022-09-01 12:44:03 rurban
      Minor
      - Modernized the synopsis (https://github.com/rurban/Net-Ping/pull/31)
      - Fixed a link in a comment (https://github.com/rurban/Net-Ping/pull/25)
      META Changes
      - Remove some TEST_REQUIRES (https://github.com/rurban/Net-Ping/pull/23)
      Test fixes
      - Support NO_NETWORK_TESTING=1 (https://github.com/rurban/Net-Ping/pull/24)
      - Fix non-routable addresses for negative tests (https://github.com/rurban/Net-Ping/pull/24)

18 months agoCorrect local version of Config::Perl::V to 0.34 in Porting/Maintainers.pl
Todd Rinaldo [Wed, 19 Oct 2022 18:26:17 +0000 (18:26 +0000)]
Correct local version of Config::Perl::V to 0.34 in Porting/Maintainers.pl

18 months agoCorrect local version of ExtUtils::PL2Bat to 0.005 in Porting/Maintainers.pl
Todd Rinaldo [Wed, 19 Oct 2022 18:22:20 +0000 (18:22 +0000)]
Correct local version of ExtUtils::PL2Bat to 0.005 in Porting/Maintainers.pl

18 months agoCorrect local version of Locale::Maketext to 1.32 in Porting/Maintainers.pl
Todd Rinaldo [Wed, 19 Oct 2022 18:14:51 +0000 (18:14 +0000)]
Correct local version of Locale::Maketext to 1.32 in Porting/Maintainers.pl

18 months agoRemove ancient and broken GCC for VMS support
Craig A. Berry [Tue, 18 Oct 2022 01:05:13 +0000 (20:05 -0500)]
Remove ancient and broken GCC for VMS support

There has not been a viable GCC for VMS in a couple of decades and
the hacks and workarounds that were necessary then are unlikely to
be helpful for any future work.  Reportedly significant portions of
the GCC toolchain were available in GNAT Ada, but there was never
an independent release of the C compiler and that support has now
been removed as well.

Cleaning this up should make it easier to add alternate compiler
support in the future, such as for the clang port in progress at
VSI.

18 months agoRemove vestigial reference to /VAXC qualifier
Craig A. Berry [Fri, 14 Oct 2022 23:19:28 +0000 (18:19 -0500)]
Remove vestigial reference to /VAXC qualifier

This refers to building using DEC C but with a VAX C compatibility
mode.  Building Perl like that has not been supported for a long
time and it's not worth revisiting as that basically puts the
compiler into a K & R, pre-ANSI mode.

18 months agoRemove sharedperl option on VMS
Craig A. Berry [Fri, 14 Oct 2022 18:17:32 +0000 (13:17 -0500)]
Remove sharedperl option on VMS

This was intended to allow Perl for multiple architectures to reside
in a single installation directory tree, primarily for mixed-architecture
clusters.  Disk space is a lot cheaper than it was when this first came
along, and architecture-specific library directories have since become
a thing, so there might be a better way to do this now if it's even still
desireable.  It's unclear whether the feature has been used in recent
decades -- it certainly hasn't been tested recently.

Removing it simplifies the build and is something that doesn't have to
get fixed whenever a port to a new architecture comes along.

18 months agot/run/locale.t: Move init stmt
Karl Williamson [Wed, 24 Mar 2021 13:12:14 +0000 (07:12 -0600)]
t/run/locale.t: Move init stmt

This makes it easier to add a line to turn on debugging temporarily

18 months agorun/locale.t: Add debug info.
Karl Williamson [Sun, 2 Oct 2022 12:56:20 +0000 (06:56 -0600)]
run/locale.t: Add debug info.

This new test was missing the boilerplate (found in the other tests)
that enables debugging in fresh_perl

18 months agothreads.xs: Add _NN to SvREFCNT_dec where we know is NN
Karl Williamson [Sun, 2 Oct 2022 15:22:47 +0000 (09:22 -0600)]
threads.xs: Add _NN to SvREFCNT_dec where we know is NN

18 months agodump.c - add ways to dump HV's and AV's and SV's to any depth.
Yves Orton [Mon, 26 Sep 2022 13:00:21 +0000 (15:00 +0200)]
dump.c - add ways to dump HV's and AV's and SV's to any depth.

Currently you can use sv_dump() to dump an AV or HV as these are
still SV's underneath in C terms, but it will only dump out the top
level object and will not dump out its contents, whereas if you have
an RV which references the same AV or HV it will dump it out to depth
of 4.

This adds av_dump() and hv_dump() which dump up to a depth of 3 (thus
matching what sv_dump() would have showed had it been used to dump
an RV to the same object). It also adds sv_dump_depth() which allows
passing in an arbitrary depth. You could argue the former are redundant
in light of sv_dump_depth(), but the av_dump() and hv_dump() variants
do not require a cast for their arguments.

These functions are provided as debugging aids for development. They
aren't used directly in the core, and they all wrap the same core
routine that is used for sv_dump() (do_sv_dump()).

18 months agolocale.c: Don't compile get_displayable_string if unused
Karl Williamson [Sat, 15 Oct 2022 18:54:47 +0000 (12:54 -0600)]
locale.c: Don't compile get_displayable_string if unused

This was generating warnings on several different platforms

18 months agot/test.pl: Outdent a wrongly indented line
Karl Williamson [Wed, 12 Oct 2022 15:51:23 +0000 (09:51 -0600)]
t/test.pl: Outdent a wrongly indented line

18 months agopat_advanced.t: Cancel a watchdog timer
Karl Williamson [Wed, 12 Oct 2022 15:53:15 +0000 (09:53 -0600)]
pat_advanced.t: Cancel a watchdog timer

This timer had been skipped until
91d110e02db3b8905c4c48d5fdd76a8439de31f3.  But with it enabled, on
slower or heavily loaded systems the test file does not always complete.
Take advantage of the new ability to cancel watchdog timers to prevent
this situation.

Another possibility would to have been to move this test to be the final
one in the file.  But then effort has to be expended to keep it in that
position as new tests are added; and what if such tests also require a
watchdog?  It's simplest to have the watchdog affect only the single
test that needs it.

Yet another possibility is to make this test into fresh_perl.  But that
sort of interferes with what t/re/pat_advanced_thr.t does.

18 months agot/test.pl: Add ability to cancel an watchdog timer
Karl Williamson [Fri, 14 Oct 2022 14:01:58 +0000 (08:01 -0600)]
t/test.pl: Add ability to cancel an watchdog timer

A watchdog affects the entire rest of the file.  As more tests get added
to a test file, they could end up triggering the watchdog.  This commit
adds the capability to cancel a watchdog if the potentially problematic
test finishes in time.

18 months agoRevert code changes for Workaround for attributes.pm breakage
Karl Williamson [Thu, 29 Sep 2022 18:56:06 +0000 (12:56 -0600)]
Revert code changes for Workaround for attributes.pm breakage

This partially reverts ebb1d9ce1d2cad3a1ef580148b3788cba3524319.

The real fix for this problem has now been committed, so the workaround
can be reverted, leaving the tests.

18 months agoSwitch libc per-interpreter data when tTHX changes
Karl Williamson [Thu, 29 Sep 2022 18:51:21 +0000 (12:51 -0600)]
Switch libc per-interpreter data when tTHX changes

As noted in the previous commit, some library functions now keep
per-thread state.  So far the only ones we care about are libc
locale-changing ones.

When perl changes threads by swapping out tTHX, those library functions
need to be informed about the new value so that they remain in sync with
what perl thinks the locale should be.

This commit creates a function to do this, and changes the
thread-changing macros to also call this as part of the change.

For POSIX 2008, the function just calls uselocale() using the
per-interpreter object introduced previously.

For Windows, this commit adds a per-interpreter string of the current
LC_ALL, and the function calls setlocale on that.  We keep the same
string for POSIX 2008 implementations that lack querylocale(), so this
commit just enables that variable on Windows as well.  The code is
already in place to free the memory the string occupies when done.

The commit also creates a mechanism to skip this during thread
destruction.  A thread in its death throes doesn't need to have accurate
locale information, and the information needed to map from thread to
what libc needs to know gets destroyed as part of those throes, while
relics of the thread remain.  I couldn't find a way to accurately know
if we are dealing with a relic or not, so the solution I adopted was to
just not switch during destruction.

This commit completes fixing #20155.

18 months agoSome locale operations need to be done in proper thread
Karl Williamson [Thu, 29 Sep 2022 15:38:36 +0000 (09:38 -0600)]
Some locale operations need to be done in proper thread

This is a step in solving #20155

The POSIX 2008 locale API introduces per-thread locales.  But the
previous global locale system is retained, probably for backward
compatibility.

The POSIX 2008 interface causes memory to be malloc'd that needs to be
freed.  In order to do this, the caller must first stop using that
memory, by switching to another locale.  perl accomplishes this during
termination by switching to the global locale, which is always available
and doesn't need to be freed.

Perl has long assumed that all that was needed to switch threads was to
change out tTHX.  That's because that structure was intended to hold all
the information for a given thread.  But it turns out that this doesn't
work when some library independently holds information about the
thread's state.  And there are now some libraries that do that.

What was happening in this case was that perl thought that it was
sufficient to switch tTHX to change to a different thread in order to do
the freeing of memory, and then used the POSIX 2008 function to change
to the global locale so that the memory could be safely freed.  But the
POSIX 2008 function doesn't care about tTHX, and actually was typically
operating on a different thread, and so changed that thread to the global
locale instead of the intended thread.  Often that was the top-level
thread, thread 0.  That caused whatever thread it was to no longer be in
the expected locale, and to no longer be thread-safe with regards to
localess,

This commit causes locale_term(), which has always been called from the
actual terminating thread that POSIX 2008 knows about, to change to the
global thread and free the memory.

It also creates a new per-interpreter variable that effectively maps the
tTHX thread to the associated POSIX 2008 memory.  During
perl_destruct(), it frees the memory this variable points to, instead of
blindly assuming the memory to free is the current tTHX thread's.

This fixes the symptoms associtated with #20155, but doesn't solve the
whole problem.  In general, a library that has independent thread status
needs to be updated to the new thread when Perl changes threads using
tTHX.  Future commits will do this.

18 months agolocale.c: Do uselocale() earlier in init process
Karl Williamson [Thu, 29 Sep 2022 15:49:40 +0000 (09:49 -0600)]
locale.c: Do uselocale() earlier in init process

This prevents some unnecessary steps, that the next commit would turn
into memory leaks.

18 months agolocale.c: Compile display fcn under more circumstances
Karl Williamson [Sat, 1 Oct 2022 19:43:54 +0000 (13:43 -0600)]
locale.c: Compile display fcn under more circumstances

This is in preparation for it to be used in more instances in future
commits.  It uses a symbol that won't be defined until those commits.

18 months agolocale: Create special variable to hold current LC_ALL
Karl Williamson [Mon, 3 Oct 2022 14:33:55 +0000 (08:33 -0600)]
locale: Create special variable to hold current LC_ALL

Some configurations require us to store the current locale for each
category.  Prior to this commit, this was done in the array
PL_curlocales, with the entry for LC_ALL being in the highest element.

Future commits will need just the value for LC_ALL in some other
configurations, without needing the rest of the array.  This commit
splits off the LC_ALL element into its own per-interpreter variable to
accommodate those.  It always had to have special handling anyway beyond
the rest of the array elements,

18 months agoClean up perl.h/makedef.pl common logic
Karl Williamson [Mon, 3 Oct 2022 00:30:44 +0000 (18:30 -0600)]
Clean up perl.h/makedef.pl common logic

This has gotten two twisty little mazy over time.  Clean it up, add
comments, and make sure the logic is the same on both.

18 months agoDon't #define USE_THREAD_SAFE LOCALE unless threaded
Karl Williamson [Sat, 1 Oct 2022 17:20:04 +0000 (11:20 -0600)]
Don't #define USE_THREAD_SAFE LOCALE unless threaded

If there aren't threads, yes locales are trivially thread-safe, but
the code that gets executed to make them so doesn't need to get
compiled, and that is controlled by this #define.

18 months agosv.c: Set phase to CONSTRUCT on interpreter being cloned
Karl Williamson [Thu, 29 Sep 2022 18:33:21 +0000 (12:33 -0600)]
sv.c: Set phase to CONSTRUCT on interpreter being cloned

So far this hadn't been an issue, but it will be for a future commit.

18 months agosv.c: Clone interpreter with locale set to C
Karl Williamson [Tue, 27 Sep 2022 21:51:16 +0000 (15:51 -0600)]
sv.c: Clone interpreter with locale set to C

A thread is supposed to start with the locale set to the C locale.  We
were duping the parent values, and later overriding.  Better to set to C
from the beginning.

18 months agosv.c: Move some code; consolidate
Karl Williamson [Tue, 27 Sep 2022 19:53:08 +0000 (13:53 -0600)]
sv.c: Move some code; consolidate

This moves the code for cloning the locale variables to a single place,
consolidating some that had the same cpp directives.  It showed that one
variable was cloned twice; the redundant one is now removed.

18 months agoperldelta for b0bc598140d48
Tony Cook [Mon, 17 Oct 2022 23:01:20 +0000 (10:01 +1100)]
perldelta for b0bc598140d48

18 months agohandle intermediate pads not including the name in find_lexical_cv()
Tony Cook [Thu, 25 Aug 2022 06:02:25 +0000 (16:02 +1000)]
handle intermediate pads not including the name in find_lexical_cv()

In the following each line is the pad for a scope, starting from
the outermost scope.

In non-eval cases a use of a lexical symbol in an inner pad
also adds that name to the pad in the intermediate scope.  So for
code like:

  my $bar;
  sub foo { ... }
  sub f { sub g { foo($bar) } }

we might get pads like:

  [&foo] [$bar]  # defining pad
  [&foo] [$bar]  # intermediate pad (for f)
  [&foo] [$bar]  # using pad (for g)

and each inner pad has an index of the same name in the parent
scope.  find_lexical_cv() followed that chain of indexes to find
the definition, or at least the prototype, of the lexical sub.

Unfortunately names can only be added to the pad at compile-time,
so for an eval the intermediate scope is closed to further
modifications, and the pad for the intermediate scope doesn't
get an entry for the name, so code like:

  my $bar;
  sub foo { ... }
  sub f { eval 'foo($bar)' }

we get pads like:

  [&foo] [$bar]  # defining pad
                 # intermediate pad (f) doesn't have the names
  [&foo] [$bar]  # eval 'foo($bar)' pad

but find_lexical_cv() assumed that the names would always exist
in the intermediate pads, and failed an assertion.

find_lexical_cv() now falls back to searching for the cv by name
up the chain of nested pads.

This doesn't fix a slightly related problem:

  my sub foo { }
  BEGIN {
    foo(); # Undefined subroutine &foo
  }

The fix for that may make find_lexical_cv() unnecessary, but is a
more complex fix.

18 months agoAvoid excess flood from IRC notifications workflow
Nicolas R [Fri, 14 Oct 2022 21:03:19 +0000 (15:03 -0600)]
Avoid excess flood from IRC notifications workflow

The IRC github workflow fails unexpectedly from time
to time. We should enforce a size limit to the message
we send (Some recent commit messages can be pretty
long).

Shorten Pull Requests title and body for IRC bot.

The default timeout is 6 hours which is much longer
than needed to parse the git commits and submit
a few IRC notifications if needed.
Adding a timeout to the job should avoid long stall runs.

We do not want the irc workflow to spoil resources and
prefer using it for running unit tests.

Use consistent heredoc token 'EOS' to setup variables.

18 months agoDon't set OPf_REF on OP_ANONCODE during op_lvalue()
Paul "LeoNerd" Evans [Sat, 15 Oct 2022 16:49:18 +0000 (17:49 +0100)]
Don't set OPf_REF on OP_ANONCODE during op_lvalue()

Doing so will upset XS code that manually builds optrees using OP_REFGEN
+ OP_ANONCODE (as would be required prior to perl 5.37.3), causing a
double-reference to be generated.

(Fixes https://github.com/Perl/perl5/issues/20384 )

18 months agoperlsub - replace uses of $a and $b in examples
Dan Book [Mon, 17 Oct 2022 02:12:47 +0000 (22:12 -0400)]
perlsub - replace uses of $a and $b in examples

replace $a and $b in examples to avoid recommending their use, since they aren't treated as normal variables by strict.
also replace $c and $d when used in the same examples so it looks consistent.

18 months agoperldelta for e2d2ca12ad65
Tony Cook [Mon, 17 Oct 2022 00:28:56 +0000 (11:28 +1100)]
perldelta for e2d2ca12ad65

18 months agoend of file (^D on POSIX-likes) now behaves like q as documented
Tony Cook [Wed, 21 Sep 2022 23:41:36 +0000 (09:41 +1000)]
end of file (^D on POSIX-likes) now behaves like q as documented

This was originally reported againt 5.36.0 where ^D would act
more like 'n' than 'q':

$ ~/perl/v5.36.0-clang14/bin/perl -lde 'print 1; print 2; print 3;'

Loading DB routines from perl5db.pl version 1.73
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main::(-e:1):   print 1; print 2; print 3;
  DB<1> 1
main::(-e:1):   print 1; print 2; print 3;
  DB<1> 2
main::(-e:1):   print 1; print 2; print 3;
  DB<1> 3

(^D at each prompt)

Post 80c1f1e4 this behaved a little differently, since reading ^D
from the stream now sets the eof() flag readline() would return
immediately after each attempt, instead of reading a command.

This produced the same output as above, but only required a single ^D.

But neither of these is correct, both 'q' and ^D are documented to
exit the debugger, and 'q' does that, this changes eof to also
exit the debugger.

Unfortunately the perl5db test infrastructure doesn't support
testing this, and due to the way the debugger interacts with the
terminal, I don't think this is easily tested in core.  I think
a module like Expect or IPC::Run that can interact with a terminal
would be needed.

18 months agolocale.c: Silence unused var warning on freebsd
Karl Williamson [Sun, 9 Oct 2022 19:21:04 +0000 (13:21 -0600)]
locale.c: Silence unused var warning on freebsd

This just moves some code out of #ifdefs so that the compiler sees
it, decides it is always false, and almost certainly won't generate any
code for it, but stops warning.

18 months agolocale.c: Fix Debug statement on netbsd
Karl Williamson [Wed, 12 Oct 2022 12:42:25 +0000 (06:42 -0600)]
locale.c: Fix Debug statement on netbsd

Other platforms declare the nl_item typedef an int, but this one makes
it a long.  To portably output its value, cast it to a long and use the
%ld format.

18 months agoUse `LINE_Tf` for formatting line numbers
TAKAI Kousuke [Wed, 5 Oct 2022 14:34:18 +0000 (23:34 +0900)]
Use `LINE_Tf` for formatting line numbers

18 months agotoke.c: Use `line_t` (rather than `I32`) to hold the value of `CopLINE()`
TAKAI Kousuke [Wed, 5 Oct 2022 14:04:17 +0000 (23:04 +0900)]
toke.c: Use `line_t` (rather than `I32`) to hold the value of `CopLINE()`

18 months agoUse `LINE_Tf` thoroughly for formatting the value of CopLINE()
TAKAI Kousuke [Tue, 4 Oct 2022 14:58:33 +0000 (23:58 +0900)]
Use `LINE_Tf` thoroughly for formatting the value of CopLINE()

The value of CopLINE() used to be formatted with various way; sometimes
with `%ld` and `(long)` cast, sometimes `IVdf` and `(IV)` cast, or `%d`
and so on.

18 months agolocale.c: Add explicit (line_t) cast to silence DEBUGGING build warnings
TAKAI Kousuke [Wed, 28 Sep 2022 13:15:49 +0000 (22:15 +0900)]
locale.c: Add explicit (line_t) cast to silence DEBUGGING build warnings

Warning fixed:

    locale.c:130:55: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘int’ [-Wformat=]
      130 |      dSAVE_ERRNO; dTHX; PerlIO_printf(Perl_debug_log, "\n%s: %" LINE_Tf ": ",   \
          |                                                       ^~~~~~~~~

This warning might be only on 32-bit build.

18 months agoExtend testsuite.yml to 'select' which jobs to run
Bram [Thu, 15 Sep 2022 19:28:20 +0000 (21:28 +0200)]
Extend testsuite.yml to 'select' which jobs to run

For the Perl/perl5 repository nothing changes.

For a fork of perl5 the user now has some more control to select which
jobs to run. This is done by setting the appropriate secrets.

Before this commit one could choose to:
- run no tests (= GitHub Actions disabled)
- run 'Sanity Check' (= GitHub Actions enabled)
- run all jobs (= GitHub Actions enabled + EXTENDED_TESTING secret added)

With this commit specific jobs can be enabled by adding a secret
with a true value.

For example: setting `CI_FORCE_CYGWIN=1` in the Secrets will cause it to
run the 'Sanity Check' job and the Cygwin' job. All other jobs are skipped.

(See the docs in the file to see the full list of Secrets)

18 months agotestsuite.yml: Check for false value
Bram [Thu, 15 Sep 2022 19:26:14 +0000 (21:26 +0200)]
testsuite.yml: Check for false value

Extend the 'EXTENDED_TESTING' check to differentiate between a true
and a false value.

With the original check: setting 'EXTENDED_TESTING' to 0 would cause
all jobs to be run which is not very logical. The only way to disable
it is/was to completely remove the 'EXTENDED_TESTING' secret.

With this commit it can be disabled by setting 'EXTENDED_TESTING' to '0'
(or '00000000' or '     ' or '  0  0 0000 00  ' or ...)

18 months agotestsuite.yml: Split "run_all_jobs" logic
Bram [Thu, 15 Sep 2022 19:25:37 +0000 (21:25 +0200)]
testsuite.yml: Split "run_all_jobs" logic

This is in preparation of the next commit which will alter
the `[[ -n "${EXTENDED_TESTING}" ]]` condition.

18 months agoAdd some docs for workflow/testsuite.yml
Bram [Thu, 15 Sep 2022 19:25:22 +0000 (21:25 +0200)]
Add some docs for workflow/testsuite.yml

18 months agoUse cancelled() instead of always()
Bram [Thu, 15 Sep 2022 19:23:45 +0000 (21:23 +0200)]
Use cancelled() instead of always()

The use of `always()` made it impossible to cancel the workflow.

From https://docs.github.com/en/actions/managing-workflow-runs/canceling-a-workflow :
    To cancel the workflow run, the server re-evaluates if conditions for all
    currently running jobs. If the condition evaluates to true, the job will
    not get canceled. For example, the condition if: always() would evaluate
    to true and the job continues to run.

-> Replace `always()` with `! cancelled()`

18 months agoAlso run 'dist-modules' when porting test fails
Bram [Thu, 15 Sep 2022 19:22:43 +0000 (21:22 +0200)]
Also run 'dist-modules' when porting test fails

This to make it similar to all other jobs: when (only) the porting
test fails then all other jobs should still run.

18 months agoMath-Complex: list all imported constants in POD
Peter John Acklam [Fri, 19 Aug 2022 18:53:44 +0000 (20:53 +0200)]
Math-Complex: list all imported constants in POD

The constant 'pi4' (= 4*pi) is imported, but is missing from the list of
imported constants in the SYNOPSIS.

This fixes CPAN RT #102544

For: https://github.com/Perl/perl5/pull/20120

18 months agoJSON::PP: Synch with CPAN version 4.12
Kenichi Ishigaki [Mon, 10 Oct 2022 21:51:39 +0000 (21:51 +0000)]
JSON::PP: Synch with CPAN version 4.12

From Changes: Call unimport overload first to silence warnings.
(https://github.com/makamaka/JSON-PP/issues/76, haarg++)

Committer: To keep 'make test_porting' happy, run:
    cd t; ./perl porting/regen.t; cd -
    ./perl -Ilib Porting/makemeta -j

18 months agohandy.h: Set macro to false if can't ever be true
Karl Williamson [Sat, 8 Oct 2022 12:49:01 +0000 (06:49 -0600)]
handy.h: Set macro to false if can't ever be true

It's unlikely that perl will be compiled with out the LC_CTYPE locale
category being enabled.  But if it isn't, there is no sense in having
per-interpreter variables for various conditions in it, and no sense
having code that tests those variables.

This commit changes a macro to always yield 'false' when this is
disabled, adds a new similar macro, and changes some occurrences that
test for a variable to use the macros instead of the variables.  That
way the compiler knows these to conditions can never be true.

18 months agomakedef.pl Skip PL_in_utf8_COLLATE_locale if no LC_COLLATE
Karl Williamson [Sat, 8 Oct 2022 17:11:15 +0000 (11:11 -0600)]
makedef.pl Skip PL_in_utf8_COLLATE_locale if no LC_COLLATE

This fixes #20371

18 months agolocale.c: Add comments/white space; slight tidying
Karl Williamson [Wed, 5 Oct 2022 02:39:06 +0000 (20:39 -0600)]
locale.c: Add comments/white space; slight tidying

C99 allows declarations to be closer to their first use.  This also
removes a redundant conditional that would set a variable to what it
already was initialized to.

18 months agolocale.c: Make win32_setlocale return const *
Karl Williamson [Thu, 6 Oct 2022 15:12:59 +0000 (09:12 -0600)]
locale.c: Make win32_setlocale return const *

Add a bit of safety, and makes it correspond to the other setlocale
returns we use.

18 months agoAdd some const to wrap_wsetlocale
Karl Williamson [Tue, 4 Oct 2022 16:58:16 +0000 (10:58 -0600)]
Add some const to wrap_wsetlocale

And move declarations closer to first use as allowed in C99

18 months agolocale.c: Generalize static functions
Karl Williamson [Tue, 4 Oct 2022 11:04:32 +0000 (05:04 -0600)]
locale.c: Generalize static functions

This changes these functions to take the code page as input, instead of
being just UTF-8.  Macros are created to call them with UTF-8.

I'm doing this because there is no loss of efficiency, and it is
somewhat jarring, given Perl terminology, to call a function with 'Byte'
in the name with a parameter with 'utf8' in the name.

18 months agolocale.c: Make static 2 Win-only functions
Karl Williamson [Tue, 4 Oct 2022 10:49:47 +0000 (04:49 -0600)]
locale.c: Make static 2 Win-only functions

These are non-API, used in this file, and because of #ifdefs, not
accessible outside it, so there is no current need to make them publicly
available.  If we were ever to need them to be accessible more widely,
they would not belong in this file.

18 months agolocale.c: Remove unused cpp alternatives
Karl Williamson [Wed, 5 Oct 2022 02:43:30 +0000 (20:43 -0600)]
locale.c: Remove unused cpp alternatives

The wide setlocale function in Windows has been in the field since 5.32,
long enough, that we won't be forced to discontinue its use.  So can
remove the never-used overrides, cleaning it up slightly

18 months agolocale.c: Windows special case NULL input first
Karl Williamson [Wed, 5 Oct 2022 02:32:38 +0000 (20:32 -0600)]
locale.c: Windows special case NULL input first

This gets the trivial case out of the way, and can use plain setlocale,
as the locale string is non-existent, so doesn't need to handle
different character sets.

18 months agolocale.c: Allow function to have side effects
Karl Williamson [Thu, 6 Oct 2022 13:46:43 +0000 (07:46 -0600)]
locale.c: Allow function to have side effects

The previous commit changed find_locale_from_environment() to work on
Windows, and took care to not make the function have side effects.  But
in the only use of this function so far (and likely forever), those side
effects are fine.  Changing to allow them simplifies things.

18 months agolocale.c: Meld two functions into one
Karl Williamson [Thu, 6 Oct 2022 13:39:22 +0000 (07:39 -0600)]
locale.c: Meld two functions into one

There is code in locale.c to emulate POSIX 'setlocale(foo, "")'.  And
there is separate code to emulate this on Windows.  This commit
collapses them, ensuring the same algorithm is used on both systems.

18 months agolocale.c: Refactor S_find_locale_from_environment()
Karl Williamson [Wed, 5 Oct 2022 15:46:25 +0000 (09:46 -0600)]
locale.c: Refactor S_find_locale_from_environment()

This changes this function a bit to make the next commit easier, which
will extend the function to being usable from Windows.  This also moves
declarations closer to first use, as now allowed in C99.

18 months agolocale.c: Move find_locale_from_environment() in file
Karl Williamson [Wed, 5 Oct 2022 12:35:19 +0000 (06:35 -0600)]
locale.c: Move find_locale_from_environment() in file

This is in preparation for this function to be used under more
circumstances.

18 months agoAdd wrap_wsetlocale() to embed.fnc
Karl Williamson [Wed, 5 Oct 2022 02:39:02 +0000 (20:39 -0600)]
Add wrap_wsetlocale() to embed.fnc

This makes the calls to it cleaner.

18 months agoperldelta for a37e8492a204, 35458d36d3c9
Tony Cook [Sun, 9 Oct 2022 21:58:16 +0000 (08:58 +1100)]
perldelta for a37e8492a20435458d36d3c9

18 months agoCompile anonymous subs as anoncode without srefgen.
Felipe Gasper [Mon, 12 Sep 2022 12:58:00 +0000 (08:58 -0400)]
Compile anonymous subs as anoncode without srefgen.

Heretofore the compiler represented an anonymous subroutine as an
anoncode op then an srefgen op; the latter’s only purpose was to
return a reference to the anoncode’s returned CV.

This changeset slightly optimizes that by making pp_anoncode return
a reference if so bidden. The same optimization is applied to
pp_anonconst as well.

Deparse.pm is updated accordingly.

18 months agoAdd anonconst test to Deparse.t
Felipe Gasper [Mon, 12 Sep 2022 15:41:08 +0000 (11:41 -0400)]
Add anonconst test to Deparse.t

18 months agoAllow non-ASCII locale names
Karl Williamson [Thu, 29 Sep 2022 12:12:58 +0000 (06:12 -0600)]
Allow non-ASCII locale names

Locale names are supposed to be opaque to the calling program.  The
only requirement is that any name output by libc means the same as input
to that libc.  And it makes sense, you might very well want to have a
locale name in your native language.  This commit changes locale.c to
not impose any restrictions on the name proper.  (It should be noted,
however, other Standards have come along that specify a particular
syntax using only ASCII.  Perl needn't, and shouldn't, impose those
further restrictions.)

18 months agolocale.c: Display thread in DEBUG statements
Karl Williamson [Sun, 2 Oct 2022 13:38:56 +0000 (07:38 -0600)]
locale.c: Display thread in DEBUG statements

This makes it easier to understand what's going on in threaded perls.

18 months agoNathan Mills is now a Perl author
Nathan Mills [Tue, 4 Oct 2022 03:28:23 +0000 (20:28 -0700)]
Nathan Mills is now a Perl author

18 months agopp_pack: Suppress Cppcheck warning.
Nathan Mills [Mon, 19 Sep 2022 01:02:50 +0000 (18:02 -0700)]
pp_pack: Suppress Cppcheck warning.

Cppcheck warns about assigning the address of a stack variable to a
function parameter. This is harmless because symptr->previous is
reassigned after the recursive call to (un)pack_rec by the copying of
savsym/lookahead to the struct pointed to by symptr.

Fixes #20180.

18 months ago[doc] perlnewmod: Move links from HTTP to HTTPS
Elvin Aslanov [Mon, 3 Oct 2022 15:29:44 +0000 (19:29 +0400)]
[doc] perlnewmod: Move links from HTTP to HTTPS

Convert links to MetaCPAN, PAUSE, and CPAN to HTTPS.

They will redirect anyway.

18 months agoAdd comments to perly.y to explain token ordering
Paul "LeoNerd" Evans [Fri, 30 Sep 2022 16:19:45 +0000 (17:19 +0100)]
Add comments to perly.y to explain token ordering

Explains why KW_PACKAGE and KW_USE_or_NO appear to have the package name
and version barewords in the wrong order.

18 months agolocale.c: Fix syntax error (only when no LC_ALL)
Karl Williamson [Sun, 2 Oct 2022 18:00:06 +0000 (12:00 -0600)]
locale.c: Fix syntax error (only when no LC_ALL)

18 months agoCertain LC_CTYPE variables need to always exist
Karl Williamson [Sun, 2 Oct 2022 18:50:01 +0000 (12:50 -0600)]
Certain LC_CTYPE variables need to always exist

Commit b41c5839100237b5ac56296e146374b69a8ee83a moved some
per-interpreter variables to within an #ifdef.  I thought I had tested
it agains all reasonable combinations, but it turns out that they need
to be always defined (without further restructuring)

18 months agointrpvar.h: Consolidate some defns into #ifdefs
Karl Williamson [Mon, 12 Apr 2021 21:35:11 +0000 (15:35 -0600)]
intrpvar.h: Consolidate some defns into #ifdefs

This moves related definitions together

18 months agointrpvar.h: White space only
Karl Williamson [Mon, 12 Apr 2021 21:32:02 +0000 (15:32 -0600)]
intrpvar.h: White space only

18 months agoperl.h: Rmv nested STMT_START...END
Karl Williamson [Sun, 2 Oct 2022 14:21:40 +0000 (08:21 -0600)]
perl.h: Rmv nested STMT_START...END

The outer pair is all that is necessary.

18 months agolocale.c: Remove obsolete, unused label
Karl Williamson [Fri, 30 Sep 2022 16:19:35 +0000 (10:19 -0600)]
locale.c: Remove obsolete, unused label

18 months agoMath-Complex: fix syntax error in example
Peter John Acklam [Fri, 19 Aug 2022 18:32:43 +0000 (20:32 +0200)]
Math-Complex: fix syntax error in example

This fixes CPAN RT #131037

Committer: For https://github.com/Perl/perl5/pull/20122

18 months agoMath-Complex: update URLs
Peter John Acklam [Thu, 1 Sep 2022 19:09:59 +0000 (21:09 +0200)]
Math-Complex: update URLs

Update the URLs with formulas for computing distance, bearing,
waypoints, destination etc. on a sphere.

This fixes CPAN RT #144195

18 months agofix typo (remove redundant 'an')
Peter John Acklam [Sat, 1 Oct 2022 13:40:16 +0000 (13:40 +0000)]
fix typo (remove redundant 'an')

Committer: Substitute for: https://github.com/Perl/perl5/pull/20121/

18 months agoMove Math-Complex from cpan/ to dist/
Karl Williamson [Sat, 1 Oct 2022 03:28:19 +0000 (21:28 -0600)]
Move Math-Complex from cpan/ to dist/

This module is now being maintained by p5p now.

18 months agoRMG: Add step for deprecation/experimental resolution
Karl Williamson [Thu, 2 Jun 2022 14:50:07 +0000 (08:50 -0600)]
RMG: Add step for deprecation/experimental resolution

18 months agothread.h: White space only
Karl Williamson [Thu, 29 Sep 2022 16:17:51 +0000 (10:17 -0600)]
thread.h: White space only

18 months agoAdd pTHX to thread_locale_(init|term)
Karl Williamson [Wed, 28 Sep 2022 20:03:49 +0000 (14:03 -0600)]
Add pTHX to thread_locale_(init|term)

A future commit will want the context for more than just DEBUGGING
builds.

18 months agoMerge branch 'Add mutexes' into blead
Karl Williamson [Thu, 29 Sep 2022 19:10:49 +0000 (13:10 -0600)]
Merge branch 'Add mutexes' into blead

The vast majority of libc calls are thread-safe, but a substantial
number aren't, even ones claimed to be re-entrant. mbrlen(), for
example, may require both the locale and environment to remain unchanged
by other threads during its execution, or undefined behavior (like
segfaults) ensues. I went through the POSIX specification looking for
such calls, and also looked at likely suspects in my Ubuntu man pages.
It turns out that glibc violates POSIX in a few cases, allowing
thread-unsafe behavior even when the Standard prohibits it. A future
commit will change perlxs to include my findings. This series of commits
implements them by defining mutexes to prohibit concurrent execution of
multiple collaborating threads during critical sections. Like all
mutexes, code can simply not opt-in to using it, but this at least
causes all the perl core to conform. And the future perlxs changes will
document what XS code should do.

Another example is most time functions. tzset() is called behind the
scenes in many of them. It sets tzname[], which in many implementations
is a global variable. Thus, tzset() needs to be executed under control
of a mutex until tzname is safely copied to a per-interpreter variable.
And hence, asctime_r isn't really thread safe without a mutex
surrounding it.

On unthreaded perls, all these mutexes resolve to no-ops.

I certainly may have missed, in my search, items that should have
mutexes. Those can be added whenever any surfaces

18 months agoutil.c: Add locks around strftime() calls
Karl Williamson [Thu, 25 Mar 2021 13:02:34 +0000 (07:02 -0600)]
util.c: Add locks around strftime() calls

18 months agoPOSIX.xs: Add some mutex locks
Karl Williamson [Thu, 11 Mar 2021 13:25:54 +0000 (06:25 -0700)]
POSIX.xs: Add some mutex locks

These are needed to prevent races on at least some platforms

18 months agoAdd mutexes for various libc calls
Karl Williamson [Fri, 23 Sep 2022 00:43:23 +0000 (18:43 -0600)]
Add mutexes for various libc calls

There are various system calls used by perl that need to be protected by
a mutex in some configurations.  This commit adds the ones not
previously added, for use in future commits.  Further details are
in the merge commit message for this series of commits.

18 months agoos2: Use many reader lock instead of exclusive
Karl Williamson [Sun, 29 Nov 2020 02:08:21 +0000 (19:08 -0700)]
os2: Use many reader lock instead of exclusive

This is just reading the environment, not changing it, so many readers
can be accessing it at the same time.

18 months agoutil.c: mktime needs to run under a mutex
Karl Williamson [Sat, 13 Mar 2021 22:30:32 +0000 (15:30 -0700)]
util.c: mktime needs to run under a mutex

per the Posix standard

18 months agowin32.c: Add mutexes around some calls
Karl Williamson [Sun, 6 Dec 2020 23:59:08 +0000 (16:59 -0700)]
win32.c: Add mutexes around some calls

These could have races.

18 months agoAdd mutexes around calls in pp_sys.c
Karl Williamson [Mon, 7 Dec 2020 00:16:16 +0000 (17:16 -0700)]
Add mutexes around calls in pp_sys.c

If there is no reentrant form of the function, these still won't be
thread safe, but doing that is better done in reentr.c.  It is on my
TODO list.

18 months agotime64.c: Remove no longer needed code
Karl Williamson [Sun, 6 Dec 2020 23:58:05 +0000 (16:58 -0700)]
time64.c: Remove no longer needed code

This code defined some macros; those are now defined by perl.h

18 months agoperl.h: Finish implementing combo ENV/LOCALE mutexes
Karl Williamson [Tue, 1 Dec 2020 14:34:20 +0000 (07:34 -0700)]
perl.h: Finish implementing combo ENV/LOCALE mutexes

There are cases where an executing function is vulnerable to either the
locale or environment being changed by another thread.  This commit
implements macros that use mutexes to protect these critical sections.
There are two cases that exist:  one where the functions only read; and
one where they can also need exclusive control so that a competing
thread can't overwrite the returned static buffer before it is safely
copied.

5.32 had a placeholder for these, but didn't actually implement it.
Instead it locked just the ENV portion.  On modern platforms with
thread-safe locales, the locale portion is a no-op anyway, so things
worked on them.

This new commit extends that safety to other platforms.  This has long
been a vulnerability in Perl.

18 months agoperl.h: Move some statements
Karl Williamson [Tue, 8 Dec 2020 20:11:15 +0000 (13:11 -0700)]
perl.h: Move some statements

So they are closer to related statements