This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agoCoreList: fix release date on v5.24.0
Ricardo Signes [Thu, 5 May 2016 16:10:32 +0000 (12:10 -0400)]
CoreList: fix release date on v5.24.0

7 years agoRC5: bump release date out for v5.24.0 v5.24.0-RC5
Ricardo Signes [Wed, 4 May 2016 12:31:32 +0000 (08:31 -0400)]
RC5: bump release date out for v5.24.0

7 years agocorelist: fix a typo
Ricardo Signes [Tue, 3 May 2016 17:35:27 +0000 (13:35 -0400)]
corelist: fix a typo

7 years agopatchlevel, perlhist: another day, another RC
Ricardo Signes [Tue, 3 May 2016 15:38:36 +0000 (11:38 -0400)]
patchlevel, perlhist: another day, another RC

7 years agoRT #127855] Slowdown in m//g on COW strings
David Mitchell [Mon, 2 May 2016 13:46:49 +0000 (14:46 +0100)]
RT #127855] Slowdown in m//g on COW strings

Better fix for this issue. The previous couple of commits revert an
earlier fix for this, which basically modified SvGROW or a particular
one of its callers to add 1 to the requested length to ensure that there
was space for any future COW reference count (which is stored in  spare
byte off the end of the string if SvCUR + null byte < SvLEN).

It turns out that sv_grow() already does a +1 over-allocation (added by me
with v5.19.0-442-gcbcb2a1), *except* that I made it skip the +1 if the
request size seemed to be a large power of two: with the idea being that
if someone had requested an exact big power of two then they were probably
doing something with buffers, and wouldn't want an 0x10000001 byte buffer
when they requested 0x10000000 bytes.  This was me basically being
conservative. However, I was probably too conservative: the simple test I
added just checked that bottom 8 bits were zero and if so, assumed that it
was a big buffer request. So as a side effect of this over-simple test,
something like 0x13d57f00 wouldn't be incremented to 0x13d57f01.

This is what was discovered in the original report in the the RT ticket:
strings allocated with lengths whose lower 8 bits were zero wouldn't have
space for a COW refcount, so would become much slower on things like

    while $g =~ m/0/g.

This commit improves the test so it only skips the +1 on lengths that
are an exact power of 2 and are greater than  0xfff.

7 years agotest lexical $foo = "$foo"
David Mitchell [Mon, 2 May 2016 12:59:28 +0000 (13:59 +0100)]
test lexical $foo = "$foo"

There were some issues with this and SvGROW().
This only occured under valgrind or similar, and only when the first of
two reverts had been done - those revertd being two preceding commits.

See RT #127855.

7 years agoRevert "fix #127855, in Perl_sv_setpvn() we have to overallocate to enable COW"
David Mitchell [Mon, 2 May 2016 13:02:51 +0000 (14:02 +0100)]
Revert "fix #127855, in Perl_sv_setpvn() we have to overallocate to enable COW"

This reverts commit e19cb11142087974d956f263d24e146b968025d5.

This and the previous commit revert the two commits that were an original
fix for RT #127855, but which is fixed in a different way in a following
commit.  See the ticket for more details.

7 years agoRevert "More generalized fix for #127855"
David Mitchell [Mon, 2 May 2016 08:30:40 +0000 (09:30 +0100)]
Revert "More generalized fix for #127855"

This reverts commit bcc9f606509ad2fad50e16f081103451b7dc49e1.

This and the next commit revert the two commits that were an original fix
for RT #127855, but which is fixed in a different way in a following
commit.  See the ticket for more details.

7 years agoperldelta: update module versions v5.24.0-RC4
Ricardo Signes [Mon, 2 May 2016 14:14:39 +0000 (10:14 -0400)]
perldelta: update module versions

7 years agocorelist: bump version past v5.22.2
Ricardo Signes [Mon, 2 May 2016 13:41:35 +0000 (09:41 -0400)]
corelist: bump version past v5.22.2

7 years agoprepare v5.24.0-RC4
Ricardo Signes [Mon, 2 May 2016 12:06:05 +0000 (08:06 -0400)]
prepare v5.24.0-RC4

7 years agoMaintainers.pl: bump versions for threads dists
jdhedden [Sat, 30 Apr 2016 21:25:44 +0000 (17:25 -0400)]
Maintainers.pl: bump versions for threads dists

7 years agoperllol: remove docs about the removed autoderef feature
reneeb [Wed, 27 Apr 2016 14:00:02 +0000 (16:00 +0200)]
perllol: remove docs about the removed autoderef feature

7 years agocorelist: updated for threads libraries
Ricardo Signes [Sat, 30 Apr 2016 18:32:31 +0000 (14:32 -0400)]
corelist: updated for threads libraries

7 years agoThread-Queue: bump version (again) because content changed
Ricardo Signes [Sat, 30 Apr 2016 18:53:22 +0000 (14:53 -0400)]
Thread-Queue: bump version (again) because content changed

7 years agothreads: bump version (again) because content changed
Ricardo Signes [Sat, 30 Apr 2016 18:52:02 +0000 (14:52 -0400)]
threads: bump version (again) because content changed

7 years agoUpgrade to Thread::Queue 3.08
jdhedden [Fri, 22 Apr 2016 20:13:10 +0000 (16:13 -0400)]
Upgrade to Thread::Queue 3.08

7 years agoUpgrade to threads::shared 1.51
jdhedden [Fri, 22 Apr 2016 23:23:01 +0000 (19:23 -0400)]
Upgrade to threads::shared 1.51

7 years agoUpgrade to threads 2.06
jdhedden [Fri, 22 Apr 2016 18:28:09 +0000 (14:28 -0400)]
Upgrade to threads 2.06

7 years agocorelist: updated for File::Copy doc updates
Ricardo Signes [Sat, 30 Apr 2016 18:26:42 +0000 (14:26 -0400)]
corelist: updated for File::Copy doc updates

7 years agoAdd cross-reference to perldata in scalar's documentation origin/dom/doc-fixes
Dominic Hargreaves [Sat, 30 Apr 2016 18:01:19 +0000 (19:01 +0100)]
Add cross-reference to perldata in scalar's documentation

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=810156

7 years agoperlrun: note the existence of find's -delete switch
Dominic Hargreaves [Sat, 30 Apr 2016 17:58:06 +0000 (18:58 +0100)]
perlrun: note the existence of find's -delete switch

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776614

7 years agoBump $File::Copy::VERSION
Dominic Hargreaves [Sat, 30 Apr 2016 17:53:13 +0000 (18:53 +0100)]
Bump $File::Copy::VERSION

7 years agoFile::Copy: add a warning about flushing writes
Dominic Hargreaves [Sat, 30 Apr 2016 17:03:01 +0000 (18:03 +0100)]
File::Copy: add a warning about flushing writes

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=494590

7 years agoperl.pod: @INC is being displayed as intended
Dominic Hargreaves [Sat, 30 Apr 2016 16:49:04 +0000 (17:49 +0100)]
perl.pod: @INC is being displayed as intended

The previous presentation looked a bit like an incomplete placeholder
expansion.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=246542

7 years agoTick off 5.22.2
Steve Hay [Fri, 29 Apr 2016 23:09:15 +0000 (00:09 +0100)]
Tick off 5.22.2

7 years ago5.22.2 today
Steve Hay [Fri, 29 Apr 2016 23:07:42 +0000 (00:07 +0100)]
5.22.2 today

(Manually cherry picked from commit 72ccbefa77099a0bf1b7c2cb9f29685ed7d9938d)

7 years agoImport 5.22.2's perldelta
Steve Hay [Fri, 29 Apr 2016 23:05:46 +0000 (00:05 +0100)]
Import 5.22.2's perldelta

7 years agoImport 5.22.2's Module::CoreList data
Steve Hay [Fri, 29 Apr 2016 23:02:05 +0000 (00:02 +0100)]
Import 5.22.2's Module::CoreList data

7 years agotrivial s/or/of/ doc patch
Jim Cromie [Wed, 27 Apr 2016 12:22:22 +0000 (06:22 -0600)]
trivial s/or/of/ doc patch

7 years agoperlpolicy: add Sawyer X to list moderators
Ricardo Signes [Thu, 28 Apr 2016 20:56:06 +0000 (16:56 -0400)]
perlpolicy: add Sawyer X to list moderators

8 years agobump version to v5.24.0-RC3 v5.24.0-RC3
Ricardo Signes [Tue, 26 Apr 2016 22:10:34 +0000 (18:10 -0400)]
bump version to v5.24.0-RC3

8 years agocorelist: silence deep recursion warning with %version
Niko Tyni [Tue, 26 Apr 2016 21:34:51 +0000 (17:34 -0400)]
corelist: silence deep recursion warning with %version

8 years agoRemove some data detritus from CoreList
Aristotle Pagaltzis [Tue, 26 Apr 2016 21:32:43 +0000 (17:32 -0400)]
Remove some data detritus from CoreList

8 years agoDocument exports policy within POSIX
Aristotle Pagaltzis [Tue, 26 Apr 2016 09:53:54 +0000 (11:53 +0200)]
Document exports policy within POSIX

8 years agoCorrect lround situation comment in POSIX
Aristotle Pagaltzis [Tue, 26 Apr 2016 09:53:21 +0000 (11:53 +0200)]
Correct lround situation comment in POSIX

8 years agobump perl version to v5.24.0-RC2 v5.24.0-RC2
Ricardo Signes [Sat, 23 Apr 2016 17:51:26 +0000 (18:51 +0100)]
bump perl version to v5.24.0-RC2

8 years agocorelist: update Time::HiRes for v5.24.0
Ricardo Signes [Sat, 23 Apr 2016 17:38:01 +0000 (18:38 +0100)]
corelist: update Time::HiRes for v5.24.0

8 years agoSynchronize with CPAN Time-HiRes 1.9733
Jarkko Hietaniemi [Sat, 23 Apr 2016 16:21:41 +0000 (12:21 -0400)]
Synchronize with CPAN Time-HiRes 1.9733

8 years agolib/perl5db.pl: Fix pod error.
Karl Williamson [Sat, 23 Apr 2016 15:47:41 +0000 (09:47 -0600)]
lib/perl5db.pl: Fix pod error.

8 years agoApple Xcode / clang version updates and additions
Jarkko Hietaniemi [Sat, 23 Apr 2016 15:23:44 +0000 (11:23 -0400)]
Apple Xcode / clang version updates and additions

8 years agodarwin (OS X) hints comments alignment
Jarkko Hietaniemi [Sat, 23 Apr 2016 15:20:56 +0000 (11:20 -0400)]
darwin (OS X) hints comments alignment

(preparing for the next change)

8 years agoTime-HiRes version bump
Jarkko Hietaniemi [Sat, 23 Apr 2016 03:09:31 +0000 (23:09 -0400)]
Time-HiRes version bump

8 years ago[PATCH] Time-Hires: Fix declaration-after-statement error with darwin threads
Reini Urban [Mon, 18 Apr 2016 07:38:13 +0000 (09:38 +0200)]
[PATCH] Time-Hires: Fix declaration-after-statement error with darwin threads

rt #113856: the flag -Werror=declaration-after-statement is seemingly
not working for clang (in OS X, not yet tested elsewhere), but working
as intended for gcc.  Since the system cc for OS X is clang (via Apple),
this failure to fail has been masked.

To restate: without this patch the Time-HiRes does not build in OS X
with gcc under usethreads.

8 years agoRegenerate Configure and related parts after backports
Aaron Crane [Sat, 23 Apr 2016 11:17:59 +0000 (12:17 +0100)]
Regenerate Configure and related parts after backports

perl5.git is now in sync with metaconfig.git commit
7c34fa4e8142642c6e2978f0307e925898465f58

8 years agoBring Configure back into sync again with meta
H.Merijn Brand [Fri, 22 Apr 2016 07:57:01 +0000 (09:57 +0200)]
Bring Configure back into sync again with meta

Work done at the QAH in Rugby.
Multi-thanks to Aaron for helping out here. You're doing a great job!

8 years agoAllow Encode to be built on static perls
Leon Timmermans [Fri, 25 Mar 2016 17:01:48 +0000 (18:01 +0100)]
Allow Encode to be built on static perls

Previously there were build failures because cp1252 was defined both
in the default set of encodings an in the byte set.

8 years agoRevert "document that sigs in future may not populate @_"
Ricardo Signes [Sat, 23 Apr 2016 10:50:24 +0000 (11:50 +0100)]
Revert "document that sigs in future may not populate @_"

This reverts commit 19d6c3854e96d89bf4dc2d874df433beac27ee8b.

8 years agoFix some pod errors
Karl Williamson [Fri, 22 Apr 2016 19:00:22 +0000 (13:00 -0600)]
Fix some pod errors

These were discovered while testing the Pod::Checker that is intended to
be used in 5.25.

8 years ago[perl #127936] fix typo
Tony Cook [Wed, 20 Apr 2016 00:49:23 +0000 (10:49 +1000)]
[perl #127936] fix typo

8 years agoperldelta for ab462c7d2d
Tony Cook [Wed, 20 Apr 2016 00:39:00 +0000 (10:39 +1000)]
perldelta for ab462c7d2d

8 years ago[perl #127894] ensure alignbytes is correct for -Dusequadmath
Dagfinn Ilmari Mannsåker [Wed, 20 Apr 2016 00:15:23 +0000 (10:15 +1000)]
[perl #127894] ensure alignbytes is correct for -Dusequadmath

8 years agoCorrect typo in JJORE's name in todo.pod.
Matthew Horsfall [Tue, 19 Apr 2016 20:58:44 +0000 (16:58 -0400)]
Correct typo in JJORE's name in todo.pod.

8 years agoAvoid passing non-literal to format function
Aaron Crane [Thu, 14 Apr 2016 10:23:12 +0000 (11:23 +0100)]
Avoid passing non-literal to format function

This avoids the following error, reported by Jitka Plesníková
<jplesnik@redhat.com> in a test of RC1:

op.c: In function 'Perl_ck_ftst':
op.c:9754:58: error: format not a string literal and no format arguments [-Werror=format-security]
                 Perl_warner(aTHX_ packWARN(WARN_SYNTAX), array_passed_to_stat);

In addition, the string in question is now made const.

8 years agodocument that sigs in future may not populate @_
David Mitchell [Tue, 19 Apr 2016 11:57:50 +0000 (12:57 +0100)]
document that sigs in future may not populate @_

Give people a heads up that in the next major perl release, subroutine
signatures may no longer populate @_ by default.

See http://nntp.perl.org/group/perl.perl5.porters/235332.

8 years agoperldelta: Remove error/warning explanations
Karl Williamson [Tue, 19 Apr 2016 00:06:52 +0000 (18:06 -0600)]
perldelta: Remove error/warning explanations

Only the text of these should be present in a delta, with a link to the
full explanation.  Most of perldelta conformed to this, but not all.

8 years agoperldelta: Add some C<>
Karl Williamson [Tue, 19 Apr 2016 00:06:31 +0000 (18:06 -0600)]
perldelta: Add some C<>

8 years agoperldelta: Clarifications, corrections, wordsmithing
Karl Williamson [Tue, 19 Apr 2016 00:04:03 +0000 (18:04 -0600)]
perldelta: Clarifications, corrections, wordsmithing

I also removed one instance of a 5.23-only bug, which isn't relevant to
a dot zero delta

8 years agoAdd perldelta for d9fc04ee
Leon Timmermans [Mon, 18 Apr 2016 23:04:49 +0000 (01:04 +0200)]
Add perldelta for d9fc04ee

8 years agoperldelta: IO-Compress is a dist, no link possible
Ricardo Signes [Mon, 18 Apr 2016 22:59:06 +0000 (18:59 -0400)]
perldelta: IO-Compress is a dist, no link possible

8 years agoperldelta: generate the module update section
Ricardo Signes [Mon, 18 Apr 2016 21:59:03 +0000 (17:59 -0400)]
perldelta: generate the module update section

8 years agoperldelta: various fixes
Matthew Horsfall [Mon, 18 Apr 2016 21:41:53 +0000 (17:41 -0400)]
perldelta: various fixes

 * behaviour -> behavior
 * =over -> =over 4
 * Add =items for consistency
 * Capitalization fixes

8 years agoperldelta: Fix typo
Matthew Horsfall [Mon, 18 Apr 2016 21:22:27 +0000 (17:22 -0400)]
perldelta: Fix typo

8 years agoperldelta: Revise wording
Karl Williamson [Mon, 18 Apr 2016 17:18:41 +0000 (11:18 -0600)]
perldelta: Revise wording

Some of this was suggested by Jarkko Hietaniemi

8 years agoperldelta: Remove typo extra '/'
Karl Williamson [Thu, 14 Apr 2016 16:46:42 +0000 (10:46 -0600)]
perldelta: Remove typo extra '/'

This fixes the 5.24 part of [perl #127899].

8 years agoperldelta: minor tweak to fix awkward prose
Ricardo Signes [Thu, 14 Apr 2016 11:47:54 +0000 (07:47 -0400)]
perldelta: minor tweak to fix awkward prose

(Thanks, Ed Avis!)

8 years agopatchlevel: we are now RC1 v5.24.0-RC1
Ricardo Signes [Thu, 14 Apr 2016 02:16:10 +0000 (22:16 -0400)]
patchlevel: we are now RC1

8 years agoremove the v5.23.x perldeltas
Ricardo Signes [Thu, 14 Apr 2016 02:02:23 +0000 (22:02 -0400)]
remove the v5.23.x perldeltas

8 years agoperlpolicy: update the supported versions for v5.24 on
Ricardo Signes [Thu, 14 Apr 2016 01:59:39 +0000 (21:59 -0400)]
perlpolicy: update the supported versions for v5.24 on

8 years agoperlhist: add v5.24.0 data
Ricardo Signes [Thu, 14 Apr 2016 01:54:27 +0000 (21:54 -0400)]
perlhist: add v5.24.0 data

8 years agocorelist: set a (tentative) release date for 5.24.0
Ricardo Signes [Thu, 14 Apr 2016 01:46:28 +0000 (21:46 -0400)]
corelist: set a (tentative) release date for 5.24.0

8 years agofix IO::Handle documentation mangled by a manually applied patch
Tony Cook [Tue, 12 Apr 2016 23:39:27 +0000 (09:39 +1000)]
fix IO::Handle documentation mangled by a manually applied patch

8 years agoperllocale: Unicode has changed their data; fix references
Karl Williamson [Tue, 12 Apr 2016 19:50:12 +0000 (13:50 -0600)]
perllocale: Unicode has changed their data; fix references

We say something here that is no longer true; update it.

8 years agoperldelta: Some minor fixes.
Karl Williamson [Tue, 12 Apr 2016 19:37:21 +0000 (13:37 -0600)]
perldelta: Some minor fixes.

This includes deleting some bug fixes for things introduced in the 5.23
series, and so not relevant to a dot zero perldelta

8 years agopod/perldelta: Fixes to pedantic failures
Karl Williamson [Tue, 12 Apr 2016 19:13:56 +0000 (13:13 -0600)]
pod/perldelta: Fixes to pedantic failures

8 years agoperldelta: Add note about recent doc change
Karl Williamson [Tue, 12 Apr 2016 18:55:21 +0000 (12:55 -0600)]
perldelta: Add note about recent doc change

8 years agoMerge branch 'release-5.24' into blead
Ricardo Signes [Mon, 11 Apr 2016 00:49:39 +0000 (20:49 -0400)]
Merge branch 'release-5.24' into blead

This commit is just prep, turning blead into the branch from which
v5.24.0 will be released, after suitable testing.

8 years agoCoreList: update for v5.24.0
Ricardo Signes [Thu, 7 Apr 2016 13:33:41 +0000 (09:33 -0400)]
CoreList: update for v5.24.0

8 years agofix versions of generated perldelta
Ricardo Signes [Thu, 7 Apr 2016 12:47:52 +0000 (08:47 -0400)]
fix versions of generated perldelta

8 years agoput perl5240delta into place
Ricardo Signes [Thu, 7 Apr 2016 12:39:20 +0000 (08:39 -0400)]
put perl5240delta into place

8 years agoregen META.json for v5.24.0-RC
Ricardo Signes [Thu, 7 Apr 2016 12:37:06 +0000 (08:37 -0400)]
regen META.json for v5.24.0-RC

8 years agoregen: B::Op_private and uconfig.h
Ricardo Signes [Thu, 7 Apr 2016 12:28:18 +0000 (08:28 -0400)]
regen: B::Op_private and uconfig.h

8 years agoversion bump: this is now v5.24.0-RC0!
Ricardo Signes [Thu, 7 Apr 2016 12:27:26 +0000 (08:27 -0400)]
version bump: this is now v5.24.0-RC0!

8 years agoperldelta: merge in perl5239delta
Ricardo Signes [Thu, 7 Apr 2016 12:20:49 +0000 (08:20 -0400)]
perldelta: merge in perl5239delta

8 years agoperldelta: remove unneeded entries, do more merge and sort
Ricardo Signes [Mon, 14 Mar 2016 00:17:10 +0000 (20:17 -0400)]
perldelta: remove unneeded entries, do more merge and sort

8 years agoperldelta: merge in changes from perl5238delta
Ricardo Signes [Sun, 13 Mar 2016 23:22:56 +0000 (19:22 -0400)]
perldelta: merge in changes from perl5238delta

8 years agoperldelta: merge in changes from perl5237delta
Ricardo Signes [Sun, 13 Mar 2016 22:36:39 +0000 (18:36 -0400)]
perldelta: merge in changes from perl5237delta

8 years agoperldelta: merge in changes from perl5236delta
Ricardo Signes [Sun, 13 Mar 2016 22:27:34 +0000 (18:27 -0400)]
perldelta: merge in changes from perl5236delta

8 years agoperldelta: merge in changes from perl5235delta
Ricardo Signes [Fri, 11 Mar 2016 01:03:27 +0000 (20:03 -0500)]
perldelta: merge in changes from perl5235delta

8 years agoperldelta: merge in changes from perl5234delta
Ricardo Signes [Fri, 11 Mar 2016 00:50:06 +0000 (19:50 -0500)]
perldelta: merge in changes from perl5234delta

8 years agoperldelta: merge in changes from perl5233delta
Ricardo Signes [Fri, 11 Mar 2016 00:30:11 +0000 (19:30 -0500)]
perldelta: merge in changes from perl5233delta

8 years agoperldelta: merge in changes from perl5232delta
Ricardo Signes [Fri, 11 Mar 2016 00:24:33 +0000 (19:24 -0500)]
perldelta: merge in changes from perl5232delta

8 years agoperldelta: merge in changes from perl5231delta
Ricardo Signes [Fri, 11 Mar 2016 00:19:43 +0000 (19:19 -0500)]
perldelta: merge in changes from perl5231delta

8 years agoperldelta: bootstrap perl5240delta with perl5230delta
Ricardo Signes [Fri, 11 Mar 2016 00:12:50 +0000 (19:12 -0500)]
perldelta: bootstrap perl5240delta with perl5230delta

8 years agoAdd 5.22.2-RC1 epigraph
Steve Hay [Sun, 10 Apr 2016 17:44:59 +0000 (18:44 +0100)]
Add 5.22.2-RC1 epigraph

8 years ago5.22.2-RC1 today
Steve Hay [Sun, 10 Apr 2016 13:11:23 +0000 (14:11 +0100)]
5.22.2-RC1 today

8 years agoPATCH: [perl #127708] segfault in "$!" in threads
Karl Williamson [Sat, 9 Apr 2016 17:55:58 +0000 (11:55 -0600)]
PATCH: [perl #127708] segfault in "$!" in threads

This was showing up on Darwin because its setlocale is particularly not
thread safe.  But the problem is more generic.  Using locales just
isn't a good idea in a threaded application, as locales are
process-wide, not thread-specific.  Calling setlocale() changes the
locale of all threads at the same time.  Further the return of
setlocale() is a pointer to internal storage.  If you call setlocale()
just to learn what it currently is without actually changing the locale,
there is no guarantee that another thread won't interrupt your thread,
switching the locale to something else before you've had a chance to
copy it somewhere else for safekeeping, and the internal storage may
have been freed during that interruption, leading to things like
segfaults.

This is a problem that has been around in the locale handling code for a
long time.  I don't know why it hasn't shown up before, or maybe it has
and is not reproducible because it's timing dependent, and so any
problems didn't have tickets written for them, or were rejected as not
reproducible.

But the problem has been made worse in recent releases.  Only fairly
recently has perl changed so this problem can occur in programs that
don't use locale explicitly: ones that don't 'use locale' nor call
setlocale().  This ticket is for such a program that gets a
locale-related segfault, without ever touching locales itself.

I have done an audit of the perl source, looking for all such
occurrences, and this patch fixes all of them that I found.  The only
other ones, besides "$!", is in converting to/from UTF-8 in cygwin.c.
In all such cases, perl briefly switches the locale, does an operation,
then switches back.  The solution here is to add mutexes to make these
areas of code uninterruptible critical sections, so that they can rely
on having the locale be what they expect it to be during the entirety of
the operation, and can't have a setlocale() from another thread free
internal storage.  But this is not a general solution.  A thread
executing these sections can interrupt some other thread doing a
setlocale() and zap that.  However, we have long cautioned against doing
setlocales() in a thread, and that caution was strengthened in a commit
made yesterday, fc82b82ef4784a38877f35f56ee16f14934460ce.

The current commit should make safe all threaded programs that don't use
locales explicitly.

It's too close to the 5.24 release to do the rearchitecting required for
a general solution.  That would involve adding more critical sections.

POSIX 2008 introduced new locale handling functions that are
thread-safe, and affect only a single thread, and don't require mutexes.
The ultimate solution would be to use those tools where available, and
to hide from the outer code which set is being used.  Thus, perl would
be thread-safe on such platforms, while remaining problematic on older
ones, though fixed so segfaults wouldn't occur.  Tony Cook believes we
could emulate the newer behavior on all platforms at a significant
performance penalty.  I think this would require a lot of code, and
suspect there would be glitches in it for XS code.  But he may have
some ideas about how to do it simply.  In any case, this has to wait
until post 5.24.

Three other notes:

It seems to me that the cygwin code could be replaced by equivalent code
that doesn't use locales at all.  The comments in the source seem to
even indicate that.  I'll look into doing this in 5.25.

Another possible reason that this hasn't shown up in earlier perls is
that the problems may have been entirely affecting I/O operations and
there are already mutexes involving I/O, and so those could be
inadvertently protecting from, or at least minimizing, the problems
found here.  I haven't investigated to verify this.

This commit doesn't add a test.  I am asking on p5p for assistance in
writing one

8 years agoAdd locale mutex
Karl Williamson [Thu, 7 Apr 2016 03:46:28 +0000 (21:46 -0600)]
Add locale mutex

This adds a new mutex for use in the next commit for use with locale
handling.

8 years agomove perf test from re/pat.t to re/speed.t
David Mitchell [Sat, 9 Apr 2016 15:43:20 +0000 (16:43 +0100)]
move perf test from re/pat.t to re/speed.t

These days we generally put re tests which rely on timing in a separate
file, t/re/speed.t; move a recently-added test there.

8 years agonew perf test in pat.t: avoid timing failure
David Mitchell [Sat, 9 Apr 2016 12:17:21 +0000 (13:17 +0100)]
new perf test in pat.t: avoid timing failure

A new performance test in re/pat.t added by v5.23.9-58-gd14d585 could
occasionally fails to a timing issue. It was checking that the the
test took less than 1 sec to run; but since the clock usually has a
granularity of 1 sec, it could fail if the test ran over a tick boundary.

Change the condition to <= 1 sec, and increase the time the test takes on
a bad perl - it was taking 4sec on my system; it now takes about 14sec,
so there's less chance of a bad perl passing.