This is a live mirror of the Perl 5 development currently hosted at
4 years agoWhat a show, there they go smokin' up the sky, yeah.
Chris 'BinGOs' Williams [Thu, 21 Sep 2017 08:47:55 +0000 (09:47 +0100)]
What a show, there they go smokin' up the sky, yeah.

4 years agoChange save/restore behavior for comparisons
jpl [Mon, 28 Aug 2017 13:54:15 +0000 (09:54 -0400)]
Change save/restore behavior for comparisons

S_mergesortsv was saving the current comparison routine only when the
SORTf_DESC flag was set, but "restoring" it when ANY flag was set.
When some flag other than SORTf_DESC was set, this could lead to
the pointer to the comparison routine being set to NULL,
triggering a segfault when the routine was subsequently invoked.

4 years ago(perl #127663) skip the new in-place edit tests if File::Spec not loadable
Tony Cook [Thu, 21 Sep 2017 00:35:25 +0000 (10:35 +1000)]
(perl #127663) skip the new in-place edit tests if File::Spec not loadable

I expected File::Spec to be loadable at this point, since PathTools is
in, but that isn't loaded in minitest, so it failed.

The new tests in-place edit tests are now conditional on File::Spec

4 years agoBump perl version to 5.27.5, including Module::CoreList bits
John SJ Anderson [Wed, 20 Sep 2017 22:27:28 +0000 (15:27 -0700)]
Bump perl version to 5.27.5, including Module::CoreList bits

4 years agoNew perldelta for 5.27.5
John SJ Anderson [Wed, 20 Sep 2017 22:16:51 +0000 (15:16 -0700)]
New perldelta for 5.27.5

4 years agoPorting/release_schedule.pod: Record release of 5.27.4
John SJ Anderson [Wed, 20 Sep 2017 22:07:30 +0000 (15:07 -0700)]
Porting/release_schedule.pod: Record release of 5.27.4

4 years agoPorting/epigraphs.pod: correct release date for 5.27.3
John SJ Anderson [Wed, 20 Sep 2017 22:03:50 +0000 (15:03 -0700)]
Porting/epigraphs.pod: correct release date for 5.27.3

4 years agoEpigraph for 5.27.4
John SJ Anderson [Wed, 20 Sep 2017 22:03:28 +0000 (15:03 -0700)]
Epigraph for 5.27.4

4 years agoMerge branch 'release-5.27.4' into blead
John SJ Anderson [Wed, 20 Sep 2017 21:59:39 +0000 (14:59 -0700)]
Merge branch 'release-5.27.4' into blead

4 years agoRevert "test - Do not run test output at compilation time" v5.27.4
John SJ Anderson [Wed, 20 Sep 2017 19:54:16 +0000 (12:54 -0700)]
Revert "test - Do not run test output at compilation time"

This reverts commit d190dde9b72a7c306622389007b0dba86901ce52.

Changes in this commit broken `make minitest`, as discovered during
the 5.27.4 release process.

4 years agoadd new release to perlhist
John SJ Anderson [Wed, 20 Sep 2017 18:11:39 +0000 (11:11 -0700)]
add new release to perlhist

4 years agoFinalize perldelta for 5.27.4
John SJ Anderson [Wed, 20 Sep 2017 17:58:00 +0000 (10:58 -0700)]
Finalize perldelta for 5.27.4

4 years agoUpdate Module::CoreList for 5.27.4
John SJ Anderson [Wed, 20 Sep 2017 13:53:25 +0000 (06:53 -0700)]
Update Module::CoreList for 5.27.4

4 years agoprevent pod/builttoc spewing bad UTF-8 errors under PERL_UNICODE
Tony Cook [Wed, 20 Sep 2017 03:44:59 +0000 (13:44 +1000)]
prevent pod/builttoc spewing bad UTF-8 errors under PERL_UNICODE

4 years agoavoid sysread()/syswrite() warnings from the default :utf8 from PERL_UNICODE
Tony Cook [Wed, 20 Sep 2017 03:27:11 +0000 (13:27 +1000)]
avoid sysread()/syswrite() warnings from the default :utf8 from PERL_UNICODE

In a UTF-8 locale, if the PERL_UNICODE environment variable is set,
perl may add a :utf8 layer.

v5.23.1-197-gfb10a8a deprecated using sysread(), syswrite() etc on such
handles, which meant that a test run under PERL_UNICODE could produce
a significant number of deprecation warnings.

Prevent those warnings, typically by binmode(), but in one case by
disabling the warning.

4 years agouconfig.h: Regenerate for release
John SJ Anderson [Tue, 19 Sep 2017 16:04:05 +0000 (09:04 -0700)]
uconfig.h: Regenerate for release

4 years agoregen Configure and friends after backports
H.Merijn Brand [Tue, 19 Sep 2017 10:50:05 +0000 (12:50 +0200)]
regen Configure and friends after backports

4 years ago(perl #132008) make sure the test behaves without a tty
Tony Cook [Tue, 19 Sep 2017 07:40:52 +0000 (17:40 +1000)]
(perl #132008) make sure the test behaves without a tty

The test is intended to test how Term::ReadLine behaves without a tty
and mocks up an invalid tty.

Unfortunately some of the checks it does fail if the test starts without
a tty.

Modified the test to handle the lack of a tty.

4 years agoperldelta for 08ccc8101277
Tony Cook [Tue, 19 Sep 2017 01:25:59 +0000 (11:25 +1000)]
perldelta for 08ccc8101277

4 years ago(perl #131777) prevent non-'=' assign ops tokens in sub signatures
Tony Cook [Tue, 25 Jul 2017 04:36:28 +0000 (14:36 +1000)]
(perl #131777) prevent non-'=' assign ops tokens in sub signatures

The yacc grammar introduced in d3d9da4a7 uses ASSIGNOP to
represent the '=' used to introduce default values in subroutine
signatures, unfortunately the parser returns ASSIGNOP for non-simple
assignments, which allowed:

  sub foo ($x += 1) { ... }

to default $x to 1.

Modify yylex to accept only the simple assignment operator after a
subroutine parameter.

I'm not especially happy with the error recovery here.

4 years agoAPItest/t/locale.t: Fix to not show failures on OpenBsd
Karl Williamson [Sun, 17 Sep 2017 03:59:20 +0000 (21:59 -0600)]
APItest/t/locale.t: Fix to not show failures on OpenBsd

It turns out that this OS does not implement all of POSIX 2008, and so
certain tests were failing.  This moves the eval earlier and makes sure
it succeeds before calling the API function

4 years ago(perl #132008) try to prevent the similar mistakes in the future
Tony Cook [Mon, 18 Sep 2017 05:07:21 +0000 (15:07 +1000)]
(perl #132008) try to prevent the similar mistakes in the future

4 years agoTerm::ReadLine generates empty &STDERR files
James E Keenan [Fri, 1 Sep 2017 02:57:06 +0000 (22:57 -0400)]
Term::ReadLine generates empty &STDERR files

Revert to 2-arg open in one case.

If /dev/tty is inaccessible, redirecting file handles to STDERR:

       open (my $fh, ">&STDERR))

... cannot be done as a 3 arg open or it'll actually try to write to that

Bump $Term::ReadLine::VERSION.
Add unit test for RT #132008

For: RT #132008
(cherry picked from commit e4dc68d725b19f46c6fca9423e6e7a0eaeff47f4)
Signed-off-by: Nicolas R <>

4 years ago(127663) fix some portability issues with the new in-place edit
Tony Cook [Mon, 18 Sep 2017 01:18:55 +0000 (11:18 +1000)]
(127663) fix some portability issues with the new in-place edit

- renameat() is present but broken for absolute paths on FreeBSD 11,
  add a workaround.

- the new implementation uses linkat() but the availability checks
  in doio.c and the tests didn't check for it.

4 years agoRevise tests to account for d_linkat.
James E Keenan [Thu, 14 Sep 2017 16:38:13 +0000 (12:38 -0400)]
Revise tests to account for d_linkat.

4 years agoMake use of *at functions dependent upon HAS_LINKAT.
James E Keenan [Thu, 14 Sep 2017 14:12:01 +0000 (10:12 -0400)]
Make use of *at functions dependent upon HAS_LINKAT.

As suggested by Zefram.

For: RT #132087.

4 years ago(perl #127663) work around what appears to be a freebsd bug
Tony Cook [Mon, 18 Sep 2017 00:39:48 +0000 (10:39 +1000)]
(perl #127663) work around what appears to be a freebsd bug

renameat() on FreeBSD 11 fails if the paths supplied are absolute

4 years ago(perl #132087) correct *at() function detection on older darwin
Tony Cook [Fri, 15 Sep 2017 00:25:10 +0000 (10:25 +1000)]
(perl #132087) correct *at() function detection on older darwin

4 years agoRevert changes to t/op/threads-dirh.t in 1ce8be81dfaf09bc8a07.
James E Keenan [Fri, 15 Sep 2017 23:46:03 +0000 (19:46 -0400)]
Revert changes to t/op/threads-dirh.t in 1ce8be81dfaf09bc8a07.

They were causing failures on smoke testers running threaded builds on Linux.

For: RT #132092

4 years agotest - Do not run test output at compilation time
Nicolas R [Thu, 14 Sep 2017 20:52:37 +0000 (14:52 -0600)]
test - Do not run test output at compilation time

Even if in most of the cases it seems ok to print
output during compilation time, this is a pretty
bad idea (when compiling the test for example).

Run all the tests at compile time, but only
print the test status at run time.

(Trailing whitespace cleanup by committer.)

For: RT # 132092

4 years agotest - Do not use B which is a reserved namespace
Nicolas R [Thu, 14 Sep 2017 20:52:19 +0000 (14:52 -0600)]
test - Do not use B which is a reserved namespace

B is already a reserved namespace. This is a bad idea
to use B during unit test, as this increase the complexity
when using one of the B subpackage to run the test.

Simply rename B to BB ( and A to AA ).

(Whitesapce cleanup by committer.)

For: RT # 132092

4 years agotests - remove useless setting in BEGIN
Nicolas R [Thu, 14 Sep 2017 20:51:42 +0000 (14:51 -0600)]
tests - remove useless setting in BEGIN

These two tests are not using
and do not need to load any special file.

No need for fancy setup in BEGIN, all the most
we cannot use the generic set_up_inc helper.

Simply remove the useless BEGIN block.

4 years agotests - Use set_up_inc helper to set @INC
Nicolas R [Thu, 14 Sep 2017 20:51:13 +0000 (14:51 -0600)]
tests - Use set_up_inc helper to set @INC

Test plan should not be declared at compile time

4 years agoParenthesize macro arguments to ninstr()
Karl Williamson [Fri, 15 Sep 2017 03:58:14 +0000 (21:58 -0600)]
Parenthesize macro arguments to ninstr()

This did not work properly if called if expressions for arguments.

Could someone write a porting test to look for non-parenthesized macro
arguments involved in expressions

4 years agot/run/locale.t: Move function call
Karl Williamson [Mon, 11 Sep 2017 18:30:14 +0000 (12:30 -0600)]
t/run/locale.t: Move function call

I think its better form to call the function after the 'use' statement that
imported the function being called, even though it's available
throughout the enclosing block.

4 years agolocale.c: Show how the number '112' was derived
Karl Williamson [Mon, 11 Sep 2017 15:48:33 +0000 (09:48 -0600)]
locale.c: Show how the number '112' was derived

It's unclear why the code uses this number, so expand out the expression
that yields that, which makes it clearer.

4 years agoTest for 0e3f4440d849cf8fca676f87e574164e33cf2e13
Abigail [Wed, 13 Sep 2017 22:17:53 +0000 (00:17 +0200)]
Test for 0e3f4440d849cf8fca676f87e574164e33cf2e13

Commit 0e3f4440d849cf8fca676f87e574164e33cf2e13 fixes issue #131868
by silencing a warning which should not happen. This patch checks
that the warning is not happening.

4 years agoFix #131868 - silence quantifier warnings for regex gosub
Yves Orton [Wed, 13 Sep 2017 16:04:43 +0000 (18:04 +0200)]
Fix #131868 - silence quantifier warnings for regex gosub

We check that numerically quantified subpatterns can match something,
so that we can detect things like (){4}. However, we produce false positives
when using regex recursion. This is related to slow-downs in grammar matches
in Perl 5.20 which were fixed by a51d618a82a7057c3aabb600a7a8691d27f44a34.

In an ideal world we would do a lot of work and this false-positive would not
happen, but that requires more round tuits than I have available

4 years agoin hash init code preserve constness
Yves Orton [Wed, 13 Sep 2017 11:34:17 +0000 (13:34 +0200)]
in hash init code preserve constness

This causes warnings in some our builds as can be seen in some
smoke reports:

  zaphod32_hash.h:185:17: warning: cast discards '__attribute__((const))'
  qualifier from pointer target type [-Wcast-qual]

4 years agoavoid 'the address of ... will always evaluate as ...' warns in mem macros
Yves Orton [Wed, 13 Sep 2017 11:30:25 +0000 (13:30 +0200)]
avoid  'the address of ... will always evaluate as ...' warns in mem macros

In f14cf363205 we added asserts to our memory macros (Copy(), Zero() etc)
to ensure that the target is non-null. These asserts throw warnings like

    perl.c: In function ‘Perl_eval_sv’:
    perl.c:2976:264: warning: the address of ‘myop’ will always evaluate
    as ‘true’ [-Waddress]
         Zero(&myop, 1, UNOP);

which is annoying. This patch changes how these asserts are coded so
we avoid the warning. Thanks to Zefram for the fix.

4 years agoCheck for Unicode replacement character in t/porting/podcheck.t
Dagfinn Ilmari Mannsåker [Mon, 11 Sep 2017 15:55:17 +0000 (16:55 +0100)]
Check for Unicode replacement character in t/porting/podcheck.t

Pod::Simple replaces bytes that aren't valid according to the
document's encoding (declared or auto-detected) \N{REPLACEMENT
CHARACTER}, so catch that.

4 years agoFix misplaced =back in t/porting/podcheck.t
Dagfinn Ilmari Mannsåker [Mon, 11 Sep 2017 15:51:28 +0000 (16:51 +0100)]
Fix misplaced =back in t/porting/podcheck.t

The list of pedantic checks was mistakenly nested inside the last
mandatory check.

4 years agoFix Windows-1252 em-dashes in latest epigraphs
Dagfinn Ilmari Mannsåker [Mon, 11 Sep 2017 15:53:50 +0000 (16:53 +0100)]
Fix Windows-1252 em-dashes in latest epigraphs

4 years agoperldelta for ae2cf9f6 and f6107ca2
Dagfinn Ilmari Mannsåker [Mon, 11 Sep 2017 14:49:32 +0000 (15:49 +0100)]
perldelta for ae2cf9f6 and f6107ca2

4 years agoperldelta for 9c6681cc159f
Tony Cook [Mon, 11 Sep 2017 05:28:55 +0000 (15:28 +1000)]
perldelta for 9c6681cc159f

4 years agoNot jhi, lwall.
Jarkko Hietaniemi [Mon, 11 Sep 2017 04:53:23 +0000 (07:53 +0300)]
Not jhi, lwall.

4 years ago[perl #127663] safer in-place editing
Tony Cook [Mon, 11 Sep 2017 04:48:21 +0000 (14:48 +1000)]
[perl #127663] safer in-place editing

4 years ago(perl #127663) fallback to looking for work file if st_ino unusable
Tony Cook [Tue, 15 Aug 2017 23:17:25 +0000 (09:17 +1000)]
(perl #127663) fallback to looking for work file if st_ino unusable

4 years ago(perl #127663) reject a changed directory for relative in-place filenames
Tony Cook [Wed, 12 Jul 2017 04:25:32 +0000 (14:25 +1000)]
(perl #127663) reject a changed directory for relative in-place filenames

based in the inode/device numbers when we don't have the *at()

4 years ago(perl #127663) test we fail if the work file can't be renamed
Tony Cook [Thu, 12 Jan 2017 02:52:04 +0000 (13:52 +1100)]
(perl #127663) test we fail if the work file can't be renamed

and ensure we (attempt to) clean up the work file

4 years ago(perl #127663) test we fail if the backup rename fails
Tony Cook [Thu, 12 Jan 2017 02:51:01 +0000 (13:51 +1100)]
(perl #127663) test we fail if the backup rename fails

and that we clean up the temp file

4 years ago(perl #127663) clean up any files left behind
Tony Cook [Thu, 12 Jan 2017 00:02:52 +0000 (11:02 +1100)]
(perl #127663) clean up any files left behind

The rename work file test will leave the work file, if the other tests
fail for some reason they might also leave files.

4 years ago(perl #127663) don't do inplace renaming etc in child processes
Tony Cook [Wed, 11 Jan 2017 23:58:58 +0000 (10:58 +1100)]
(perl #127663) don't do inplace renaming etc in child processes

This avoids trying to rename the work file over the original
multiple times, which could make the implicit (or explicit) close

This is an incompatibility with the pre-workfile version of in-place
editing, since you could previously fork a child to do process a
given file, but hopefully this is a rare case.

4 years ago(perl #127663) don't do inplace renaming etc in child threads
Tony Cook [Wed, 11 Jan 2017 23:26:47 +0000 (10:26 +1100)]
(perl #127663) don't do inplace renaming etc in child threads

This also avoids double closedir()ing the directory handle.

4 years ago(perl #127663) test chdir() within an in-place edit loop
Tony Cook [Mon, 9 Jan 2017 06:02:38 +0000 (17:02 +1100)]
(perl #127663) test chdir() within an in-place edit loop

4 years ago(perl #127663) use *at() functions to handle perl code that chdirs
Tony Cook [Mon, 12 Dec 2016 22:03:08 +0000 (09:03 +1100)]
(perl #127663) use *at() functions to handle perl code that chdirs

Unfortunately this means systems that don't have the *at() functions
aren't protected from code that chdir()s in the middle of in-place
editing a file.

4 years agoadd probes for openat, unlinkat, renameat, linkat and fchmodat
Tony Cook [Mon, 12 Dec 2016 03:26:30 +0000 (14:26 +1100)]
add probes for openat, unlinkat, renameat, linkat and fchmodat

4 years ago(perl #127663) provide limited control for the internal drand48()
Tony Cook [Wed, 7 Dec 2016 22:38:55 +0000 (09:38 +1100)]
(perl #127663) provide limited control for the internal drand48()

perl can be built without PERL_INTERNAL_RAND_SEED support to reduce
it's attack surface.

4 years ago(perl #127663) test that die/exit leave the original file
Tony Cook [Tue, 2 Aug 2016 06:05:22 +0000 (16:05 +1000)]
(perl #127663) test that die/exit leave the original file

4 years ago(perl #127663) discard any output if not closed properly
Tony Cook [Wed, 3 Aug 2016 04:43:59 +0000 (14:43 +1000)]
(perl #127663) discard any output if not closed properly

It can be closed by either iterating to the next file, or by
an explicit close(ARGVOUT);

4 years ago(perl #127663) add more in-place edit tests
Tony Cook [Mon, 23 May 2016 23:06:18 +0000 (09:06 +1000)]
(perl #127663) add more in-place edit tests

test that setuid is preserved with nested in-place editing, which
fails previously.

4 years ago(perl #127663) all platforms no longer require a backup file
Tony Cook [Thu, 19 May 2016 05:22:32 +0000 (15:22 +1000)]
(perl #127663) all platforms no longer require a backup file

Platforms that disallow deleting an open file, like Win32, Cygwin,
previously required a backup extension (defaulted for Cygwin), but
since we now write to a work file that's no longer necessary (but
might still be desirable.)

4 years ago(perl #127663) safer in-place editing
Tony Cook [Wed, 11 Jan 2017 03:49:53 +0000 (14:49 +1100)]
(perl #127663) safer in-place editing

Previously in-place editing opened the file then immediately
*replaced* the file, so if an error occurs while writing the output,
such as running out of space, the content of the original file is lost.

This changes in-place editing to write to a work file which is renamed
over the original only once the output file is successfully closed.

It also fixes an issue with setting setuid/setgid file modes for
recursive in-place editing.

4 years ago(perl #127663) only test renaming directories with rename() available.
Tony Cook [Thu, 4 Aug 2016 04:34:21 +0000 (14:34 +1000)]
(perl #127663) only test renaming directories with rename() available.

Perl's rename implementation falls back to link() to rename when
rename() isn't available, which is either disallowed or dangerous.

4 years ago(perl #127663) add our own mkstemp() implementation
Tony Cook [Thu, 4 Aug 2016 04:30:13 +0000 (14:30 +1000)]
(perl #127663) add our own mkstemp() implementation

Needed to generate temp files for safer in-place editing.

Not based on any particular implementation, the BSD implementations
tend to be wrappers around a megafunction that also does a few variations
of mkstemp() and mkdtemp(), which we don't need (yet.)

This might also be useful as a replacement for broken mkstemp()
implementations that use a mode of 0666 when creating the file, though
we'd need to add Configure probing for that.

4 years ago(perl #127663) create a separate random source for internal use
Tony Cook [Wed, 18 May 2016 05:03:14 +0000 (15:03 +1000)]
(perl #127663) create a separate random source for internal use

and use it to initialize hash randomization and to innoculate against
quadratic behaviour in pp_sort

4 years agoAdd epigraphs for 5.24.3-RC1 and 5.26.1-RC1
Steve Hay [Sun, 10 Sep 2017 15:54:31 +0000 (16:54 +0100)]
Add epigraphs for 5.24.3-RC1 and 5.26.1-RC1

4 years ago5.24.3-RC1 and 5.26.1-RC1 today
Steve Hay [Sun, 10 Sep 2017 14:09:34 +0000 (15:09 +0100)]
5.24.3-RC1 and 5.26.1-RC1 today

4 years agoperldelta for 96c83ed78a, 2be4edede4 and 8586647e33
Steve Hay [Sun, 10 Sep 2017 12:18:50 +0000 (13:18 +0100)]
perldelta for 96c83ed78a2be4edede4 and 8586647e33

4 years ago(perl #131665) avoid a buffer overflow in a buffer we didn't need
Tony Cook [Thu, 27 Jul 2017 00:12:02 +0000 (10:12 +1000)]
(perl #131665) avoid a buffer overflow in a buffer we didn't need

since Lookup() treats its argument as NUL or '=' terminated.

Previously environment variable names longer than the size of the
buffer would result in a buffer overflow.

4 years agoPATCH: [perl #131598]
Karl Williamson [Fri, 25 Aug 2017 17:33:58 +0000 (11:33 -0600)]
PATCH: [perl #131598]

The cause of this is that the vFAIL macro uses RExC_parse, and that
variable has just been changed in preparation for code after the vFAIL.
The solution is to not change RExC_parse until after the vFAIL.

This is a case where the macro hides stuff that can bite you.

4 years agoregcomp [perl #131582]
Karl Williamson [Wed, 21 Jun 2017 17:33:37 +0000 (11:33 -0600)]
regcomp [perl #131582]

4 years agoreduce error surface of reginsert, set flags to 0 for inserted node
Yves Orton [Sun, 10 Sep 2017 09:25:18 +0000 (11:25 +0200)]
reduce error surface of reginsert, set flags to 0 for inserted node

this means that callers do not have to worry about resetting the flags,
which reduces the chance of error in using reginsert.

4 years agofix #132017 - OPFAIL insert needs to set flags to 0
Yves Orton [Sun, 10 Sep 2017 08:59:05 +0000 (10:59 +0200)]
fix #132017 - OPFAIL insert needs to set flags to 0

why reginsert doesnt do this stuff I dont know.

4 years agoutil.c: Add comments
Karl Williamson [Sun, 10 Sep 2017 04:36:37 +0000 (22:36 -0600)]
util.c: Add comments

Better describe my_strftime(), and indicate authorship of long comment
that has a bunch of 'I' statements.

4 years agosv.c: Use modern macro names
Karl Williamson [Mon, 28 Aug 2017 19:53:45 +0000 (13:53 -0600)]
sv.c: Use modern macro names

This used older names for some locale functions, that have been
superseded by more meaningful ones.

4 years agoutf8.c: Use mnemonic for repeatedly used number
Karl Williamson [Thu, 10 Aug 2017 21:27:15 +0000 (15:27 -0600)]
utf8.c: Use mnemonic for repeatedly used number

4 years agolocale.c: Add a branch prediction
Karl Williamson [Sat, 22 Jul 2017 21:19:13 +0000 (15:19 -0600)]
locale.c: Add a branch prediction

4 years agohandy.h: White space only
Karl Williamson [Sat, 22 Jul 2017 21:16:38 +0000 (15:16 -0600)]
handy.h: White space only

ALign some things vertically for easier reading

4 years agoutil.c: atos_symbolize: Don't use locale-dependent fcns
Karl Williamson [Sat, 22 Jul 2017 21:09:28 +0000 (15:09 -0600)]
util.c: atos_symbolize: Don't use locale-dependent fcns

It very likely isn't an issue here, but the core should not have
unintentional locale-dependent code .

4 years agolocale.c: Don't be too clever in strlcat
Karl Williamson [Sat, 22 Jul 2017 18:44:16 +0000 (12:44 -0600)]
locale.c: Don't be too clever in strlcat

This code I wrote was attempting to avoid multiple calls to strlen in
constructing the catenation of various components of a string.  It did
this by keeping track of how far it got each iteration, and using that
as a starting point for the next.  I now realize that the return value
of strlcat is as if it succeeds, even if there isn't enough room.  That
means that if there were a problem, this could start out an iteration
such that it would be writing beyond the end of the buffer.  It is safer
to not do this, so this commit removes it.

The use of strlcat is a safety measure, as there should be a sufficient
amount of space calculated for things to fit, so there is no bug here.
But one should be safe.

4 years agolocale.c: Use %z to specify printf format for length
Karl Williamson [Fri, 21 Jul 2017 00:21:13 +0000 (18:21 -0600)]
locale.c: Use %z to specify printf format for length

This is the better way to do this.

4 years agoI18N-Langinfo: Use new fcn Perl_langinfo()
Karl Williamson [Thu, 7 Sep 2017 22:33:09 +0000 (16:33 -0600)]
I18N-Langinfo: Use new fcn Perl_langinfo()

This automatically fixes the bug where it always returned a dot for the
decimal point character.

4 years agoAdd API function Perl_langinfo()
Karl Williamson [Thu, 7 Sep 2017 21:21:56 +0000 (15:21 -0600)]
Add API function Perl_langinfo()

This is designed to generally replace nl_langinfo() in XS code.  It is
thread-safer, hides the quirks of perl's LC_NUMERIC handling, and can be
used on systems lacking nl_langinfo.

4 years agoTeach podcheck about strftime() and localeconv() man pages
Karl Williamson [Thu, 7 Sep 2017 23:17:22 +0000 (17:17 -0600)]
Teach podcheck about strftime() and localeconv() man pages

4 years agoI18N-Langinfo/t/Langinfo.t: Reinstate tests, modernize
Karl Williamson [Thu, 7 Sep 2017 22:25:33 +0000 (16:25 -0600)]
I18N-Langinfo/t/Langinfo.t: Reinstate tests, modernize

The comments say that a bunch of tests were disabled due to the poor
support of nl_langinfo() at the time, 2001.  I haven't seen these issues
lately, and so am reinstating many of the tests, using the modern
Test::More that the rest of the file in the meantime had been updated to
use.  The tests that weren't reinstated were because results for them
may vary by platform.

4 years Add =encoding line
Karl Williamson [Thu, 7 Sep 2017 22:56:15 +0000 (16:56 -0600)] Add =encoding line

This is so can have non-ASCII in perlapi

4 years agosimplify s///eee lexing logic
Lukas Mai [Fri, 8 Sep 2017 09:21:58 +0000 (11:21 +0200)]
simplify s///eee lexing logic

4 years agoUse reentrant functions on Darwin
Karl Williamson [Thu, 7 Sep 2017 16:51:50 +0000 (10:51 -0600)]
Use reentrant functions on Darwin

Darwin does have reentrant functions, like asctime_r, and so enable
their automatic use of all the ones available.  Tony Cook speculated the
failure to use these may be behind some unexplained problems on Darwin.
Netware is still disabled; the commit that did that did not specify why.

It would be good if someone could come with a test that fails (with some
regularity) until this patch is applied.

This supercedes:

commit 4f8ddd771cda27533f4680b572d765b063e03e11
Author: Artur Bergman <>
Date:   Tue Feb 5 10:30:58 2002 +0000

    Enable building with threads under macosx, assume __APPLE__ means darwin and disable _r functions, since we don't have them.

4 years agoperldelta for f8ac814f18bf, 8c573bee8897, f3d6edb2a15d
Tony Cook [Tue, 5 Sep 2017 00:56:47 +0000 (10:56 +1000)]
perldelta for f8ac814f18bf8c573bee8897f3d6edb2a15d

4 years agoAdd unit test t/op/stash_parse_gv.t
Nicolas R [Fri, 1 Sep 2017 19:32:43 +0000 (13:32 -0600)]
Add unit test t/op/stash_parse_gv.t

This test add coverage for long function names
in order to increase test coverage for
S_parse_gv_stash_name function.

4 years agoadd a small buffer to gv_stash_name
Nicolas R [Thu, 27 Apr 2017 17:29:48 +0000 (11:29 -0600)]
add a small buffer to gv_stash_name

4 years agoReduce malloc&free for S_parse_gv_stash_name
Nicolas R [Mon, 31 Oct 2016 15:55:05 +0000 (09:55 -0600)]
Reduce malloc&free for S_parse_gv_stash_name

S_parse_gv_stash_name was using multiple malloc
and free when using ' as package separator.
We can malloc & free only once the tmpbuffer as we know the size max.
This is also sligthly improving iterations when using ::
as we do not need to check if we need to free the tmp buffer.

This is also saving an extra '*gv && *gv != (const GV *)&PL_sv_undef' check.

4 years agothreads.xs: don't Copy() null pointer
David Mitchell [Mon, 4 Sep 2017 08:54:58 +0000 (09:54 +0100)]
threads.xs: don't Copy() null pointer

If a thread is created with no parameters, e.g.

    use threads;
    threads->new(sub {})->join;

Then it tries to Copy() zero parameters to AvARRAY(params), which is null.
Since v5.27.3-31-gf14cf36, this triggers an assert failure, so threaded
builds have been badly broken.

4 years agoStrengthen weak refs when sorting in-place
Dagfinn Ilmari Mannsåker [Wed, 30 Aug 2017 21:35:17 +0000 (22:35 +0100)]
Strengthen weak refs when sorting in-place

It's conceptually an assignment, which should strengthen any weak refs.

Reported-by: Tom Molesworth <>
4 years agoAdd new API function sv_rvunweaken
Dagfinn Ilmari Mannsåker [Wed, 30 Aug 2017 21:33:45 +0000 (22:33 +0100)]
Add new API function sv_rvunweaken

Needed to fix in-place sort of weak references in a future commit.

Stolen from Scalar::Util::unweaken, which will be made to use this
when available via CPAN upstream.

4 years agoperldelta for f14cf3632059
Tony Cook [Mon, 4 Sep 2017 05:07:42 +0000 (15:07 +1000)]
perldelta for f14cf3632059

4 years ago(perl #131746) avoid undefined behaviour in Copy() etc
Tony Cook [Mon, 14 Aug 2017 01:52:39 +0000 (11:52 +1000)]
(perl #131746) avoid undefined behaviour in Copy() etc

These functions depend on C library functions which have undefined
behaviour when passed NULL pointers, even when passed a zero 'n' value.

Some compilers use this information, ie. assume the pointers are
non-NULL when optimizing any following code, so we do need to
prevent such unguarded calls.

My initial thought was to add conditionals to each macro to skip the
call to the library function when n is zero, but this adds a cost to
every use of these macros, even when the n value is always true.

So instead I added asserts() which will give us a much more visible
indicator of such broken code and revealed the pp_caller and Glob.xs
issues also patched here.

4 years agoperldelta for cfbdacd3fe15
Tony Cook [Thu, 31 Aug 2017 04:41:38 +0000 (14:41 +1000)]
perldelta for cfbdacd3fe15

4 years agoadd a stack extend check to pp_entersub for XS subs
Tony Cook [Thu, 31 Aug 2017 04:33:17 +0000 (14:33 +1000)]
add a stack extend check to pp_entersub for XS subs

This allows us to report the XSUB involved by name (or at least by
filename if it's anonymous) in the likely case that it was an XSUB
that failed to extend the stack.