]> Codestin Search App

Thanks to visit codestin.com
Credit goes to perl5.git.perl.org

This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
8 hours agocpan/Term-Table - Update to version 0.027 blead
Chad Granum [Sun, 16 Nov 2025 02:21:10 +0000 (21:21 -0500)]
cpan/Term-Table - Update to version 0.027

0.027     2025-11-14 10:04:51-08:00 America/Los_Angeles

    - No changes from trial

0.026     2025-11-12 20:02:15-08:00 America/Los_Angeles (TRIAL RELEASE)

    - Fix terminal size detection

47 hours agocpan/Test-Simple - Update to version 1.302215
Thibault DUPONCHELLE [Fri, 14 Nov 2025 11:19:44 +0000 (12:19 +0100)]
cpan/Test-Simple - Update to version 1.302215

1.302215  2025-11-13 16:41:55-08:00 America/Los_Angeles

47 hours agocpan/Time-Piece - Update to version 1.41
Thibault DUPONCHELLE [Fri, 14 Nov 2025 11:00:25 +0000 (12:00 +0100)]
cpan/Time-Piece - Update to version 1.41

1.41  2025-11-12
        - strptime: parse micro seconds (RT165677, RT133599)
        - add to_gmtime and to_localtime (RT113979)

3 days agodon't warn on 'undef $^W'
David Mitchell [Wed, 12 Nov 2025 17:02:16 +0000 (17:02 +0000)]
don't warn on 'undef $^W'

Ironically, this warns:

    $ perl -e'use warnings; undef $^W'
    Use of uninitialized value in undef operator at -e line 1.
    $

The magic-setting code was treating the new value of $^W as an integer.
This commit makes it treat the value as a boolean.

I suppose this commit could in theory break code if that code is
doing something like:

    $^W = "0 but true";

In the past that would have disabled warnings, but will now enable them.
But it seems unlikely that anyone would have written such code. The
variable is documented in perlvar as having a value which is interpreted
as a boolean.

Note that this commit stops a test in t/op/reset.t from expecting a
warning when resetting $^W. This test was added by issue GH #20763, and
AFAIKT that ticket was concerned with 'reset $^W' not actually
resetting the variable; the test for the warning was purely a
side-effect of the fact that it happened to warn.

3 days agoop_dump(): display names of variables for pad ops.
David Mitchell [Wed, 12 Nov 2025 13:57:12 +0000 (13:57 +0000)]
op_dump(): display names of variables for pad ops.

Make op_dump(), as used by 'perl -Dx', display the names of pad
variables when dumping pad ops.

The runtime perl -Dt already does this (note the $x, $y etc appearing in
the op name displays):

    $ perl -Dt -e'my ($x, $y); $y = 1+$x'

    (-e:0) enter
    (-e:0) nextstate
    (-e:1) padrange($x,$y)
    (-e:1) nextstate
    (-e:1) const(IV(1))
    (-e:1) padsv($x)
    (-e:1) add($y)
    (-e:1) leave

While the (typically compile-time) -Dx detailed optree dumping didn't.
Here are some 'before this commit' and 'after' examples of how some of
those ops were/are now displayed. Note the changes in the 'TARG = N'
lines for the following code:

    $  perl -Dx -e'my ($x, $y); $y = 1+$x'

Before:

    4    |   +--padrange OP(0x31b08960) ===> 6 [nextstate 0x31b09fc0]
         |   |   TARG = 1
         |   |   FLAGS = (VOID,MOD,SLABBED,MORESIB)
         |   |   PRIVATE = (LVINTRO,range=0x2)

    10   +--add BINOP(0x31b0a060) ===> 1 [leave 0x31b08880]
             TARG = 2
             FLAGS = (VOID,KIDS,SLABBED)
             PRIVATE = (TARGMY,0x2)

    11       +--padsv OP(0x31b0a0a0) ===> 10 [add 0x31b0a060]
                 TARG = 1
                 FLAGS = (SCALAR,SLABBED)

After:

    4    |   +--padrange OP(0x18ffe920) ===> 6 [nextstate 0x18ffff80]
         |   |   TARG = 1 ($x,$y)
         |   |   FLAGS = (VOID,MOD,SLABBED,MORESIB)
         |   |   PRIVATE = (LVINTRO,range=0x2)

    10   +--add BINOP(0x19000020) ===> 1 [leave 0x18ffe840]
             TARG = 2 ($y)
             FLAGS = (VOID,KIDS,SLABBED)
             PRIVATE = (TARGMY,0x2)

    11       +--padsv OP(0x19000060) ===> 10 [add 0x19000020]
                 TARG = 1 ($x)
                 FLAGS = (SCALAR,SLABBED)

3 days agodump.c: add S_get_cv_from_op() function
David Mitchell [Wed, 12 Nov 2025 13:37:55 +0000 (13:37 +0000)]
dump.c: add S_get_cv_from_op() function

The existing S_get_sv_from_pad() function does two things: it finds the
CV associated with the specified op, and then extracts something from
that CV's pad.

This commit splits the 'find the associated CV' part of the code out
into a separate function, which will be used elsewhere shortly.

3 days agodump.c: add S_deb_padvar_cv() function
David Mitchell [Wed, 12 Nov 2025 13:11:40 +0000 (13:11 +0000)]
dump.c: add S_deb_padvar_cv() function

Make S_deb_padvar() a thin wrapper over a new S_deb_padvar_cv() function,
which does the same thing (display a pad variable name), but does it for
a specified CV rather than only for the currently executing CV. This
function will be used shorty.

3 days agoperlguts: the types are struct Perl_OpDumpContext * and const OP *
Tony Cook [Tue, 11 Nov 2025 09:46:41 +0000 (20:46 +1100)]
perlguts: the types are struct Perl_OpDumpContext * and const OP *

not struct OpDumpContext *, OP *.

Which I missed in the review of #22572 but found when I tried to use
it.

3 days agogrok_bin_oct_hex: Make a parameter const
Karl Williamson [Mon, 10 Nov 2025 01:09:01 +0000 (18:09 -0700)]
grok_bin_oct_hex: Make a parameter const

This prevents a future maintainer from accidentally changing this
pointer inside the function, where its original value is needed at the
end

3 days agogrok_bin_oct_hex: Improve overflow detection
Karl Williamson [Mon, 10 Nov 2025 01:04:55 +0000 (18:04 -0700)]
grok_bin_oct_hex: Improve overflow detection

The new scheme is is what toke.c already uses for the same purpose, and
I think is cleaner

3 days agogrok_bin_oct_hex: Avoid two recalculations
Karl Williamson [Mon, 10 Nov 2025 01:02:40 +0000 (18:02 -0700)]
grok_bin_oct_hex: Avoid two recalculations

We already have this value in a variable.

3 days agogrok_bin_oct_hex: fix broken return flags
Karl Williamson [Thu, 6 Nov 2025 02:39:55 +0000 (19:39 -0700)]
grok_bin_oct_hex: fix broken return flags

Apparently no one has tried to use these before.  These flags are to
suppress the display of certain warnings, but to instead return that the
suppression happened in output flags.  The output flags were not getting
set.

I'm not adding a separate test, because a future commit will cause this
feature to be used regularly.

3 days agogrok_bin_oct_hex: Change name of internal flag
Karl Williamson [Wed, 5 Nov 2025 14:35:49 +0000 (07:35 -0700)]
grok_bin_oct_hex: Change name of internal flag

This clarifies its meaning

3 days agogrok_bin_oct_hex: Simplify flag
Karl Williamson [Wed, 5 Nov 2025 14:23:12 +0000 (07:23 -0700)]
grok_bin_oct_hex: Simplify flag

It's easier to understand and code if each flag name is for a single
flag.

3 days agogrok_bin_oct_hex: Shortcut leading zeros
Karl Williamson [Wed, 5 Nov 2025 13:34:19 +0000 (06:34 -0700)]
grok_bin_oct_hex: Shortcut leading zeros

I noticed that leading zeros are quite common for octal and hex
constants.  This code is structured for speed, with a partially unrolled
loop structured so that it is impossible to overflow the unrolled part.

If we get to the end of the unrolled portion, and the accumulated value
is still zero, it's because there have been only leading zeroes so far,
and instead of dropping into the loop, we can re-enter the unrolled part
without having to consider the possibility of overflowing.  This allows
the next chunk of digits to be processed without branching.

3 days agoperl.h: Comments/white space only
Karl Williamson [Wed, 5 Nov 2025 14:17:00 +0000 (07:17 -0700)]
perl.h: Comments/white space only

Clarify some comments.

3 days agoregexec.c: Silence solaris compiler warning
Karl Williamson [Sun, 9 Nov 2025 22:07:35 +0000 (15:07 -0700)]
regexec.c: Silence solaris compiler warning

This is using a signed value that should be set non-negative before it
gets to these places.

3 days agoperldelta entry for GH #18669
David Mitchell [Wed, 12 Nov 2025 10:55:13 +0000 (10:55 +0000)]
perldelta entry for GH #18669

3 days agocpan/Time-Piece - Update to version 1.40
Thibault DUPONCHELLE [Wed, 12 Nov 2025 09:06:54 +0000 (10:06 +0100)]
cpan/Time-Piece - Update to version 1.40

1.40  2025-11-08
        - strptime: locale parse fixes (GH86)
        - Add fullmon_list() and fullday_list() (GH85)
        - Fix null deref (GH47)
        - Remove locale-dependent flags (GH71)
        - Document flags for strftime/strptime (GH83)

4 days agoPerl_doref(): improve code comments
David Mitchell [Tue, 11 Nov 2025 12:45:56 +0000 (12:45 +0000)]
Perl_doref(): improve code comments

Having just messed with this function, I understand it better, so can
comment it better.

4 days agoPerl_doref(): eliminate duplicated code
David Mitchell [Tue, 11 Nov 2025 11:57:14 +0000 (11:57 +0000)]
Perl_doref(): eliminate duplicated code

This compile-time function propagates lvalue ref context down a chain of
ops. It does the same thing (setting OPf_MOD and OPpDEREF_XV flags) in
three places. Consolidate this code into a single place.

Should be no functional changes.

Technically the code is slightly different in that OP_[AH]ELEM now
checks for kids before following them, but since they always have kids,
this makes no difference (except being infinitesimally slower during
compilation).

4 days agopropagate correct ref context to both ?: branches
David Mitchell [Tue, 11 Nov 2025 11:06:50 +0000 (11:06 +0000)]
propagate correct ref context to both ?: branches

GH #18669

In something like

    @{ expr } = ...

the expression is expected to return an array ref. If the expression
is something like $h{foo}, then the helem op needs to know both that:
- it is in lvalue context, so should autovivify the foo element if not
  present;
- it is in array ref context, so it should autovivify the value to an
  empty array ref, rather than just to undef.

The function Perl_doref() is used to propagate this ref context at
compile time, e.g. by setting the OPf_MOD and OPpDEREF_AV flags on the
OP_HELEM op.

My commit v5.31.1-87-ge9b0092a10 made this function non-recursive
(so that deep expressions wouldn't SEGV during compilation), but
introduced a bug when the expression included the ternary condition
operator, '?:'.

In particular, since '?:' is the only OP where doref() needs to recurse
down *two* branches, I made the function just iterate down the tree, and
then have special handling for OP_COND_EXPR. This involved, once having
finished iterating down the tree, to work back up the tree looking for
OP_COND_EXPR nodes, and if found, iterate back down the second branch.

This had a fatal flaw: a 'type' variable indicated what context to
apply. For example in @{$h{expr}} = ..., type would start off as
OP_RV2AV, but as the tree was walked, would change to OP_HELEM and then
to OP_RV2HV. When walking back up the tree, this value wasn't being restored.

The specific bug in the ticket boiled down to something like

    @{ $cond ? $h{p} : $h{q} } = ...;

where the correct OPpDEREF_AV flag was being set on the first helem op,
but an incorrect OPpDEREF_HV on the second.

Since I can't think of anything better, the fix in this commit restores
some limited recursion to doref(). Namely, for an OP_COND_EXPR op, it
now recurses down that op's first branch, then after it returns,
iterates as normal down the second branch.

Thus extremely deeply nested ternary code like:

    @{ $c1 ? $c2 ? $c3 ? .... } ...

could start to SEGV during compilation again.

4 days agoModule::CoreList was released
Thibault DUPONCHELLE [Wed, 12 Nov 2025 08:42:42 +0000 (09:42 +0100)]
Module::CoreList was released

5 days agoTidy lib/Getopt/Std.t
James E Keenan [Mon, 10 Nov 2025 19:29:28 +0000 (14:29 -0500)]
Tidy lib/Getopt/Std.t

Replace internal hard-tabs used for alignment of test descriptions.

5 days agoTidy lib/Getopt/Std.pm
James E Keenan [Mon, 10 Nov 2025 19:25:16 +0000 (14:25 -0500)]
Tidy lib/Getopt/Std.pm

Uncuddle elsif and else; standardize leading whitespace; trim trailing
whitespace.

Increment $VERSION.

5 days agoAdd Karen Etheridge to the list of VICTIMS
Thibault DUPONCHELLE [Mon, 10 Nov 2025 08:18:10 +0000 (09:18 +0100)]
Add Karen Etheridge to the list of VICTIMS

6 days agoRevert "bignum"
Karl Williamson [Sun, 9 Nov 2025 20:30:33 +0000 (13:30 -0700)]
Revert "bignum"

This reverts commit d3cf8cc20a82be0573ee727a4f68b5ceb7170502.

This got accidentally pushed when I instead meant to update maint-votes

6 days agobignum
Karl Williamson [Sun, 9 Nov 2025 02:39:18 +0000 (19:39 -0700)]
bignum

6 days ago'use 5.41' affects current line source::encoding
Yitzchak Scott-Thoennes [Fri, 31 Oct 2025 11:05:33 +0000 (05:05 -0600)]
'use 5.41' affects current line source::encoding

Previously it didn't take effect until subsequent lines

Fixes #23881

6 days agoUpdate email address of Yitzchak Scott-Thoennes
Karl Williamson [Fri, 31 Oct 2025 11:10:22 +0000 (05:10 -0600)]
Update email address of Yitzchak Scott-Thoennes

6 days agoUpdate source_encoding.t comment
Karl Williamson [Fri, 31 Oct 2025 11:24:11 +0000 (05:24 -0600)]
Update source_encoding.t comment

This feature was delayed until 5.41; the comment here was not updated to
reflect that.

6 days agoscan_num: Remove redundant variable
Karl Williamson [Tue, 4 Nov 2025 15:31:23 +0000 (08:31 -0700)]
scan_num: Remove redundant variable

It turns out that the removed variable was set if and only if another
one is set.

6 days agotoke.c: scan_num: Use msbit_pos() to simplify code
Karl Williamson [Tue, 4 Nov 2025 13:35:48 +0000 (06:35 -0700)]
toke.c: scan_num: Use msbit_pos() to simplify code

A bunch of code here is replaced by this one call.

6 days agogrok_bin_oct_hex: Move declaration of variable to first need
Karl Williamson [Tue, 4 Nov 2025 17:34:02 +0000 (10:34 -0700)]
grok_bin_oct_hex: Move declaration of variable to first need

This caused an extra assignment that was then discarded

6 days agogrok_bin_oct_hex: Move case: in switch()
Karl Williamson [Tue, 4 Nov 2025 17:31:14 +0000 (10:31 -0700)]
grok_bin_oct_hex: Move case: in switch()

This removes a special case, paving the way for potential future
generalizations.

6 days agogrok_bin_oct_hex: Use upper bound, not length remaining
Karl Williamson [Tue, 4 Nov 2025 17:21:33 +0000 (10:21 -0700)]
grok_bin_oct_hex: Use upper bound, not length remaining

Creating an upper limit to parse allows us to write while (s < e) for
example, and that limit is constant, requiring fewer operations than the
other way, where the remaining length keeps getting changed.

It also allows this commit to move an 's++' a couple of lines to get rid
of comparing against the number '8' which could get out of sync.

6 days agogrok_bin_oct_hex: Move declarations close to first use
Karl Williamson [Mon, 3 Nov 2025 18:29:50 +0000 (11:29 -0700)]
grok_bin_oct_hex: Move declarations close to first use

8 days agofix the variable name in the test comment for ${^WARNINGS_BITS}
Philippe Bruhat (BooK) [Fri, 7 Nov 2025 18:45:42 +0000 (19:45 +0100)]
fix the variable name in the test comment for ${^WARNINGS_BITS}

This seems to have existed since 7e4f04509c6d4e8d2ed0e31eaf59004e5c930b39
(the initial commit), so it definitely looks like a typo that wasn't
spotted before.

8 days agofix the variable name in the doc for ${^MAX_NESTED_EVAL_BEGIN_BLOCKS}
Philippe Bruhat (BooK) [Fri, 7 Nov 2025 17:17:47 +0000 (18:17 +0100)]
fix the variable name in the doc for ${^MAX_NESTED_EVAL_BEGIN_BLOCKS}

This seems to have existed since 741a5c7396a0ca90a22ea8d8e0761c70c14b0a77
(the initial commit), so it definitely looks like a typo that wasn't
spotted before.

9 days agot/run/todo.t: remove spurious 'my'
David Mitchell [Thu, 6 Nov 2025 11:31:16 +0000 (11:31 +0000)]
t/run/todo.t: remove spurious 'my'

v5.43.4-89-ge3d32ae8d5 was producing

    "my" variable $x masks earlier declaration in same scope

Two tests use $x; only the first needs 'my'.

9 days agoparser debugging output: strip token name prefixes
David Mitchell [Tue, 4 Nov 2025 15:13:01 +0000 (15:13 +0000)]
parser debugging output: strip token name prefixes

Some of the names of parser (perly.y) tokens have a common prefix, such
as

    PERLY_SEMICOLON
    PERLY_AMPERSAND
    KW_PACKAGE
    KW_CLASS

Perl's -Dpv switch produces debugging output that also displays the top
few items on the parse stack. The token names are truncated for
compactness' sake. This currently leads to a display where its mostly
just the token name's prefix that is displayed, e.g.

$ perl -Dpv -e'package Foo'

...

index:        1        2        3        4        5        6        7        8
state:        1        9       17      149       91      263      412      503
token: GRAMPROG       @1 remember  stmtseq KW_PACKA BAREWORD BAREWORD PERLY_SE
value:        0        0       63 (Nullop)        0 (Nullop)    const 735909768

After this commit, PERLY_, KW_ etc prefixes are stripped, allowing more
of the actual token name is displayed:

index:        1        2        3        4        5        6        7        8
state:        1        9       17      149       91      263      412      503
token: GRAMPROG       @1 remember  stmtseq  PACKAGE BAREWORD BAREWORD SEMICOLO
value:        0        0       63 (Nullop)        0 (Nullop)    const 227539304

10 days agoAvoid redefining SvREADONLY_on in gv.c as that causes confusion
Paul "LeoNerd" Evans [Tue, 4 Nov 2025 17:57:08 +0000 (17:57 +0000)]
Avoid redefining SvREADONLY_on in gv.c as that causes confusion

When reading the previous code, it was confusing to see calls to
`SvREADONLY_on`, as without being aware the macro was redefined just
above this function, the reader is unlikely to be aware that here it
doesn't set the SVf_PROTECT flag.

We should instead define a custom-purpose macro here and use that, to
make its operation much clearer.

10 days agonamed signatures: fix crash when slurping and tainting
Tony Cook [Tue, 4 Nov 2025 03:15:22 +0000 (14:15 +1100)]
named signatures: fix crash when slurping and tainting

Only try to dereference a parameter pointer after we ensure it is
valid.

CID 638315

10 days agodo not use fresh_perl for #18669 TODO tests
Samuel Young [Tue, 4 Nov 2025 15:38:15 +0000 (09:38 -0600)]
do not use fresh_perl for #18669 TODO tests

This commit updates the #18669 TODO tests to use evals instead of
fresh_perl() calls, as fresh_perl() is not actually needed because
the behavior being tested does not cause the perl interpreter to
crash.

11 days agowin32/perllib.c: Omit unused formal parameter name
Karl Williamson [Tue, 4 Nov 2025 16:08:37 +0000 (09:08 -0700)]
win32/perllib.c: Omit unused formal parameter name

to silence a compiler warning

11 days agopp_sys.c: Initialize variable to avoid compiler warning
Karl Williamson [Sun, 2 Nov 2025 18:24:22 +0000 (11:24 -0700)]
pp_sys.c: Initialize variable to avoid compiler warning

The MingW compiler thinks this can be used unininitalized

11 days agopp_hot.c: Initialize variable to avoid compiler warning
Karl Williamson [Sun, 2 Nov 2025 18:23:14 +0000 (11:23 -0700)]
pp_hot.c: Initialize variable to avoid compiler warning

The MingW compiler thinks this can be used unininitalized.

11 days agotoke.c: Initialize variable to avoid compiler warning
Karl Williamson [Sun, 2 Nov 2025 18:21:55 +0000 (11:21 -0700)]
toke.c: Initialize variable to avoid compiler warning

The MingW compiler thinks this can be used unininitalized, even though I
don't think it can.  Just initialize it to 0.

11 days agopp_hot.c: Don't use signed char as an array index
Karl Williamson [Sun, 2 Nov 2025 18:17:24 +0000 (11:17 -0700)]
pp_hot.c: Don't use signed char as an array index

The MingW compiler spotted this.  The code prior to these uses already
has made sure these indices are positive, so casting to unsigned works.

11 days agowin32/fcrypt.c: Collapse some conditionals
Karl Williamson [Sun, 2 Nov 2025 18:14:36 +0000 (11:14 -0700)]
win32/fcrypt.c: Collapse some conditionals

We have macros that including perl.h gets us access to, and do the same
thing more quickly than this did.

11 days agowin32/vmem.h: White-space only
Karl Williamson [Sun, 2 Nov 2025 18:12:04 +0000 (11:12 -0700)]
win32/vmem.h: White-space only

Make this macro more legible, while silencing some compiler warnings
about the if statements looking like they are intended to apply to more
than they actually do.

11 days agowin32/vmem.h: Comment tag after #endif
Karl Williamson [Sun, 2 Nov 2025 18:10:21 +0000 (11:10 -0700)]
win32/vmem.h: Comment tag after #endif

This should be in a comment even though the compilers on Windows
tolerate it, but with a warning

11 days agowin32.h: #undef a macro before redefining it
Karl Williamson [Sun, 2 Nov 2025 18:09:25 +0000 (11:09 -0700)]
win32.h: #undef a macro before redefining it

This silences a compiler warning

11 days agoAdd a bunch of PERL_UNUSED_ARG calls
Karl Williamson [Sun, 2 Nov 2025 18:07:36 +0000 (11:07 -0700)]
Add a bunch of PERL_UNUSED_ARG calls

These should silence warnings on MingW.

11 days agolocale.c: Initialize variable to silence compiler
Karl Williamson [Sun, 2 Nov 2025 18:04:37 +0000 (11:04 -0700)]
locale.c: Initialize variable to silence compiler

The compiler used on MingW doesn't realize that there is no path that
keeps this from being initialized

12 days ago`README.win32`: Formatting-only
Elvin Aslanov [Thu, 30 Oct 2025 21:28:52 +0000 (22:28 +0100)]
`README.win32`: Formatting-only

Enhance readability by using Pod
commands for text formatting

12 days agogrok_number: Clarify comment: this is a decimal number
Karl Williamson [Sun, 2 Nov 2025 18:19:08 +0000 (11:19 -0700)]
grok_number: Clarify comment: this is a decimal number

12 days agot/run/exit.t: Fix syntax of 'my'
Karl Williamson [Wed, 29 Oct 2025 20:53:37 +0000 (14:53 -0600)]
t/run/exit.t: Fix syntax of 'my'

I found this by code reading

13 days agoop/magic.t clearing %ENV now z/OS safe except in ASCII mode
Karl Williamson [Sun, 2 Nov 2025 18:40:21 +0000 (11:40 -0700)]
op/magic.t clearing %ENV now z/OS safe except in ASCII mode

So no need to skip this test, except when run under ASCII

13 days agorun/locale.t: Skip setting to illegal locale on z/OS
Karl Williamson [Tue, 3 Jun 2025 11:18:07 +0000 (05:18 -0600)]
run/locale.t: Skip setting to illegal locale on z/OS

This test gets variously an illegal instruction or segfault from within
setlocale().  The default shell and bash on this system forbid the
changing of LC_ALL to an illegal value, so the setlocale(3) command is
insulated from getting this kind of input in actual operation.

This test was written in such a way as to get around such shell
restrictions, and it turns out that the z/OS setlocale can't cope.  I
haven't written a ticket to IBM because this really can't happen without
a sneaky test that involves perl or something else very unlikely to
happen in real life.

There is no good single-stepping debugger available I was told by an IBM
person, so I tried narrowing the cause down by adding debug statements.
I had to flush the buffer each time, and the results were more like
going down a rabbit hole.

It turns out that when a test on the box I tested this with crashes, a
human readable dump is output.  It showed that the failure is within
an internal function 'locale_init()' called from setlocale(3).  That is
a pretty strong indication that setlocale(3) isn't validating its input,
and it isn't perl's fault.

This is a typical dump of the problem.  (Note, the perl is compiled
without threads.)  S_posix_setlocale_with_complications() is the lowest
perl function called.

CEE3DMP V3 R1.0: Condition processing resulted in the unhandled condition.         Mon Jun  2 19:26:40 2025             Page:    1
ASID: 004B   PID: 67175275   Parent PID: 33619980   User name: DEVUSER

CEE3845I CEEDUMP Processing started.

Information for enclave main

  Information for thread 1B12A80000000000

  Traceback:
    DSA   Entry       E  Offset  Statement   Load Mod             Program Unit                   Service  Status
    1     CEEHDSP     +00003FD8              CELQLIB              CEEHDSP                        HLE77E0  Call
    2     CEEOSIGJ    +0000095C              CELQLIB              CEEOSIGJ                       HLE77E0  Call
    3     CELQHROD    +00000266              CELQLIB              CELQHROD                       HLE77E0  Call
    4     CEEOSIGG    -13FB9470              CELQLIB              CEEOSIGG                       HLE77E0  Call
    5     CELQHROD    +00000266              CELQLIB              CELQHROD                       HLE77E0  Call
    6     locale_init -1C0CE168              CELQLIB                                             HLE77E0  Exception
    7     set_locale  +00001C86              CELQLIB                                             UI95787  Call
    8     setlocale   +00000020              CELQLIB                                             UI95787  Call
    9     S_posix_setlocale_with_complications
                      +00000CF2              perl                                                         Call
    10    Perl_setlocale
                      +0000055E              perl                                                         Call
    11    XS_POSIX_setlocale
                      +000002B4              perl                                                         Call
    12    Perl_rpp_invoke_xs
                      +000001AC              perl                                                         Call
    13    Perl_pp_entersub
                      +000050AE              perl                                                         Call
    14    Perl_runops_debug
                      +000005E8              perl                                                         Call
    15    S_run_body  +00000A48              perl                                                         Call
    16    perl_run    +00000424              perl                                                         Call
    17    main        +00000244              perl                                                         Call
    18    CELQINIT    +00001ACA              CELQLIB              CELQINIT                       HLE77E0  Call

    DSA   DSA Addr          E  Addr             PU Addr           PU Offset   Comp Date Compile Attributes
    1     00000050082F8600  000000001BFFADD0    000000001BFFADD0  00003FD8    20230307  CEL       POSIX  XPLINK  EBCDIC  HFP
    2     00000050082FB760  000000001C2B53C0    000000001C2B53C0  0000095C    20230307  CEL       POSIX  XPLINK  EBCDIC  HFP
    3     00000050082FC160  000000001C00E7E0    000000001C00E7E0  00000266    20230307  CEL       POSIX  XPLINK  EBCDIC  HFP
    4     00000050082FC360  000000001C2AE3B0    000000001C2AE3B0  13FB9470    20230307  CEL       POSIX  XPLINK  EBCDIC  HFP
    5     00000050082FD380  000000001C00E7E0    000000001C00E7E0  00000266    20230307  CEL       POSIX  XPLINK  EBCDIC  HFP
    6     00000050082FD580  000000001C0CE168    0000000000000000  ********    20230307  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    7     00000050082FD680  000000001C2FA220    0000000000000000  ********    20240223  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    8     00000050082FD980  000000001C2FC2C8    0000000000000000  ********    20240223  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    9     00000050082FDA80  000000001B0144F0    0000000000000000  ********    20250603  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    10    00000050082FDD40  000000001B0163B0    0000000000000000  ********    20250603  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    11    00000050082FDF60  000000001AA60058    0000000000000000  ********    20250603  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    12    00000050082FE0E0  000000001B475770    0000000000000000  ********    20250603  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    13    00000050082FE1C0  000000001B46DE30    0000000000000000  ********    20250603  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    14    00000050082FE940  000000001B17B2C0    0000000000000000  ********    20250603  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    15    00000050082FEA20  000000001A7EE310    0000000000000000  ********    20250603  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    16    00000050082FEB40  000000001A7ED370    0000000000000000  ********    20250603  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    17    00000050082FF100  000000001A70D940    0000000000000000  ********    20250603  C/C++     POSIX  XPLINK  EBCDIC  IEEE
    18    00000050082FF200  000000001BDE5010    000000001BDE5010  00001ACA    20230307  CEL       POSIX  XPLINK  EBCDIC  HFP

    Fully Qualified Names
    DSA   Entry       Program Unit                                        Load Module
    9     S_posix_setlocale_with_complications
                                                                          ./perl
CEE3DMP V3 R1.0: Condition processing resulted in the unhandled condition.         Mon Jun  2 19:26:40 2025             Page:    2
ASID: 004B   PID: 67175275   Parent PID: 33619980   User name: DEVUSER

    10    Perl_setlocale
                                                                          ./perl
    11    XS_POSIX_setlocale
                                                                          ./perl
    12    Perl_rpp_invoke_xs
                                                                          ./perl
    13    Perl_pp_entersub
                                                                          ./perl
    14    Perl_runops_debug
                                                                          ./perl
    15    S_run_body                                                      ./perl
    16    perl_run                                                        ./perl
    17    main                                                            ./perl

    Full Service Level
    DSA   Entry       Service
    6     locale_init HLE77E0:EDCNLSET
    7     set_locale  UI95787:CELHSTLC
    8     setlocale   UI95787:CELHSTLC

  Condition Information for Active Routines
    Condition Information for  (DSA address 00000050082FD580)
      CIB Address: 00000050082F9948
      Current Condition:
        CEE0198S The termination of a thread was signaled due to an unhandled condition.
      Original Condition:
        CEE3201S The system detected an operation exception (System Completion Code=0C1).
      Location:
        Program Unit:  Entry: locale_init
        Statement:     Offset: -1C0CE168
      Machine State:
        ILC..... 0002    Interruption Code..... 0001
        PSW..... 0785240180000000 0000000000000002
        GPR0..... 000000001C7C5238  GPR1..... 0000005008CB0210  GPR2..... 0000005009A1CCA0  GPR3..... 0000005009A1D908
        GPR4..... 00000050082FD580  GPR5..... 0000000000000000  GPR6..... 0000000000000000  GPR7..... 000000001C0CE1B8
        GPR8..... 0000005008CB0210  GPR9..... 0000000000000004  GPR10.... 0000005009A1D908  GPR11.... 0000000000000001
        GPR12.... 0000005000108398  GPR13.... 0000000000000000  GPR14.... 0000000000000000  GPR15.... 00000000000001E8
        FPC...... 00080000
        FPR0..... 00000000  00000000            FPR1..... 43F00000  00000000
        FPR2..... 00000000  00000000            FPR3..... 413243F6  A8885A31
        FPR4..... 40030000  00000000            FPR5..... 416487ED  5110B461
        FPR6..... 00000000  00000000            FPR7..... 411921FB  54442D18
        FPR8..... 00000000  00000000            FPR9..... 00000000  00000000
        FPR10.... 00000000  00000000            FPR11.... 00000000  00000000
        FPR12.... 00000000  00000000            FPR13.... 00000000  00000000
        FPR14.... 00000000  00000000            FPR15.... 00000000  00000000

    Storage dump near condition, beginning at location(0000000000000000)
      +0000 0000000000000000  Inaccessible storage.
      +0010 0000000000000010  Inaccessible storage.
    GPREG STORAGE:
      Storage around GPR0 (000000001C7C5238)
        -0020 000000001C7C5218  00C300C5 00C500F1 00000248 00000108  |.C.E.E.1........|
        -0010 000000001C7C5228  B9040015 E3301288 017147F0 70020000  |....T..h...0....|
        +0000 000000001C7C5238  C9C2D460 F0F3F700 819395A4 94000000  |IBM-037.alnum...|
        +0010 000000001C7C5248  81939788 81000000 82938195 92000000  |alpha...blank...|
        +0020 000000001C7C5258  8395A399 93000000 84898789 A3000000  |cntrl...digit...|
CEE3846I CEEDUMP Processing completed.

The dump went on for nearly 3K more lines, that are basically repeats

13 days ago[PATCH] Docu suggestion for named parameters in signatures
Harald Jörg [Sun, 2 Nov 2025 17:32:27 +0000 (18:32 +0100)]
[PATCH] Docu suggestion for named parameters in signatures

Add a paragraph that callers need to specify all positional parameters
before named ones, even if the positional parameters have defaults.

Delete a sentence stating that there is no way for the caller to provide
a value for a named parameter after an optional positional parameter.
There _is_ a way, you just need to provide values for positional
parameters.

2 weeks agoRemove some special EBCDIC code
Karl Williamson [Thu, 23 Oct 2025 13:41:33 +0000 (07:41 -0600)]
Remove some special EBCDIC code

The 'variant_byte_number' function was written to find the byte number
in a word of the first byte whose meaning varies depending on if the
string it is part of is encoded in UTF-8 or not.  On ASCII machines,
that is simply when the upper bit is set.  On EBCDIC machines, there is
no similar pattern, so this function hasn't been compiled on those.

A long time ago, I realized that this function could also handle binary
data by coercing that binary data into having the form of having that
bit set or not depending on the pattern being looked for, and then
calling that function.

But I actually hadn't realized until now that it was binary data not
tied to a character set that was being worked on.  This commit rectifies
that.  A new alias is added for that function that emphasizes that it
works on binary data, the function is now compiled for EBCDIC, and the
EBCDIC-only code that avoided using it is now removed.

2 weeks agovariant_byte_number: Handle unusual byte ordering
Karl Williamson [Thu, 23 Oct 2025 14:22:46 +0000 (08:22 -0600)]
variant_byte_number: Handle unusual byte ordering

Instead of refusing to compile, it is easy to handle this case.

2 weeks agoinline.h: Remove trailing blanks
Karl Williamson [Wed, 22 Oct 2025 12:34:39 +0000 (06:34 -0600)]
inline.h: Remove trailing blanks

2 weeks agoRemove PERL_IS_SUBWORD_ADDR
Karl Williamson [Wed, 22 Oct 2025 12:33:40 +0000 (06:33 -0600)]
Remove PERL_IS_SUBWORD_ADDR

This has been subsumed by BYTES_REMAINING_IN_WORD, and is no longer
used.

2 weeks agoutf8.c: Clarify comment
Karl Williamson [Wed, 22 Oct 2025 12:30:11 +0000 (06:30 -0600)]
utf8.c: Clarify comment

2 weeks ago Use new WORTH_PER_WORD_LOOP()
Karl Williamson [Wed, 22 Oct 2025 12:29:32 +0000 (06:29 -0600)]
 Use new WORTH_PER_WORD_LOOP()

 This converts the places that could benefit from this new macro (and
 its kin) to use them.

2 weeks agoCreate WORTH_PER_WORD_LOOP(), WORTH_PER_WORD_LOOP_BINMODE()
Karl Williamson [Wed, 22 Oct 2025 11:38:06 +0000 (05:38 -0600)]
Create WORTH_PER_WORD_LOOP(), WORTH_PER_WORD_LOOP_BINMODE()

There are several places in the perl core that, for performance,  use
word-at-a-time operations on byte data when the data to be processed is
long enough to overcome the extra setup overhead required.

The code that does this is not immediately obvious, and is currently
repeated at each such place.

This macro creates two macros that encapsulate this logic, making each
place that uses them easier to read.

One macro is for data that isn't dependent on the character set.  The
other is for character data.  EBCDIC data is not suitable for per-word
operation, so the this macro always returns false on an EBCDIC platform.
This allows for the removal of some EBCDIC #ifdefs in our code base.

2 weeks agoCreate BYTES_REMAINING_IN_WORD()
Karl Williamson [Tue, 21 Oct 2025 13:16:59 +0000 (07:16 -0600)]
Create BYTES_REMAINING_IN_WORD()

This macro encapsulates the task of finding how far until the next word
boundary the passed-in address is.

There are several places that could use this, but instead of converting
use this in those places, the next commit will create macros that depend
on this one and those places will instead convert to use those other new
macros.

2 weeks agoregexec.c: Move declarations to the point of initialization
Karl Williamson [Wed, 22 Oct 2025 12:23:26 +0000 (06:23 -0600)]
regexec.c: Move declarations to the point of initialization

2 weeks agovariant_under_utf8_count: mv ARGS_ASSERT
Karl Williamson [Wed, 22 Oct 2025 12:05:44 +0000 (06:05 -0600)]
variant_under_utf8_count: mv ARGS_ASSERT

Better to have this first in the function

2 weeks agois_utf8_invariant_string_loc: mv declarations, do init
Karl Williamson [Wed, 22 Oct 2025 12:21:16 +0000 (06:21 -0600)]
is_utf8_invariant_string_loc: mv declarations, do init

This moves two variable declarations, making the ARGS_ASSERT macro
first, and it combines one declaration with its initialization.

2 weeks agomg.c: Add asserts
Karl Williamson [Fri, 24 Oct 2025 10:59:05 +0000 (04:59 -0600)]
mg.c: Add asserts

These two switch() statements handle magic names.  We now have a quick
way to determine if the first character of a name is magic.  Assert that
the cases of the switch match.  This will tell us if something gets
out-of-sync.

2 weeks agogv_magicalize: Essentially white space
Karl Williamson [Thu, 23 Oct 2025 20:06:51 +0000 (14:06 -0600)]
gv_magicalize: Essentially white space

This indents things to nicely align vertically and moves some braces in
the process

2 weeks agogv_magicalize: Refactor
Karl Williamson [Thu, 23 Oct 2025 22:05:06 +0000 (16:05 -0600)]
gv_magicalize: Refactor

This refactors to eliminate redundant code.  Some things are magical
only if we are using the main stash; others in any stash; one only in
PL_debstash.

Previously, the switches were structured thusly:
 1) if we aren't using the main stash, handle things not requiring the
        main stash
 2) if we are using the main stash, handle all len > 1 things that can
        be in the main stash.  This duplicates much of item 1)
 3) if we are using the main stash, handle all len == 1 things that can
        be in the main stash.  This duplicates some of item 1)

The new structure is
 if (len > 1) {
    1) handle len > 1 things not requiring main stash, regardless of the
       stash we are in
    2) handle len > 1 things requiring main stash
 } else {
    3) handle len == 1 things, regardless of the stash we are in.
 }

This removes the duplicated code.

The case for 'a' and 'b' are special.  When 'a' stands for "args" it is
len > 1 and that is handled in 1).

But 'a' can also mean a single character, as 'b' always does.  These
cases are handled in 3).  These are the only two len == 1 characters
that don't have to be in the main package, so there is an extra
conditional clause to allow that.

2 weeks agogv_magicalize: Replace FALLTHROUGH by what it does
Karl Williamson [Fri, 24 Oct 2025 11:53:35 +0000 (05:53 -0600)]
gv_magicalize: Replace FALLTHROUGH by what it does

This is just to make the next commit differences a bit smaller

2 weeks agogv_magicalize: remove three goto's, and dest label
Karl Williamson [Thu, 23 Oct 2025 22:00:12 +0000 (16:00 -0600)]
gv_magicalize: remove three goto's, and dest label

The previous commit moved a block, so two of these aren't necessary, and
the final one can be removed by adding an else

2 weeks agogv_magicalize: Quickly rule non-magical input out
Karl Williamson [Thu, 23 Oct 2025 21:43:18 +0000 (15:43 -0600)]
gv_magicalize: Quickly rule non-magical input out

This uses the data structure introduced in the previous commit to
quickly test the input first character.  If it isn't a potential magical
one, it could apply to CORE, so move the block that checks for that to
here, eliminating a conditional.  In either case, no need to look further.

2 weeks agoAdd "magical" chars to l1_char_class_tab.h
Karl Williamson [Thu, 23 Oct 2025 17:49:18 +0000 (11:49 -0600)]
Add "magical" chars to l1_char_class_tab.h

Some characters have special meaning to gv_magicalize().  This commit
marks those in PL_charclass.  This allows the next commit to more
quickly than currently rule them out during processing.

2 weeks agogv_magicalize: Length 0 input=>Immediately return false
Karl Williamson [Thu, 23 Oct 2025 21:29:48 +0000 (15:29 -0600)]
gv_magicalize: Length 0 input=>Immediately return false

If you trace the execution of what happens to 0 length input, it relies
on a NUL terminator in the string, and does nothing.  Simply return
false immediately instead.

2 weeks agoregcomp.c: Need to account for UTF group name
Karl Williamson [Sat, 25 Oct 2025 23:33:05 +0000 (17:33 -0600)]
regcomp.c: Need to account for UTF group name

I found this by reading the code.  Prior to this commit, the parse
pointer was advanced by one byte; it should be advanced by one
character.  As long as the the character was ASCII, things worked.

I looked through the regcomp.c source for other mis-use of the macro
changed by this commit; none were obvious.

2 weeks agoperldiag: Update description for regex group names
Karl Williamson [Sat, 25 Oct 2025 15:21:55 +0000 (09:21 -0600)]
perldiag: Update description for regex group names

This was written before Unicode, and its wording does not accurately
extend beyond ASCII.

This commit clarifies the description.

2 weeks agoreg_mesg.t: Only one error per test
Karl Williamson [Sat, 25 Oct 2025 22:49:13 +0000 (16:49 -0600)]
reg_mesg.t: Only one error per test

This just fills out a couple of tests so that they don't prematurely
end.  That makes it clear that the eorror that does get shown isn't also
due to other mistakes in the test.

2 weeks agoUpdate perlebcdic.pod
Karl Williamson [Tue, 28 Oct 2025 23:55:37 +0000 (17:55 -0600)]
Update perlebcdic.pod

2 weeks agoImplement named parameters in signatures (PPC0024)
Paul "LeoNerd" Evans [Wed, 8 Oct 2025 15:21:34 +0000 (16:21 +0100)]
Implement named parameters in signatures (PPC0024)

This adds a major new ability to subroutine signatures, allowing callers
to pass parameters by name/value pairs rather than by position.

  sub f ($x, $y, :$alpha, :$beta = undef) { ... }

  f( 123, 456, alpha => 789 );

Originally specified in

  https://github.com/Perl/PPCs/blob/main/ppcs/ppc0024-signature-named-parameters.md

This feature is currently considered experimental.

2 weeks agouniversal.c: Indent code to current standards
Karl Williamson [Sat, 10 Aug 2024 22:18:21 +0000 (16:18 -0600)]
universal.c: Indent code to current standards

These two functions had their code mostly at the left margin

2 weeks agoutil.c: Indent nested preprocessor directives
Karl Williamson [Sun, 4 Aug 2024 23:46:25 +0000 (17:46 -0600)]
util.c: Indent nested preprocessor directives

2 weeks agoMerge branch 'book/merge-deltas' into blead
Philippe Bruhat (BooK) [Tue, 28 Oct 2025 14:49:17 +0000 (15:49 +0100)]
Merge branch 'book/merge-deltas' into blead

2 weeks agoDocument BLEAD-FINAL perldelta process
Eric Herman [Fri, 24 Oct 2025 15:34:51 +0000 (15:34 +0000)]
Document BLEAD-FINAL perldelta process

Co-authored-by: Philippe Bruhat (BooK) <[email protected]>
2 weeks agotest merge-deltas.pl dies on unexpected =head1
Eric Herman [Fri, 24 Oct 2025 15:12:10 +0000 (15:12 +0000)]
test merge-deltas.pl dies on unexpected =head1

Co-authored-by: Philippe Bruhat (BooK) <[email protected]>
2 weeks agouse t/test.pl for testing
Philippe Bruhat (BooK) [Thu, 23 Oct 2025 22:51:19 +0000 (00:51 +0200)]
use t/test.pl for testing

2 weeks agohandle running the test from t/ instead of the root of the repository
Philippe Bruhat (BooK) [Thu, 23 Oct 2025 16:43:47 +0000 (18:43 +0200)]
handle running the test from t/ instead of the root of the repository

2 weeks agoupdate MANIFEST
Philippe Bruhat (BooK) [Thu, 23 Oct 2025 16:42:12 +0000 (18:42 +0200)]
update MANIFEST

2 weeks agoadd a test script for Porting/merge-deltas.pl
Philippe Bruhat (BooK) [Wed, 22 Oct 2025 23:01:58 +0000 (01:01 +0200)]
add a test script for Porting/merge-deltas.pl

2 weeks agoremove unmodified templated sections from the master
Philippe Bruhat (BooK) [Wed, 22 Oct 2025 22:27:29 +0000 (00:27 +0200)]
remove unmodified templated sections from the master

2 weeks agoprocess the deltas as utf8 files
Philippe Bruhat (BooK) [Wed, 22 Oct 2025 22:09:47 +0000 (00:09 +0200)]
process the deltas as utf8 files

2 weeks agoadd a script that merges all devel deltas into the final one
Philippe Bruhat (BooK) [Wed, 22 Oct 2025 20:16:57 +0000 (22:16 +0200)]
add a script that merges all devel deltas into the final one

For now, the script simply copies the content of each relevant section
into the same one in the master document (pod/perldelta.pod).

It will die when encountering an unexpected =head1 header.

2 weeks agoTODO tests for two segfaults
James E Keenan [Mon, 27 Oct 2025 22:25:19 +0000 (18:25 -0400)]
TODO tests for two segfaults

As described in GH #15654; code reduction by Hugo, prod to write TODO
tests from zb226.

Remove superfluous whitespace

2 weeks agoS_intuit_more: Call scan_ident in check-only mode
Karl Williamson [Sun, 19 Oct 2025 22:24:33 +0000 (16:24 -0600)]
S_intuit_more:  Call scan_ident in check-only mode

This fixes the bug that examining the parse buffer had side-effects.  I
don't know what the implications of that were.

2 weeks agoS_scan_ident: Add a check-only option
Karl Williamson [Sun, 19 Oct 2025 22:21:00 +0000 (16:21 -0600)]
S_scan_ident: Add a check-only option

There is a bug here in which this function is called from S_intuit_more
just to see if there is an identifier in the string it is looking at.
But that call can have "subtle implications on parsing" (according to
the long-standing comments in it).  We need a way to call scan_ident
without side-effects.

This commit adds that capability.  The next will use it.