76870 Commits

Author SHA1 Message Date
Bram
ffe25ee38a Add vim-modeline to render files as POD
GitHub (also) checks the vim-modeline to decide how the file should
be rendered.

These files are all in the POD format so add the vim-modeline so that
GitHub displays them in a formatted way.

(Note: adding `linguist-language=Pod` in .gitattributes does not work,
 I created a GH support ticket for that a month ago but there have
 been little progress on it.)
2022-09-05 20:39:49 +02:00
Bram
108b5e9d6c Move '=encoding utf8' after preamble
All the READMEs start with a preamble describing that the file is
written in the POD format.

When the '=encoding' line is put before the preamble then the
preamble is also rendered when viewing the file with `perldoc`
(and/or when viewing the file as POD).

Fix: move '=encoding' to the place where the actual POD starts.
2022-09-05 20:39:49 +02:00
Leon Timmermans
ebf8e19620 Explicitly add nsl to libswanted on Solaris
7e19816aa8661ce0e984742e2df11dd20dcdff18 removed it from the default
list, but it is apparently still necessary on Solaris so we add it back
in the hints file.
2022-09-05 19:00:50 +02:00
Bram
178616fe14 CI: Special case porting test in 'sanity check'
Add a special case for the porting test in the sanity check of the
CI run.

Before:
    When a porting test failed (such as t/porting/authors.t,
    t/porting/cmp_version.t, ...) then it would skip all the other
    test configurations.

Now:
    When a porting test fails:
    - result of sanity check is failure (i.e. it's red)
    - other test configurations are run and these will also run the
      porting tests. (These may or may not fail, depending on the test)

    When a non-porting test fails:
    - result of sanity check is failure (i.e. it's red)
    - sanity check still runs the porting tests
    - other test configurations are skipped

Note: in the `if`conditions of the other test configurations it was
      needed to include `always()` because otherwise GitHub uses an
      implicit `success() &&` (which check the result of the
      sanity check - which is unwanted if only the porting tests failed)

Fixes #19867
2022-09-05 16:44:05 +02:00
Bram
8d845d9fec win32: use tmp file when creating config.sh
When `config_sh.PL` failed then it created an empty '..\config.sh' file.
This is unwanted since if make is then re-run it detects a '..\config.sh'
file and skips the target which leads to completely different errors.

After adding a `die "Foobar";` in win32/config_sh.PL:

	$ gmake INST_TOP=... CCHOME=...
	...
	..\miniperl.exe -I..\lib config_sh.PL ... > ..\config.sh
	Foobar at config_sh.PL line 5.
	gmake: *** [GNUmakefile:1175: ..\config.sh] Error 255

Re-running the make command:

	$ gmake INST_TOP=... CCHOME=...
	..\miniperl.exe -I..\lib ..\configpm --chdir=..
	Use of uninitialized value $t in string eq at ..\configpm line 345.
	...
	written lib/Config.pod
	updated lib/Config.pm
	updated lib/Config_heavy.pl
	syntax error at lib/Config_heavy.pl line 165, near "x;"
	Compilation failed in require at ..\configpm line 1144.
	gmake: *** [GNUmakefile:1190: ..\lib\Config.pm] Error 255

When `gmake` was re-run it started with the '$(CONFIGPM)' target instead
of the '..\config.sh' target.

The fix: instead of creating '..\config.sh' it now first creates
         '..\config.sh.tmp' and then renames[^1] it to '..\config.sh'

Tested the GNUmakefile on Windows 10 using GNU Make v4.2.1,
I did *not* test the Makefile (no nmake installed).

[^1]: `rename` on windows only takes a path in the first argument.
      That is: `rename ..\config.sh.tmp config.sh` can be considered
      the same as `move ..\config.sh.tmp ..\config.sh`.
2022-09-05 16:43:44 +02:00
Bram
17e4de6a25 io/socket.t: Use SO_SNDBUF instead of SO_RCVBUF
The test was checking the return value of `getsockopt(..., SO_RCVBUF)`
after setting it with `setsockopt(..., SO_RCVBUF, $i)`.

The values the test accepted:
- '$i'
- '2 * $i'

The '2 * $i' is because Linux doubles the size of the buffer.[^1]

On OmniOS(/SmartOS/Solaris?) it also treats the SO_RCVBUF special..
Apparently:
- when using g++: it returns '$i'
- when using gcc: the value depends on the 'tcp_mss_def_ipv4' setting.[^2].
  By default this is 536 so the value it returns is: '536 * ceil($i / 536)'
  (with a minimum of 'tcp_recv_hiwat_minmss' (=4) * 'tcp_mss_def_ipv4' (=536)

It doesn't seem to do anything special for `SO_SNDBUF` so let's use that
in the test instead.

(Tested on: Linux (gcc), Windows 10 (gcc), OmniOS (gcc,g++), FreeBSD (gcc).)

Fixes #20188

[^1]: https://www.cs.helsinki.fi/linux/linux-kernel/2001-30/0880.html
[^2]: https://github.com/TritonDataCenter/illumos-joyent/blob/master/usr/src/stand/lib/tcp/tcp.c#L7034
    ```
        case SOL_SOCKET: {
            switch (option) {
                case SO_RCVBUF:
                    ...
                    val = MSS_ROUNDUP(val, tcp->tcp_mss);
    ```
    (with thanks to @wolfsage for that link)
2022-09-05 16:41:45 +02:00
Bram
acd915eac0 Porting/cmpVERSION.pm: cleanup %skip_versions whitespace 2022-09-05 16:40:46 +02:00
Bram
dd57828b34 Porting/cmpVERSION.pm: tabs to spaces
This file was used a mix in indentation of tabs and spaces..
Sometimes even in the same code-block..

Fix this by replacing the tabs to spaces using:
    `perl -pli -e 's/^(\t+)/" " x (8 * length ($1))/e' Porting/cmpVERSION.pl`
2022-09-05 16:40:46 +02:00
Bram
4c135c1dc9 cmpVERSION.pm: remove exception for experimental
The original message added in commit a9a41e90102044c0dec8a28b7a0d24a7f4a9b84d:
	"... - can be removed once v5.37.2 is released"

When v5.37.2 was released the message was updated to 'once v5.37.3 is released'
When v5.37.3 was released the message was updated to 'once v5.37.4 is released'

-> Remove the entry since it's no longer needed.
2022-09-05 16:40:46 +02:00
James E Keenan
5dee37359d Block lacked 'skip' condition; de-SKIP it
There is, however, one SKIP block within that block.  Indent it
properly.

For: https://github.com/Perl/perl5/issues/20086
2022-09-05 07:54:56 -04:00
Bram
86072b2a81 Add note in RMG about using your own fork
Add a small section in the release manager guide about using your own
fork of the perl5 repo when making the release. The current guide is
not written with that in mind and as a result is missing some steps.
2022-09-05 10:39:56 +02:00
Bram
0c4b0c04d7 Tidy output of perlbug for pasting on GitHub
Clean up the report created by `perlbug` so that it looks better
when pasted in a GitHub issue:
- Put the 'perl configuration' in a code-block
- Hide some sentences
- Clean up 'Flags' section (it was shown as a very big header and
  taking up quite a lot of space)
- Add `**Description**`, `**Steps to Reproduce**` and `**Expected behaviour**`
  in the body of the report (similar to the GitHub issue template)
- If this is a report about a core module then also put the name of the Module
  at the top (it's still included in 'Flags' as well)
- ...

(There are two newlines added before 'Flags', this is to deal with someone
 using `perlbug -b foo`, without the newlines GitHub would make turn the
 'foo' into a title)
2022-09-05 10:39:35 +02:00
Elvin Aslanov
b5b600ed40 Delete .travis.yml
This file seems no longer needed since switching to GitHub Actions for CI.
2022-09-05 09:14:11 +02:00
Yves Orton
f31da5f4a2 cop.h - show function name
Also add SAFE_FUNCTION__ which ensures that the value
is "UNKNOWN" on platforms that dont support __func__.
2022-09-05 07:57:17 +02:00
Yves Orton
59e36a288a pp_ctl - guard PL_unitcheckav setup logic from cases where the array is empty 2022-09-05 07:57:17 +02:00
Yves Orton
d1a6746d8c pp_ctl.c - handle UNITCHECK better
Make sure we actually return via pp_evalcomp() when UNITCHECK
inside of an eval dies.

Thanks to Bram for the work figuring this out.
2022-09-05 07:57:17 +02:00
Yves Orton
0a2c330776 t/comp/retainedlines.t - test eval "UNITCHECK{die}" also
We test BEGIN{die}, but not UNITCHECK{die}. Lets do both.
2022-09-05 07:57:17 +02:00
Yves Orton
c304acb49d pp_ctl.c - use try_yyparse() for eval
CATCH_GET is never true in this code, so we never called try_yyparse()
which in turn meant we leaked debug data from failed evals. With this
in place an eval that dies during compile will always be handled by
doeval_comp() properly.

This includes changes to t/comp/readlines.t so it tests code that
croaks during compile, which used to leak and fail test but was not
actually tested.

This fixes GH Issue #20161.
2022-09-05 07:57:17 +02:00
Yves Orton
aeff225d87 cop.h - fix warnings about i across setjmp
We can just do the count before and after.
2022-09-05 07:57:17 +02:00
Bram
202773ee0a todo.pod: Remove version number from todo item
Porting/todo.pod contains one todo item that mentions a version number.
That particular version number has already been bumped 90 times on blead...

I think it's time to stop bumping it and replace it with a generic text.
(It started as v5.14.0, then got bumped to v5.18.0 and then got bumped
 with every release...)
2022-09-03 21:34:10 -04:00
danielnachun
7a29e8d2c8 AUTHORS: update 2022-09-03 18:14:47 +02:00
danielnachun
7e19816aa8 Configure: remove nsl from libswanted 2022-09-03 18:14:47 +02:00
E. Choroba
f09935421f Document that "select" affects "say"'s default filehandle, too 2022-09-03 15:27:40 +01:00
Bram
8975221916 Add a .github/README.md
This is based on the existing README and is an almost exact copy.
Some minor formatting changes to improve the rendering but the text
remains the same. This is done because not having a formatted README
is blocking some other changes.[^1]

t/porting/copyright.t was also adjusted to check the copyright in
.github/README.md

*Long term*: In the long term the contents of README and .github/README.md
will differ. Since these serve a different purpose:
- README: this is included with each release and for that it's more then
  good enough enough;
- .github/README.md: this is for people viewing the repository on GitHub
  and for that the current README is - in my opinion - not good enough.
  It should be much more informative (compare it with some other repos
  and that should be obvious, in #18965 there are some examples but
  many more exist).

[^1]: rendering platform specific READMEs as POD in GitHub.
2022-09-03 11:18:17 +02:00
Yves Orton
127965c049 Move PERL_WAIT_FOR_CHILDREN till after we handle END blocks during destruct
See https://github.com/Perl/perl5/issues/16418

This should fix the issue with Win32.
2022-09-03 10:05:54 +02:00
Yves Orton
375d68c017 Revert "Revert "set PERL_EXIT_DESTRUCT_END in all embeddings""
This reverts commit 64a9c780950becebc7326a31d067801ec9b187a2.
2022-09-03 10:05:54 +02:00
Yves Orton
197bb3f441 Revert "postpone perl_parse() exit(0) bugfix"
This reverts commit 857320cbf85e762add18885ae8a197b5e0c21b69.

There were a lot of conflicts due to whitespace changes in the
intervening time. I manually reviewed the differences and merged them.
2022-09-03 10:05:54 +02:00
Yves Orton
451a9a1260 op.c - work around Module::Install::DSL issue
This converts INIT {} blocks from the Module::Install::DSL
namespace into BEGIN blocks. This works around the bug reported in
GH Issue #16300. (Hopefully, not fully tested yet.) Which in turn
should allow us to close the bug in #2754.

See also PR: #20168 and Issue: #20161 both of which are blocked by
this.
2022-09-03 10:05:54 +02:00
Karl Williamson
69bc7167fa Merge branch 'Locale changes for "$!"' into blead
This series of commits improves the handling of system error messages
that come from strerror().

It turns out that strerror() can return mojibake if the LC_CTYPE locale
and the LC_MESSAGES locale aren't set to the same thing. They are now
synced for the duration of the routine, if necessary.

There have long been lots of preprocessor conditionals depending on the
platform's capabilities. These are now refactored so that the various
implementations are separate short functions, which are easier to
understand when not interrupted by those directives.

These commits and previous ones have now completely replaced some large
and cumbersome functions, which are also removed in this series.
2022-09-02 13:21:24 -06:00
Karl Williamson
8544fe162d locale.c: Convert final use of S_category_name()
The previous commit removed all but one use of this function, which is
replaceable by an array lookup
2022-09-02 13:21:24 -06:00
Karl Williamson
3d118badf8 locale.c: Rmv no longer used code; UTF8ness cache
What these functions do has been subsumed by code introduced in previous
commits, and in a more straight forward manner.

Also removed in this commit is the cache of the knowing what locales are
UTF-8 or not.  This data is now cheaper to calculate when needed, and
there is now a single entry cache, so I don't think the complexity
warrants keeping it.

It could be added back if necessary, split off from the remainder of
this commit.
2022-09-02 13:21:24 -06:00
Karl Williamson
8fffab5814 locale.c: Add const to my_strerror retrurn
A bit of safety
2022-09-02 13:21:24 -06:00
Karl Williamson
c728a1a620 Move utf8ness calc for $! into locale.c from mg.c
locale.c has the infrastructure to handle this, so remove repeated
logic.

The removed code tried to discern better based on using script runs, but
this actually doesn't help, so is removed.

Since we're now using C99, we can remove the block that was previously
needed, and now the code is properly indented, whereas before it wasn't
2022-09-02 13:21:24 -06:00
Karl Williamson
cb5c690da6 Avoid mojibake in "$!"
In stress testing, I discovered that the LC_CTYPE and LC_MESSAGES
locales need to be the same locale, or strerror() can return
question marks or mojibake instead of the proper message.

This commit refactors the handling of stringifying "$!" to make the
locales of both categories the same during the stringification.

Actually, I suspect it isn't the locale, but the codeset of the locale
that needs to be the same.  I suspect that if the categories were both
in different UTF-8 locales, or both in single-byte locales, that things
would work fine.  But it's cheaper to find the locale rather than the
locale's codeset, so that is what is done.
2022-09-02 13:21:24 -06:00
Karl Williamson
091b5ed710 locale.c: Refactor #ifdef's for clarity
The my_strerror() function has effectively 5 different implementations
depending on the capabilities of the platform.  Only a few lines are
common to all, the set-up and the return.  The #ifdefs obscure the
underlying logic.  So this commit separates things out so that the
ifdefs don't interrupt the flow as much, with the result that it's
clearer what is going on in each implementation.
2022-09-02 13:21:24 -06:00
Karl Williamson
4ab43d2fda Define print_bytes_for_locale() outside locale
A future commit will need this even when locales are not used.
2022-09-02 13:21:24 -06:00
Yves Orton
501e249dd3 .github/CONTRIBUTING.pd - Fixup symlink to be relative 2022-09-02 21:08:43 +02:00
Elvin Aslanov
cda9a13690 Create .github/CONTRIBUTING.pod
Adding a standard GitHub file as a symlink to pod/perlhack.pod

See https://github.com/Perl/perl5/community
2022-09-02 20:59:47 +02:00
Yves Orton
235ba40725 Add a perldelta for SVf_QUOTEDPREFIX changes to error messages 2022-09-02 19:47:07 +02:00
Yves Orton
741a5c7396 op.c - Restrict nested eval/BEGIN blocks to a user controllable maximum
Nested BEGIN blocks can cause us to segfault by exhausting
the C stack. Eg:

    perl -le'sub f { eval "BEGIN { f() }" } f()'

will segfault. This adds a new interpreter var PL_eval_begin_nest_depth
to keep track of how many layer of eval/BEGIN we have seen, and a new
reserved variable called ${^MAX_NESTED_EVAL_BEGIN_BLOCKS} which can be
used to raise or lower the limit. When set to 0 it blocks BEGIN entirely,
which might be useful from time to time.

This fixes https://github.com/Perl/perl5/issues/20176
2022-09-02 10:05:42 +02:00
Karl Williamson
cd55125d69 Merge branch 'locale.c: Improve newcollate' into blead
newcollate is called when LC_COLLATE is set to a new locale. This series
of commits improves its operation

Some platforms require LC_CTYPE and LC_COLLATE to be the same locale in
order to operate properly. These commits now bring LC_CTYPE into sync
with LC_COLLATE for the duration of the calculations.

More and better debugging statements are added

Memory is allocated when a string is collated. The amount is roughly a
linear function of the string length, varying depending on the locale.
To save some recalculations, perl calculates and saves coefficients for
the current locale's equation once, revising them if necessary. Prior to
this commit, this somewhat expensive calculation was done every time the
locale changed. Now it is deferred until the first time it is needed.
2022-09-01 10:29:04 -06:00
Karl Williamson
21afce673d locale.c: Move S_compute_collxfrm_coefficients in file
This moves this function, created in the previous commit by simply
wrapping existing code, to a more logical place in the file.
2022-09-01 10:28:26 -06:00
Karl Williamson
5fdda5120f locale.c: Add 'Lazy' location changing
When comparing two strings for order under 'use locale', one can call
strcoll() which creates hidden modified versions of the strings based on
the locale's collation ordering, does the comparison, and then throws
away the modified versions.

Or one can call strxfrm() to create a non-hidden modified version of
each string, and then do a straight comparison.  The advantage here is
that you are in control of when to discard the modified version, and the
(expensive) transformation is done just once, no matter how many times a
comparison is done.

Perl assumes that a string will be compared multiple times, so the first
time it happens under 'use locale', strxfrm() is called, and the
modified string is attached via magic to the SV.  The modified string is
discarded if the string changes, or is recomputed if the locale has
changed since the computation was done.

The transformation generally occupies some multiple of size of the
original string.  Memory must be allocated to hold it.  For any given
locale, the amount is predictable for all strings, roughly via a linear
equation "mx+b", where x is the size of the original string.  By
computing 'm' and 'b' once, Perl can allocate enough memory to hold the
transformation, but not too much.  (m and b are adjusted up as necessary
as more strings get transformed.)  This minimizes mallocs.

But the calculation of m and b is somewhat expensive, and only necessary
if the program actually does a string compare under 'use locale'.

This commit defers the calculation until needed.  It does the bare
minimum of changes accomplish this.  The next commit will rearrange
things.
2022-09-01 10:28:26 -06:00
Karl Williamson
f42ab9041b locale.c: Add debug statement for collation failure
Perhaps this should be a warning to the user that we couldn't calculate
collation info for the locale, but at least there should be a way to
get that info from a DEBUG statement
2022-09-01 10:28:26 -06:00
Karl Williamson
467b0d6702 locale.c: Improve debugging for mem_collxfrm()
This prints out more information, better organized.

It also moves up the info from -DLv to plain -DL
2022-09-01 10:28:26 -06:00
Karl Williamson
1362b2644f Change internal function name to be standards compliant
This is in preparation for working on it; the new name, mem_collxfrm_ is
in compliance with the C Standard; the old was not.
2022-09-01 10:28:26 -06:00
Karl Williamson
ef054375a8 locale.c: Use strxfrm_l() if available
This more modern version of the function doesn't require us to change
locales.
2022-09-01 10:28:26 -06:00
Karl Williamson
1915ba8967 locale.c: strxfrm() requires LC_CTYPE eq LC_COLLATE
The libc functions strxfrm() on some platforms requires the LC_CTYPE
locale to be the same as the LC_COLLATE locale (or rather, probably that
they have the same code set, but checking for locale is cheaper).
Otherwise mojibake would result, or more likely the function will fail,
setting errno.

This commit brings the locales into alignment if necessary
2022-09-01 10:28:26 -06:00
Karl Williamson
076763411b locale.c: Don't assume LC_CTYPE, LC_COLLATE are same
This code is using isCNTRL_LC which depends on LC_CTYPE to verify that
something in the LC_COLLATE locale is a control.  That only works
properly if the two locales are the same.  This commit adds code to
ensure they are.
2022-09-01 10:28:26 -06:00
Karl Williamson
89713b94b2 locale.c: Rmv unused code in changing LC_COLLATE
The code to handle changing LC_COLLATE handled the possibility of being
passed a NULL locale name.  But we're not changing things unless we have
a new locale, and know its name, so a name is always passed
2022-09-01 10:28:25 -06:00