This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
20 months agolocale.c: Stop compiler warning
Karl Williamson [Thu, 22 Sep 2022 23:19:11 +0000 (17:19 -0600)]
locale.c: Stop compiler warning

S_less_dicey_bool_setlocale_r() is a short function that makes a
complete set of similar functions, but there is no current use of it.
So just #ifdef it out.

This resolves #20338

20 months agoVMS now has mkostemp
Craig A. Berry [Sat, 24 Sep 2022 12:55:03 +0000 (07:55 -0500)]
VMS now has mkostemp

20 months agotoke.c - silence build warning for non DEBUGGING mode
Yves Orton [Sat, 24 Sep 2022 10:35:22 +0000 (12:35 +0200)]
toke.c - silence build warning for non DEBUGGING mode

A previous commit introduced the variable 'bool syntax_error' which
was only used under DEBUGGING, which produced unused variable
warnings on "production" builds. This reworks the code to not need
the variable at all.

Warning fixed:

    toke.c: In function ‘Perl_yyerror_pvn’:
    toke.c:12662:14: warning: unused variable ‘syntax_error’ [-Wunused-variable]
    12662 |         bool syntax_error = PERL_PARSE_IS_SYNTAX_ERROR(PL_error_count);
  |              ^~~~~~~~~~~~

20 months agoReclaim unused bits in ${^WARNING_BITS}
Philippe Bruhat (BooK) [Fri, 23 Sep 2022 23:51:07 +0000 (01:51 +0200)]
Reclaim unused bits in ${^WARNING_BITS}

`no warnings 'experimental::foo';` is effectively a no-op
if the `foo` feature is not experimental any more.

So, stop reserving bits in `${^WARNING_BITS}` for them,
and silently do nothing when they are enabled or disabled
via `use warnings` or `no warnings`.

Warnings turned into no-op in this commit:
* experimental::alpha_assertions
* experimental::bitwise
* experimental::isa
* experimental::lexical_subs
* experimental::postderef
* experimental::script_run
* experimental::signatures

20 months agoSO_SNDBUF requires elevated privileges on VMS
Craig A. Berry [Fri, 23 Sep 2022 17:42:17 +0000 (12:42 -0500)]
SO_SNDBUF requires elevated privileges on VMS

So we can't reasonably run a test that tries to change the socket
buffer size.

20 months agoDon't export win32-only symbols on non-Windows
Craig A. Berry [Fri, 23 Sep 2022 17:40:05 +0000 (12:40 -0500)]
Don't export win32-only symbols on non-Windows

This was causing link-time errors in the VMS build because it was
trying to export symbols that don't exist.

20 months agoRemove ~~ from autodoc.pl
Philippe Bruhat (BooK) [Wed, 7 Sep 2022 07:34:10 +0000 (09:34 +0200)]
Remove ~~ from autodoc.pl

20 months agopp_undef w/ TARGMY: push sv, not &PL_sv_undef, onto the stack
Richard Leach [Thu, 22 Sep 2022 21:20:33 +0000 (21:20 +0000)]
pp_undef w/ TARGMY: push sv, not &PL_sv_undef, onto the stack

Closes #20336.

20 months agoregcomp.c - use _simple functions where apparently safe to do so
Richard Leach [Sat, 10 Sep 2022 16:29:44 +0000 (16:29 +0000)]
regcomp.c - use _simple functions where apparently safe to do so

`av_push`, `av_store`, and `av_fetch` have been changed to their
inline `_simple` variants in a number of places. No test failures
have resulted from these changes.

The remaining uses of the full-fat functions are not suitable to
change because either the AVs have magic, or existing tests show
that the `key` parameter is not > -1 when that is a pre-requisite
of a replacement inline function.

20 months agoSvPVCLEAR_FRESH - change from macro to inline function
Richard Leach [Mon, 19 Sep 2022 19:15:39 +0000 (19:15 +0000)]
SvPVCLEAR_FRESH - change from macro to inline function

This is to prevent warnings due to the char * frequently being
unused.

20 months agolocale.c: Refactor internal debugging function
Karl Williamson [Sun, 11 Apr 2021 02:58:28 +0000 (20:58 -0600)]
locale.c: Refactor internal debugging function

setlocale_debug_string() variants  now use Perl_form, a function I
didn't know existed when I originally wrote this code.

20 months agomakedef.pl: Rmv obsolete symbol
Karl Williamson [Sun, 11 Apr 2021 02:45:23 +0000 (20:45 -0600)]
makedef.pl: Rmv obsolete symbol

This routine is now a static function, so needn't be in makedef.pl

20 months agolocale.c: Mitigate unsafe threaded locales
Karl Williamson [Sun, 14 Mar 2021 11:29:23 +0000 (05:29 -0600)]
locale.c: Mitigate unsafe threaded locales

This a new set of macros and functions to do locale changing and
querying for platforms where perl is compiled with threads, but the
platform doesn't have thread-safe locale handling.

All it does is:

1) The return of setlocale() is always safely saved in a per-thread
buffer, and
2) setlocale() is protected by a mutex from other threads which are
using perl's locale functions.

This isn't much, but it might be enough to get some programs to work on
such platforms which rarely change or query the locale.

20 months agoperl.h: Remove now empty block
Karl Williamson [Sun, 14 Mar 2021 10:12:23 +0000 (04:12 -0600)]
perl.h: Remove now empty block

Previous commits have left this empty except for comments, and
equivalent comments have also been added elsewhere

20 months agoperl.h: Move LOCALE_READ_LOCK #definition
Karl Williamson [Mon, 8 Mar 2021 12:46:25 +0000 (05:46 -0700)]
perl.h: Move LOCALE_READ_LOCK #definition

To enable future simplifications

20 months agoperl.h: Move #defining SETLOCALE_LOCK
Karl Williamson [Sun, 14 Mar 2021 03:17:29 +0000 (20:17 -0700)]
perl.h: Move #defining SETLOCALE_LOCK

This simplifies slightly, and will allow further simplification

20 months agoAdd POSIX_SETLOCALE_LOCK/UNLOCK
Karl Williamson [Mon, 8 Mar 2021 12:21:32 +0000 (05:21 -0700)]
Add POSIX_SETLOCALE_LOCK/UNLOCK

This macro is used to surround raw setlocale() calls so that the return
value in a global static buffer can be saved without interference with
other threads.

20 months agoperl5374delta: fix pod markup
Karl Williamson [Wed, 21 Sep 2022 18:44:10 +0000 (12:44 -0600)]
perl5374delta: fix pod markup

20 months agoWarnings thrown by GetOptions suffice; no need to dump POD 20320/head
James E Keenan [Sun, 18 Sep 2022 20:42:18 +0000 (20:42 +0000)]
Warnings thrown by GetOptions suffice; no need to dump POD

Many times bisect.pl will die quickly because we have misspecified our
command-line switches in ways that Getopt::Long::GetOptions() can
detect.  In this case, rather than having pod2usage() dump all the
documentation on us, let's simply rely on GetOptions() to warn us about
bad switches and then exit with same value (255) that we do in other cases.

This can be tested with an invocation like the following:

    $ perl Porting/bisect.pl \
      --start=b9d9f9ab79a4bbe3c10743b2b22828dbb8bd2a46 \
      --end=2b8a1552e222c049b05bc141f97d7349b40b3f2f \
      --target=miniperl \
      -e 'q|ace| =~ /c(?=.$)/; print ((($#{^CAPTURE} == -1) ? q|AAA| : q|BBB|), "\n") && exit 0' \
      --sumac --bluefin -j seven --validate=7 --jobs

    Unknown option: sumac
    Unknown option: bluefin
    Value "seven" invalid for option j (number expected)
    Option validate does not take an argument
    Option jobs requires an argument

(Commit began with tidying of Porting/bisect-runner.pl GetOptions call
in preparation for revisions.)

20 months agoModule::CoreList is now version 5.20220920
Karen Etheridge [Wed, 21 Sep 2022 16:29:21 +0000 (09:29 -0700)]
Module::CoreList is now version 5.20220920

20 months agomake expr parameter to newLOOPOP() NN, it was required anyway
Tony Cook [Tue, 20 Sep 2022 00:53:50 +0000 (10:53 +1000)]
make expr parameter to newLOOPOP() NN, it was required anyway

Coverity picked up that while we checked that expr was non-NULL
in newLOOPOP(), the call to new_logop() dereferenced it anyway,
the address of expr is passed to new_logop(), which sees it as firstp
(so firstp == &expr), that is then derefed to first (first == expr)
and then switches on first->op_type, hence dereferencing expr.

Since both callers always pass in an expr value, and the code
would have crashed anyway with a NULL expr, make it required.

20 months agoPrepare Module::Corelist for 5.37.5
Karen Etheridge [Wed, 21 Sep 2022 01:42:22 +0000 (18:42 -0700)]
Prepare Module::Corelist for 5.37.5

20 months agoBump the perl version in various places for 5.37.5
Karen Etheridge [Wed, 21 Sep 2022 00:47:37 +0000 (17:47 -0700)]
Bump the perl version in various places for 5.37.5

20 months agoNew perldelta for 5.37.5
Karen Etheridge [Wed, 21 Sep 2022 00:39:53 +0000 (17:39 -0700)]
New perldelta for 5.37.5

20 months agotick off 5.37.4 release
Karen Etheridge [Wed, 21 Sep 2022 00:38:49 +0000 (17:38 -0700)]
tick off 5.37.4 release

20 months agoadd epigraph for 5.37.4
Karen Etheridge [Wed, 21 Sep 2022 01:04:45 +0000 (18:04 -0700)]
add epigraph for 5.37.4

20 months agoadd perlhist entry v5.37.4
Karen Etheridge [Tue, 20 Sep 2022 23:55:55 +0000 (16:55 -0700)]
add perlhist entry

20 months agofinal perldelta fixes
Karen Etheridge [Tue, 20 Sep 2022 23:48:49 +0000 (16:48 -0700)]
final perldelta fixes

20 months agoupdate perldelta for module updates
Karen Etheridge [Tue, 20 Sep 2022 23:46:54 +0000 (16:46 -0700)]
update perldelta for module updates

20 months agoupdate Module::CoreList for 5.37.4
Karen Etheridge [Tue, 20 Sep 2022 23:44:39 +0000 (16:44 -0700)]
update Module::CoreList for 5.37.4

20 months agobump XSLoader version: see commit a635e7229b
Karen Etheridge [Tue, 20 Sep 2022 23:02:24 +0000 (16:02 -0700)]
bump XSLoader version: see commit a635e7229b

20 months agobump Safe version: see commit 3b5ec3ec
Karen Etheridge [Tue, 20 Sep 2022 23:00:56 +0000 (16:00 -0700)]
bump Safe version: see commit 3b5ec3ec

20 months agofinalize perldelta, except for module updates
Karen Etheridge [Tue, 20 Sep 2022 21:12:53 +0000 (14:12 -0700)]
finalize perldelta, except for module updates

20 months agowhitespace
Karen Etheridge [Tue, 20 Sep 2022 19:26:24 +0000 (12:26 -0700)]
whitespace

20 months agolocale.c: Workaround for attributes.pm breakage
Karl Williamson [Tue, 20 Sep 2022 13:01:24 +0000 (07:01 -0600)]
locale.c: Workaround for attributes.pm breakage

See https://github.com/Perl/perl5/issues/20155

The root cause of that problem is that under POSIX 2008, when a thread
terminates, it causes thread 0 (the controller) to change to the global
locale.  Commit a7ff7ac caused perl to pay attention to the environment
variables in effect at startup for setting the global locale when using
the POSIX 2008 locale API.  (Previously only the initial per-thread
locale was affected.)

This causes problems when the initial setting was for a locale that uses
a comma as the radix character, but the thread 0 is set to a locale that
is expecting a dot as a radix character.  Whenever another thread
terminates, thread 0 was silently changed to using the global locake,
and hence a comma.  This caused parse errors.

The real solution is to fix thread 0 to remain in its chosen locale.
But that fix is not ready in time for 5.37.4, and it is deemed important
to get something working for this monthly development release.

This commit changes the initial global LC_NUMERIC locale to always be C,
hence uses a dot radix.  The vast majority of code is expecting a dot.
This is not the ultimate fix, but it works around the immediate problem
at hand.

The test case is courtesy @bram-perl

20 months agowording fix
Karen Etheridge [Tue, 20 Sep 2022 17:24:48 +0000 (10:24 -0700)]
wording fix

20 months agoFix links in perldelta
Karl Williamson [Tue, 20 Sep 2022 15:10:29 +0000 (09:10 -0600)]
Fix links in perldelta

This is a correction for f1cc674150b9408466f484c1bd08faaa989000de

The I<...> formatting code is to be used generally for descriptive text
that is to be replaced by the user with whatever is appropriate.

C<...> is for text that is to be typed as-is.  That would be more
appropriate for these module names, which are as-is.

But in this case, these are links to modules.  perl doesn't currently
know if those are valid or not, so podcheck.t fails them.  It has to be
told that the spellings indeed are real modules.  So instead of changing
the L<...> to something else, a better solution that will allow
hyperlinks to be followed (when formatted by e.g., a browser), is to
inform podcheck.t that these are valid links.  This is trivially done by

 perl t/porting/podcheck.t --add-link Test::Vars

for example.  This revises its knowledge database, which will need to be
committed.

20 months agoperlexperiment: fix warning category for defer and extra parired delimiters
Dagfinn Ilmari Mannsåker [Tue, 20 Sep 2022 16:21:59 +0000 (17:21 +0100)]
perlexperiment: fix warning category for defer and extra parired delimiters

20 months agoperldelta - change pod markup for non-core modules
Richard Leach [Mon, 19 Sep 2022 19:44:19 +0000 (19:44 +0000)]
perldelta - change pod markup for non-core modules

20 months agomove a paren to improve wording
Karen Etheridge [Mon, 19 Sep 2022 18:20:38 +0000 (11:20 -0700)]
move a paren to improve wording

20 months agoCI/macos: Switch to macos-11
Bram [Sat, 17 Sep 2022 19:40:44 +0000 (21:40 +0200)]
CI/macos: Switch to macos-11

As far as I can find: macos-11 is called Big Sur and uses xcode 13.2.1.
See also: https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md

(Reason for the change: macos-10 is deprecated in GitHub CI and is
 planned to be removed on 1 December 2022.)

Fixes #20167

20 months agoCI/macos: Remove `export SDK`
Bram [Sat, 17 Sep 2022 20:07:34 +0000 (22:07 +0200)]
CI/macos: Remove `export SDK`

I'm not sure tho that what was ever added..
The build and test appear to work fine when it's not set.

README.macosx does mention it but there it does get used.

From README.macosx#sdk-support :

    First, export the path to the SDK into the build environment:
        export SDK=....

    ...

    You can use the SDK by exporting some additions to Perl's 'ccflags'
    and '..flags' config variables:
        ./Configure -Accflags="-nostdinc -B$SDK/usr/include/gcc \
                               -B$SDK/usr/lib/gcc -isystem$SDK/usr/include \
                               -F$SDK/System/Library/Frameworks" \
                    -Aldflags="-Wl,-syslibroot,$SDK" \
                    -de

But nothing in the ci worflow appears to do that..
So as far as I can tell `$SDK` is never used.

20 months agoperldelta - add GH#20114 to Known Problems section
Richard Leach [Mon, 19 Sep 2022 15:27:48 +0000 (15:27 +0000)]
perldelta - add GH#20114 to Known Problems section

20 months agoSkip 'pending changes' test for automated testing
Bram [Sat, 17 Sep 2022 17:43:46 +0000 (19:43 +0200)]
Skip 'pending changes' test for automated testing

This code is called via t/porting/authors.t; it basically checks
if there are pending/uncommitted changes and if the author is a known
contributor.

That test doesn't really work too well in combination with Test::Smoke since
that does create some files in the build-directory and may patch some files
(for example patching 'patchlevel.h' to include the commit id).

The end result: on several smokers the t/porting/authors.t test was failing
[because they lack a git config for user+email or because the configured
 name/email is not a known contributor].

Unfortunately Test::Smoke does not set the AUTOMATED_TESTING flag so
detect if Test::Smoke is running by checking for the 'mktest.out' file.

This commit also reverts the temporary work-around that was added in
commit 6c19d6c6d4db446fa9513b7d617134c938c89a4e. (That work-around
didn't cover all cases; there are smokers running with a different name/email
configured then the one in AUTHORS and for those the test still failed with
the temp work-around.)

Fixes #20141

20 months agoUse `git symbolic-ref` instead of `git branch`
Bram [Sat, 17 Sep 2022 18:55:17 +0000 (20:55 +0200)]
Use `git symbolic-ref` instead of `git branch`

`git branch` is a porcelain command and should not be used in scripts.[^1]

It can also cause failures when:
- color.ui in git config is set to 'always'
- HEAD is detached (i.e. `git checkout blead^0`)

In that case the current branch is colored and (partially) ends up in
the `$branch` var. (The code did check that the branch name didn't start
with `(` but that check doesn't really work when it's colored. In that case
the 'branch name' starts with an escape sequence for the color)

Example (without the patch):

$ git config color.ui always
$ git checkout blead^0
$ ./miniperl -Ilib make_patchnum.pl
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `git config branch.(detached.merge'
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `git config branch.(detached.remote'
$ grep git_branch lib/Config_git.pl
git_branch='(detached'
$ grep git_branch lib/Config_git.pl | cat -A
git_branch='^[[32m(detached'$

With the patch applied:

$ ./miniperl -Ilib make_patchnum.pl
Updating 'git_version.h' and 'lib/Config_git.pl'
$ grep git_branch lib/Config_git.pl
git_branch=''
$ grep git_branch lib/Config_git.pl | cat -A
git_branch=''$

[^1]: See https://git-blame.blogspot.com/2013/06/checking-current-branch-programatically.html
      which is a blog post from the git maintainer.

20 months agovnewSVpvf - inline & reduce call to sv_vsetpvfn
Richard Leach [Fri, 9 Sep 2022 21:47:05 +0000 (21:47 +0000)]
vnewSVpvf - inline & reduce call to sv_vsetpvfn

sv_vsetpvfn does just two things:
* SvPVCLEAR on the sv passed in
* calls sv_vcatpvfn_flags

Since the SV passed into sv_vsetpvfn by vnewSVpvf is a brand new SV,
it is more efficient to inline sv_vsetpvfn and change the SvPVCLEAR
to SvPVCLEAR_FRESH.

20 months agoS_regclass - use SvPVCLEAR_FRESH on new SV
Richard Leach [Fri, 9 Sep 2022 21:44:29 +0000 (21:44 +0000)]
S_regclass - use SvPVCLEAR_FRESH on new SV

20 months agoS_scan_heredoc - use SvPVCLEAR_FRESH on new SV
Richard Leach [Fri, 9 Sep 2022 21:44:07 +0000 (21:44 +0000)]
S_scan_heredoc - use SvPVCLEAR_FRESH on new SV

20 months agosv.c - add SvPVCLEAR_FRESH macro for new PVs with buffer
Richard Leach [Fri, 9 Sep 2022 21:32:09 +0000 (21:32 +0000)]
sv.c - add SvPVCLEAR_FRESH macro for new PVs with buffer

SvPVCLEAR(tmpstr) is a macro that calls sv_setpv_bufsize(tmpstr,0,0).
If called on a newly minted PV/PVIV/PVNV/PVMG that has a fresh PV
buffer assigned, many of the checks in SvPVCLEAR are unnecessary:
    * SvTHINKFIRST - won't be set
    * upgrade to SVt_PV - won't be necessary
    * SvGROW - we assert that this isn't necessary

It then does some useful, but small actions:
    * sets SvCUR(sv, 0);
    * sets the last byte in the PV buffer to \0
    * sets SvPOK_only_UTF8
    * does SvTAINT

Then does a final irrelevant check:
    * is tmpstr a PVCV - no it is not

This commit introduces SvPVCLEAR_FRESH as a drop-in replacement
for compatible SVs, that only does the relevant small actions.

20 months agoS_scan_heredoc: fresh sv functions close to point of use
Richard Leach [Thu, 25 Aug 2022 13:51:15 +0000 (13:51 +0000)]
S_scan_heredoc: fresh sv functions close to point of use

S_scan_heredoc does a SvGROW on a fresh PVIV. A sv_grow_fresh is
more efficient, plus it seems only really needed in the nearby "else"
branch. In the "if" branch, sv_setsv_fresh can be used directly.

20 months agoperl.h: Fix typo
Karl Williamson [Sun, 18 Sep 2022 17:38:40 +0000 (11:38 -0600)]
perl.h: Fix typo

20 months agosv_setsv_cow - directly create desired SVt_COW SV
Richard Leach [Wed, 20 Jul 2022 21:38:57 +0000 (21:38 +0000)]
sv_setsv_cow - directly create desired SVt_COW SV

It's more efficient to directly create the desired SV type than create
a SVt_NULL and then call sv_upgrade to get the desired type.

20 months agoperlhacktips: Add a section on symbol naming
Karl Williamson [Thu, 8 Sep 2022 01:10:21 +0000 (19:10 -0600)]
perlhacktips: Add a section on symbol naming

20 months agopod - remove references to PrePAN (now defunct)
Richard Leach [Thu, 15 Sep 2022 23:38:31 +0000 (23:38 +0000)]
pod - remove references to PrePAN (now defunct)

20 months agoperlguts - document newAV_alloc_x/z and _simple funcs
Richard Leach [Fri, 9 Sep 2022 14:33:17 +0000 (14:33 +0000)]
perlguts - document newAV_alloc_x/z and _simple funcs

20 months agoPerl_sv_setsv_flags: return after invlist_clone case
Richard Leach [Thu, 25 Aug 2022 00:10:10 +0000 (00:10 +0000)]
Perl_sv_setsv_flags: return after invlist_clone case

In the "first_ switch" statement in Perl_sv_setsv_flags, there's this case:
    case SVt_INVLIST:
        invlist_clone(ssv, dsv);
        break;

When the INVLIST code was added, it was unclear whether the logic following
that switch needed to apply to INVLISTs or not. Early returns were also seen
as risky from a future maintenance perspective. As a precaution, this case
was written to `break` rather than `return`.

With later analysis though, it seems like the code below this switch does
not apply to INVLISTs, apart from one unintended interaction.

* invlist_clone() - in regcomp.c - copies the PV buffer of ssv to dsv.
* However, whenever an invlist is initialized, SvPOK_on is called on its SV;
according to the nearby comment "/* This allows B to extract the PV */".
* Because the switch case does not return, the later `if (sflags & SVp_POK)`
branch will try to swipe/cow/copy the PV buffer of ssv to dsv. This is an
unnecessary double copy.

On that analysis, this commit changes the break into a return.

20 months agoCI/cygwin: clone the repo similar to 'checkout@v2'
Bram [Sun, 11 Sep 2022 20:18:57 +0000 (22:18 +0200)]
CI/cygwin: clone the repo similar to 'checkout@v2'

The primary reason for doing is to make it similar to all the
other CI configs.

The second reason for doing this is because it makes the checkout
faster. (old: 1m14s, new: 9s)

20 months agoCI/cygwin: use test harness with 2 jobs
Bram [Sun, 11 Sep 2022 20:18:50 +0000 (22:18 +0200)]
CI/cygwin: use test harness with 2 jobs

It was running the tests using t/TEST; change it to use t/harness
and use two jobs for doing so.

This decreases the total run-time from about 1h to 38m.

20 months agoCI/cygwin: use `shell: sh`
Bram [Sun, 11 Sep 2022 20:18:46 +0000 (22:18 +0200)]
CI/cygwin: use `shell: sh`

Before it was using powershell (or cmd) to run a 'sh -c' command.
Change it to use `shell: sh` so it becomes a bit more readable.

For using `shell: sh` two problems had to be fixed:
- the GitHub runner creates a file with the 'run'-contents but it uses
  a CRLF line ending which doesn't work with `sh`. The work-around for
  that is to include `igncr` in SHELLOPTS (the 'igncr' option is
  a cygwin patch to bash)
- SHELLOPTS contain 'errexit' which breaks ./Configure since it
  stopped on the first non-zero exit status (which happened to be
  a `grep`)

20 months agoCI/linux-i386: use shallow clone (fetch-depth: 1)
Bram [Sun, 11 Sep 2022 20:18:44 +0000 (22:18 +0200)]
CI/linux-i386: use shallow clone (fetch-depth: 1)

The other CI configurations use `checkout@v2' which defaults to making
a shallow clone (i.e. with fetch-depth set to 1).

Do the same for linux-i386.

20 months agoCI/linux-i386: Remove fetching of tags
Bram [Sun, 11 Sep 2022 20:18:42 +0000 (22:18 +0200)]
CI/linux-i386: Remove fetching of tags

For linux-i386 `checkout@v1` is used which automatically fetches all tags.
It uses the command (slightly altered for readability):
git -c http.extraheader="AUTHORIZATION: basic ***" fetch \
--tags \
--prune \
--progress \
--no-recurse-submodules \
origin +refs/heads/*:refs/remotes/origin/*

So fetching the tags again is not needed.

Note: this also makes it possible to get rid of the `git remote set-url`
      command. (This was added to add 'Authorization' header which is
      needed when using a private repo when using `git fetch`. Since the
      `git fetch` is gone the changing of the remote is no longer needed)

20 months agoCI/linux-i386: Explain why 'checkout@v2' fails
Bram [Sun, 11 Sep 2022 20:18:40 +0000 (22:18 +0200)]
CI/linux-i386: Explain why 'checkout@v2' fails

TLDR: it uses a 64-bit binary inside a 32-bit container.
(For details see the code)

20 months agotestsuite.yml: Remove fetching of tags
Bram [Sun, 11 Sep 2022 20:18:31 +0000 (22:18 +0200)]
testsuite.yml: Remove fetching of tags

The only test that need the git tags (afaik) is porting/cmp_version.t;
But the fetching of tags isn't really working for that test.

Basically the repo is cloned with:
$ git clone --depth 1 https://github.com/perl/perl5
$ git fetch --depth=1 origin +refs/tags/*:refs/tags/*

And then later the test uses:
$ git describe --abbrev=0 HEAD

and it expects to find a tag.

However doing that:
$ git describe --abbrev=0 HEAD
fatal: No tags can describe '6a011f13d7690dbe2e03ad7500756c983bcb1834'.

So it's not really working..

This can also be seen in the CI logs[^1], the output contains:
porting/cmp_version.t ..... skipped: Git found, but no Git tags found

There are only 3 CI configs that do run the porting/cmp_version.t test:
- 'Sanity: Linux -Dusethreads' - this is intended
- 'linux i386/ubuntu (-Dusedevel)'[^2]
- 'cygwin'[^3]

[^1]: CI logs of: 'linux (-Uusethreads)', 'linux (-Duseshrplib ...)',
      'linux (-Duserelocatableinc)', 'linux (-Dcc='clang')', 'linux (-Dcc='g++')',
      'install', 'macOS (catalina) xcode 12 (-Uusethreads)',
      'macOS (catalina) xcode 12 (-Duseithreads -Duseshrplib)', 'Windows msvc142',
      'Windows mingw64', 'ASAN (-Accflags=-DPURIFY)', 'ASAN (-DDEBUGGING)',
      'ASAN (-Dusethreads)', 'PERL_UNICODE (-Uusethreads)',
      'PERL_UNICODE (-Dusethreads ...')

[^2]: it uses 'actions/checkout@v1' to do the checkout which does a full clone
[^3]: it manually runs `git clone`, doing a full clone (with all history)

20 months agoNet-Ping: No longer need to TODO some tests when on FreeBSD
James E Keenan [Fri, 2 Sep 2022 00:40:27 +0000 (00:40 +0000)]
Net-Ping: No longer need to TODO some tests when on FreeBSD

See Net-Ping maintainer's comment:
https://github.com/rurban/Net-Ping/pull/18#issuecomment-1234223370

Regenerate customized database.

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

20 months agoFix t/porting/authors.t breakgage for people with non-ASCII names
Dagfinn Ilmari Mannsåker [Mon, 12 Sep 2022 20:58:16 +0000 (21:58 +0100)]
Fix t/porting/authors.t breakgage for people with non-ASCII names

The lack of decoding of git config values in Porting/updateAUTHORS.pm
would make it erroneously claim that anyone with a non-ASCII character
in their name was an unknown author.

The decoding and encoding in updateAUTHORS.pl is not strictly
necessary, since that's just passing things through to the terminal,
but let's be consistent.

20 months agolocale.c: Use LC_ALL only if available on platform
Karl Williamson [Sat, 10 Sep 2022 20:39:14 +0000 (14:39 -0600)]
locale.c: Use LC_ALL only if available on platform

These are the final (unless I missed something) cases where LC_ALL could
be referred to even if undefined on the system.

20 months agoWin32 should start new threads in C locale
Karl Williamson [Sat, 10 Sep 2022 20:38:31 +0000 (14:38 -0600)]
Win32 should start new threads in C locale

Prior to this commit, wrong cpp directives did not guarantee this.

20 months agothread.h Save errno around lock/unlock
Karl Williamson [Sun, 14 Mar 2021 00:37:14 +0000 (17:37 -0700)]
thread.h Save errno around lock/unlock

It may be necessary to unlock a mutext before raising a diagnostic about
a failure.  The unlock can then destroy the errno value needed to
diagnose the original problem.  This commit solves this in one place.

20 months agothread.h: White-space, braces only
Karl Williamson [Sun, 14 Mar 2021 00:36:04 +0000 (17:36 -0700)]
thread.h: White-space, braces only

20 months agoperlfilter.pod: Retain entry in customized database
James E Keenan [Sat, 3 Sep 2022 12:06:43 +0000 (12:06 +0000)]
perlfilter.pod: Retain entry in customized database

pod/perlfilter.pod is (for historical reasons, apparently) maintained
upstream on CPAN as part of the Filter distribution.  As such, (i) it
should, generally speaking, only be edited upstream and synched into
core; (ii) needs to be referenced in several places in the
Filter::Util::Call element in %Maintainers::Modules
(Porting/Maintainers.pl); (iii) needs to have an entry in
t/porting/customized.dat (the "customized database") to protect it from
being "overwritten" or accidentally removed.

For all of the above conditions to work together, the
filter_customized() subroutine in t/porting/customized.t needs to be
able to construct a regex which recognizes pod/perlfilter.pod's
weirdness.  Prior to this patch it was failing to do so.  Thus when
pod/perlfilter.pod was accidentally edited in commit d84bd0bd47, the
need to regenerate the customized database was not recognized.  Later,
review of a different pull request which required regeneration of the
customized database spotted the unintentional deletion of the entry for
pod/perlfilter.pod from t/porting/customized.dat.

Addressing this problem is inevitably going to be kludgy, but it will be
less kludgy if done in t/porting/customized.t than in
Porting/Maintainers.pl.  This patch modifies the former file to
guarantee that the string 'pod/perlfilter.pod' is matched.  After that
modification, 'cd t; ./perl -I../lib porting/customized.t --regen; cd -'
was run.  This accomplished the (previously overlooked) removal of
certain entries for Memoize in the customized database while leaving the
entry for pod/perlfilter.pod in that database intact.

If at some point in the future we decide that pod/perlfilter.pod should
be maintained directly in core, we can remove this kludge and simplify
the Filter::Util::Call element in %Maintainers::Modules in
Porting/Maintainers.pl.

For: https://github.com/Perl/perl5/issues/20228.

Should (partially) unblock https://github.com/Perl/perl5/pull/20216.

20 months agopod/perldelta - add entries to the incompatible changes section
Yves Orton [Mon, 12 Sep 2022 08:58:43 +0000 (10:58 +0200)]
pod/perldelta - add entries to the incompatible changes section

One is about syntax errors changing. The other is about -v stacking
precedence over -c and related issues of making the BEGIN{exit(0)}
work properly.

20 months agore/pat_advanced.t: remove `todo_skip` from test
Bram [Wed, 7 Sep 2022 21:38:19 +0000 (23:38 +0200)]
re/pat_advanced.t: remove `todo_skip` from test

This test is skipped when running as threads (i.e. via t/re/pat_advanced_thr.t)
since 20 Mar 2011 (commit 2feceb76bc07c8978188ab67f91851845258b0e1) because of
a bug.

That bug `[perl #86550]` is GH #7533 and that was fixed in Oct 2015 with
commit 0ee3fa26f660ac426e3e082f77d806c9d1471f93.

So I think it's safe to remove the `todo_skip` since the bug for why it was
skipped looks resolved. (A smoke-me branch also revealed no unexpected
problems)

20 months agolocale.c: Clean up two DEBUG stmts
Karl Williamson [Mon, 29 Mar 2021 00:32:37 +0000 (18:32 -0600)]
locale.c: Clean up two DEBUG stmts

STMT_START...END aren't required in DEBUG() calls, as that macro already
wraps its argument with those.  So, they are just clutter here.

20 months agoperl.h: Rmv duplicate #define
Karl Williamson [Sat, 10 Sep 2022 19:46:34 +0000 (13:46 -0600)]
perl.h: Rmv duplicate #define

LOCALE_LOCK has already been defined in all circumstances earlier in the
file

20 months agoRevert "perl.h: Move #defining SETLOCALE_LOCK"
Karl Williamson [Sat, 10 Sep 2022 19:29:03 +0000 (13:29 -0600)]
Revert "perl.h: Move #defining SETLOCALE_LOCK"

This reverts commit d0b8b8e8a48798446382161f988e6081140578d6.
I got ahead of myself.  This commit was premature

20 months agoperl.h: Move #defining SETLOCALE_LOCK
Karl Williamson [Sun, 14 Mar 2021 03:17:29 +0000 (20:17 -0700)]
perl.h: Move #defining SETLOCALE_LOCK

This simplifies slightly, and will allow further simplification

20 months agoMove #include from locale.c to perl.h
Karl Williamson [Fri, 2 Sep 2022 15:59:00 +0000 (09:59 -0600)]
Move #include from locale.c to perl.h

Without this commit, Perl won't compile if -DUSE_NL_LOCALE_NAME is
specified to Configure.  This is an undocumented feature that uses an
undocumented glibc feature that is effectively the querylocale() found
on Darwin and some other systems.  POSIX 2017 has added a
querylocale-like function to the repertoire, and should eventually
supplant this option.

20 months agoUpdate POSIX synopsis
Elvin Aslanov [Fri, 2 Sep 2022 14:29:32 +0000 (18:29 +0400)]
Update POSIX synopsis

20 months agoMerge branch 'Change init of certain locale categories' into blead
Karl Williamson [Sat, 10 Sep 2022 15:46:57 +0000 (09:46 -0600)]
Merge branch 'Change init of certain locale categories' into blead

This series of commits adds initialization for an object, and changes
the initialization process to call, for each locale category that has
one, the specialty function that handles locale changes for that
category, instead of duplicating the logic in the initialization
section.

This allows for the removal of a couple of conditionals that otherwise
would need to be executed each time the locale changes.

20 months agolocale.c: Remove no-longer necessary conditionals
Karl Williamson [Thu, 8 Sep 2022 03:01:12 +0000 (21:01 -0600)]
locale.c: Remove no-longer necessary conditionals

The previous commit initialized this variable early in start up, so that
we never have to now check that it is non-NULL.

20 months agolocale.c: Use locale change subs at initialization
Karl Williamson [Thu, 8 Sep 2022 02:59:41 +0000 (20:59 -0600)]
locale.c: Use locale change subs at initialization

There are currently 4 functions that do special handling when the locale
for their respective categories changes.  One of these is for LC_ALL,
which has and continues to be called at the end of initialization.

But the other three have changed in recent commits to handle the trivial
case specially of the locale being "C".  These changes now avoid the
complexities required for the general case (that needs everything to be
set up at the time of the call).

They can thus be called early in the initialization precess.  This
avoids having to duplicate their logics in the initialization code,
which has led to some things being overlooked there.  Now everything is
guaranteed to stay in sync.

20 months agolocale.c: Initialize PL_underlying_numeric_obj
Karl Williamson [Mon, 12 Apr 2021 02:42:18 +0000 (20:42 -0600)]
locale.c: Initialize PL_underlying_numeric_obj

This probably doesn't matter, but it's better form to initialize it to a
sane value.

20 months agolocale.c More new_ctype() refactoring
Karl Williamson [Sun, 4 Sep 2022 20:00:41 +0000 (14:00 -0600)]
locale.c More new_ctype() refactoring

Merge commit e4bbbfe02b9e9aae521b164eba0e518ca478945f refactored this
function some.  Most of the commits in that series dated to before when
we could assume C99.  In re-reading the result, I saw some opportunities
to take advantage of C99, by, for example, moving declarations closer to
their use.

I also hadn't previously noticed that when changing to the C locale (a
frequent occurrence), various things that we being recalculated are
determinable at compile time.  So this commit returns early under this
circumstance.

And, an obsolete comment is removed

20 months agolocale.c: Silence compiler warning when no LC_COLLATE
Karl Williamson [Mon, 5 Sep 2022 01:57:02 +0000 (19:57 -0600)]
locale.c: Silence compiler warning when no LC_COLLATE

On Configurations without LC_COLLATE, various unused warnings were
being generated.

20 months agolocale.c: Silence compiler warning when no LC_CTYPE
Karl Williamson [Mon, 5 Sep 2022 00:52:23 +0000 (18:52 -0600)]
locale.c: Silence compiler warning when no LC_CTYPE

On Configurations without LC_CTYPE, various unused warnings were
being generated.

20 months agolocale.c: Silence compiler warning about S_mortalixzed_pv_copy
Karl Williamson [Sat, 3 Sep 2022 13:02:23 +0000 (07:02 -0600)]
locale.c: Silence compiler warning about S_mortalixzed_pv_copy

This function is not used unless locales are enabled, so need not be
defined unless that is true.

20 months agolocale.c: Silence compiler warning about S_new_numeric
Karl Williamson [Sat, 3 Sep 2022 12:52:12 +0000 (06:52 -0600)]
locale.c: Silence compiler warning about S_new_numeric

This function is not used unless LC_NUMERIC is enabled, so need not be
defined unless that is true.

20 months agolocale.c: Silence C_codeset compiler warning
Karl Williamson [Sat, 3 Sep 2022 12:41:09 +0000 (06:41 -0600)]
locale.c: Silence C_codeset compiler warning

This fixes #20140

This static variable is used in just one or (unlikely) two places, and
only in some Configureations.  Rather than add #ifdefs, or make a
PERL_UNUSED call somewhere, making it a #define fixes the issue without
taking up extra memory except in some dumb compilers under unlikely
Configurations.

20 months agolocale.c: Change macro name 'porcelain' => 'posix'
Karl Williamson [Sat, 3 Sep 2022 12:31:20 +0000 (06:31 -0600)]
locale.c: Change macro name 'porcelain' => 'posix'

When I wrote this I tought porcelain in git meant something different
than it does.  But what this macro does is to hide the non-POSIX vs
POSIX differences from its callers.

20 months agosv.c: Comments white-space only
Karl Williamson [Fri, 9 Apr 2021 18:18:22 +0000 (12:18 -0600)]
sv.c: Comments white-space only

20 months agolocale.c: Clarify comment
Karl Williamson [Mon, 5 Sep 2022 16:32:34 +0000 (10:32 -0600)]
locale.c: Clarify comment

20 months agoMerge branch 'Start cleaning up mutexes for locales and functions that access global...
Karl Williamson [Fri, 9 Sep 2022 18:22:27 +0000 (12:22 -0600)]
Merge branch 'Start cleaning up mutexes for locales and functions that access global memory' into blead

This series of commit first cleans up some locale initialization
gotchas, and adds asserts.

And it cleans up where a few locale-related definitions are done

It converts the locale mutex to a general semaphore from a binary one,
which allows for simplification in switching the LC_NUMERIC locale.

And certain mutex macros now use the newly-general one

20 months agoperl.h: Remove LOCALECONV_LOCK
Karl Williamson [Mon, 8 Mar 2021 11:45:07 +0000 (04:45 -0700)]
perl.h: Remove LOCALECONV_LOCK

This is needed in just one function, in locale.c, so more it there.

20 months agoperl.h: Remove NL_LANGINFO_LOCK
Karl Williamson [Mon, 8 Mar 2021 11:31:18 +0000 (04:31 -0700)]
perl.h: Remove NL_LANGINFO_LOCK

This is needed in precisely one place in the code, so move it to there.

20 months agoRedefine the POSIX.xs locale macros using prev commit
Karl Williamson [Mon, 8 Mar 2021 04:24:51 +0000 (21:24 -0700)]
Redefine the POSIX.xs locale macros using prev commit

This commit uses the new macro introduced in the previous commit to
define the internal locale mutex macros in POSIX.xs

20 months agoAdd locale macro to wrap global-memory-using functions
Karl Williamson [Mon, 8 Mar 2021 03:31:09 +0000 (20:31 -0700)]
Add locale macro to wrap global-memory-using functions

Some functions return a result in a global-to-the-program buffer, or
they use global memory internally.  Other threads must be kept from
simultaneously using that function.  This macro is to be used for all
such ones dealing with locales.  Ideally, there would be a separate mutex
for each such buffer space.  But these functions also have to lock the
locale from changing during their execution, and there aren't that many
such functions, and they actually are rarely executed.  So a single lock
will do.

This will allow future commits to have more targeted locking for
functions that don't affect the global locale.

20 months agoUse general locale mutex for numeric operations
Karl Williamson [Sun, 14 Mar 2021 03:51:58 +0000 (20:51 -0700)]
Use general locale mutex for numeric operations

This commit removes the separate mutex for locking locale-related
numeric operations on threaded perls; instead using the general locale
one.  The previous commit made that a general semaphore, so now suitable
for use for this purpose as well.

This means that the locale can be locked for the duration of some
sprintf operations, longer than before this commit.  But on most modern
platforms, thread-safe locales cause this lock to expand just to a
no-op; so there is no effect on these.  And on the impacted platforms,
one is not supposed to be using locales and threads in combination, as
races can occur.  This lock is used on those perls to keep Perl's
manipulation of LC_NUMERIC thread-safe.  And for those there is also no
effect, as they already lock around those sprintf's.

20 months agoMake the locale mutex a general semaphore
Karl Williamson [Mon, 8 Mar 2021 02:56:18 +0000 (19:56 -0700)]
Make the locale mutex a general semaphore

Future commits will use this new capability, and in Configurations where
no locale locking is currently necessary.

20 months agoperl.h: Reorder cpp branches
Karl Williamson [Mon, 22 Mar 2021 13:10:47 +0000 (07:10 -0600)]
perl.h: Reorder cpp branches

Disposing of the trivial case first makes things easier to read.

20 months agoperl.h: Move some code around
Karl Williamson [Mon, 8 Mar 2021 02:40:37 +0000 (19:40 -0700)]
perl.h: Move some code around

This is purely to make future commits have smaller real difference
listings, and involves a temporary (complemented) copy of a preprocessor
conditional.