platform/upstream/perl.git
13 years agoUpgrade Memoize from version 1.01_03 to 1.02
Florian Ragwitz [Mon, 29 Nov 2010 17:43:06 +0000 (18:43 +0100)]
Upgrade Memoize from version 1.01_03 to 1.02

13 years agoAdd a verbose option to -DP, and replace C<#if 0> blocks in sv_gets() with it.
Nicholas Clark [Mon, 29 Nov 2010 15:17:54 +0000 (15:17 +0000)]
Add a verbose option to -DP, and replace C<#if 0> blocks in sv_gets() with it.

13 years agoIn Perl_sv_gets(), shortbuffered is always 0 when rslen is 0.
Nicholas Clark [Mon, 29 Nov 2010 14:13:03 +0000 (14:13 +0000)]
In Perl_sv_gets(), shortbuffered is always 0 when rslen is 0.

Hence we can jump past the test C<if (shortbuffered)> after the "this screams
louder" block, as that is only reached where rslen is 0.

13 years agoperldelta entry for [perl #63540]
Father Chrysostomos [Mon, 29 Nov 2010 14:09:37 +0000 (06:09 -0800)]
perldelta entry for [perl #63540]

13 years ago[perl #63540] bizarre closure lossage
Father Chrysostomos [Mon, 29 Nov 2010 14:05:35 +0000 (06:05 -0800)]
[perl #63540] bizarre closure lossage

main::b in this example shows a null op that has the if() statement
attached to it.

$ perl -MO=Concise,a,b -e 'my $x;sub a {$x}; sub b{if($x){}0}'
main::a:
3  <1> leavesub[1 ref] K/REFC,1 ->(end)
-     <@> lineseq KP ->3
1        <;> nextstate(main 2 -e:1) v ->2
2        <0> padsv[$x:FAKE:] ->3
main::b:
a  <1> leavesub[1 ref] K/REFC,1 ->(end)
-     <@> lineseq KP ->a
4        <;> nextstate(main 5 -e:1) v ->5
-        <1> null vK/1 ->8
6           <|> and(other->7) vK/1 ->8
5              <0> padsv[$x:FAKE:] s ->6
-              <@> scope vK ->-
7                 <0> stub v ->8
8        <;> nextstate(main 5 -e:1) v ->9
9        <$> const[IV 0] s ->a
-e syntax OK

Perl_op_const_sv has:

    if (type == OP_NEXTSTATE || type == OP_NULL || type == OP_PUSHMARK)
continue;

It traverses from the null to the const. The const’s op_next pointer
points to the leavesub, so it is taken to be a constant.

It returns to newATTRSUB, which turns on CvCONST without assigning a
constant value.

Later, cv_clone (called by pp_anoncode) calls op_const_sv again. The
latter returns the SV from the first PADSV it finds, which is the $x
in if($x).

This commit stops op_const_sv from skipping over null ops that
have children.

13 years agoBreak out code from Perl_sv_gets() which is self contained and exits directly.
Nicholas Clark [Mon, 29 Nov 2010 11:41:21 +0000 (11:41 +0000)]
Break out code from Perl_sv_gets() which is self contained and exits directly.

Previously the code for handling fixed length records, and appending from a
non-UTF-8 handle to a UTF-8 scalar, was handled in two blocks in Perl_sv_gets()
which exited via a goto to the last statement of Perl_sv_gets(). By breaking
them out into separate static functions, the control flow becomes clearer.

13 years agoFix C++ build problems introduced in 9a5a5549
Tony Cook [Mon, 29 Nov 2010 11:36:35 +0000 (22:36 +1100)]
Fix C++ build problems introduced in 9a5a5549

Fixes the following compilation errors:
regexec.c: In function 'char* S_find_byclass(regexp*, const regnode*, char*,
const char*, regmatch_info*)':
regexec.c:1525: error: invalid conversion from 'I32 (*)(const char*, const
char*, I32)' to 'I32 (*)()'
regexec.c:1525: error: too many arguments to function
regexec.c:1527: error: invalid conversion from 'I32 (*)(const char*, const
char*, I32)' to 'I32 (*)()'
regexec.c:1527: error: too many arguments to function

13 years agodocument why eintr.t needs to be skipped on Win32
David Mitchell [Mon, 29 Nov 2010 11:23:28 +0000 (11:23 +0000)]
document why eintr.t needs to be skipped on Win32

13 years agoin perlipc, 'named pipes' was in signals section
David Mitchell [Mon, 29 Nov 2010 10:36:19 +0000 (10:36 +0000)]
in perlipc, 'named pipes' was in signals section

Move the '=head1 Named Pipes' section down so that it's no longer nested,
cuckoo-like, in the middle of the '=head1 Signals' section.

13 years agoperldelta: The last few commits are not noteworthy
Father Chrysostomos [Sun, 28 Nov 2010 22:10:44 +0000 (14:10 -0800)]
perldelta: The last few commits are not noteworthy

except for one that already has an entry.

13 years agoperldelta for 94a75ecf
Father Chrysostomos [Sun, 28 Nov 2010 22:01:21 +0000 (14:01 -0800)]
perldelta for 94a75ecf

13 years ago[perl #79914] documentation bug in perldoc perlvar $|
Lukas Mai [Mon, 29 Nov 2010 05:56:44 +0000 (21:56 -0800)]
[perl #79914] documentation bug in perldoc perlvar $|

13 years agoAUTHORS: e-mail addr for Lukas Mai
Father Chrysostomos [Mon, 29 Nov 2010 05:56:37 +0000 (21:56 -0800)]
AUTHORS: e-mail addr for Lukas Mai

13 years agoMake vms/writemain.pl go the way of writemain.SH.
Craig A. Berry [Sun, 28 Nov 2010 22:49:23 +0000 (16:49 -0600)]
Make vms/writemain.pl go the way of writemain.SH.

Follow-up to fbcaf61123069fe46010699dd41ca5f60f448361 at Nicholas's
suggestion.

13 years agoCorrect a copy&pasto - := is now an error, and no longer a warning.
Nicholas Clark [Sun, 28 Nov 2010 21:45:22 +0000 (21:45 +0000)]
Correct a copy&pasto - := is now an error, and no longer a warning.

13 years agoperldelta for d54f8cf785
Father Chrysostomos [Sun, 28 Nov 2010 20:43:03 +0000 (12:43 -0800)]
perldelta for d54f8cf785

13 years agoMake my $pi := 4; a syntax error.
Nicholas Clark [Fri, 26 Nov 2010 15:53:56 +0000 (15:53 +0000)]
Make my $pi := 4; a syntax error.

Previously it interpreted := as an empty attribute list, and issued a
deprecation warning. This change permits := to be used as a binding operator.

13 years agoperldelta for 75f5d3312
Father Chrysostomos [Sun, 28 Nov 2010 19:05:29 +0000 (11:05 -0800)]
perldelta for 75f5d3312

13 years agoperlfaq5: How do I make a temporary file name?
brian d foy [Sun, 28 Nov 2010 19:35:43 +0000 (13:35 -0600)]
perlfaq5: How do I make a temporary file name?

     Fixed up a half-completed change from typeglobs to lexical
     filehandles.

13 years agoRemove makeaperl, never used, a wrapper for ExtUtils::MakeMaker::makeaperl
Nicholas Clark [Sun, 28 Nov 2010 19:03:21 +0000 (19:03 +0000)]
Remove makeaperl, never used, a wrapper for ExtUtils::MakeMaker::makeaperl

makeaperl was added in perl5.000k, wrapped as makeaperl.SH in perl5.000l, but
neither used in the core build nor installed. All it does is acts as a
command-line wrapper to makeaperl() in ExtUtils::MakeMaker.

13 years ago++substr $re::VERSION, -1
Father Chrysostomos [Sun, 28 Nov 2010 18:54:49 +0000 (10:54 -0800)]
++substr $re::VERSION, -1

13 years agoTiny pod fix
Andreas J. Koenig [Sun, 28 Nov 2010 18:53:39 +0000 (10:53 -0800)]
Tiny pod fix

13 years agoperldelta up to 8e747b69
Father Chrysostomos [Sun, 28 Nov 2010 18:48:45 +0000 (10:48 -0800)]
perldelta up to 8e747b69

13 years agodisable t/io/eintr.t on windows
David Mitchell [Sun, 28 Nov 2010 18:33:51 +0000 (18:33 +0000)]
disable t/io/eintr.t on windows

Apperently it's causing smokers to hang, so skip until
I find out what's happening.

13 years agoGenerate perlmain.c using ExtUtils::Miniperl, instead of writemain.SH.
Nicholas Clark [Sun, 28 Nov 2010 17:15:58 +0000 (17:15 +0000)]
Generate perlmain.c using ExtUtils::Miniperl, instead of writemain.SH.

This allows writemain.SH to be removed. This also has the side effect of testing
that ExtUtils::Miniperl actually works. :-)

13 years agoSkip eintr.t on VMS.
Craig A. Berry [Sun, 28 Nov 2010 15:59:25 +0000 (09:59 -0600)]
Skip eintr.t on VMS.

It's doing select() on a pipe, but only sockets work with select(),
and the read() on a pipe is not interruptible by an alarm.  That's
probably because our pipe implementation is doing mailbox reads at
AST level but the alarm signal is also an AST and can't interrupt
another AST at the same mode.

13 years agoProper Makefile dependencies for the x2p/s2p rule.
Nicholas Clark [Sun, 28 Nov 2010 15:52:58 +0000 (15:52 +0000)]
Proper Makefile dependencies for the x2p/s2p rule.

Without this, a parallel make for a static build can fail, as x2p/Makefile
uses ../perl for a static build, but there was no rule to ensure that ../perl
was built.

A static build currently still fails some tests, I think because Encode doesn't
link all encodings staticly.

13 years agoRevert "Configure has a path to less and perl5db.pl can use it"
Rafael Garcia-Suarez [Sun, 28 Nov 2010 14:01:24 +0000 (15:01 +0100)]
Revert "Configure has a path to less and perl5db.pl can use it"

This reverts commit bf320d637919b3a2a72298748aa76e686e9b3e45.
Andy Dougherty points out that after Configure has run, the "less"
config variable is no longer useful, as described in Porting/Glossary.

13 years agoreg_fold.t: Add tests for simple Latin1 folds
Karl Williamson [Sun, 28 Nov 2010 05:14:05 +0000 (22:14 -0700)]
reg_fold.t: Add tests for simple Latin1 folds

fold_grind.t does a comprehensive series of tests, but it doesn't test
most characters, just a representative sample.  Add tests to reg_fold.t
to verify that the basic mapping tables work.

13 years agoreg_fold.t: Disable single char fold testing
Karl Williamson [Sun, 28 Nov 2010 05:12:13 +0000 (22:12 -0700)]
reg_fold.t: Disable single char fold testing

This is now more comprehensively done by fold_grind.t

13 years agofold_grind.t: Enable EXACTish tests
Karl Williamson [Sun, 28 Nov 2010 05:10:35 +0000 (22:10 -0700)]
fold_grind.t: Enable EXACTish tests

13 years agotest.pl: Add native to uni ord fcns
Karl Williamson [Sun, 28 Nov 2010 05:08:57 +0000 (22:08 -0700)]
test.pl: Add native to uni ord fcns

13 years agoregcomp.c: Handle EXACTFU nodes in optimizer
Karl Williamson [Sun, 28 Nov 2010 04:16:51 +0000 (21:16 -0700)]
regcomp.c: Handle EXACTFU nodes in optimizer

This patch also changes the optimizer to include the other member of a
fold pair in the bitmap.  Thus if 'b' is set under /i, so will 'B', and
vice versa.

13 years agoregcomp.c: Use hex instead of octal for debug ords
Karl Williamson [Sun, 28 Nov 2010 03:51:54 +0000 (20:51 -0700)]
regcomp.c: Use hex instead of octal for debug ords

The ordinals that are output in the debugging output have been in octal,
which is ok for the low controls, but for above Latin1, the standard is
hex, so this changes them all to correspond.  If desired the low
controls could be changed back to be in octal.

13 years agoFix debug output
Karl Williamson [Sun, 28 Nov 2010 03:49:49 +0000 (20:49 -0700)]
Fix debug output

The 'outside bitmap' message isn't orthogonal to the others, it is
independent.

13 years agoregcomp.c: Typo in comment
Karl Williamson [Sun, 28 Nov 2010 03:45:33 +0000 (20:45 -0700)]
regcomp.c: Typo in comment

13 years agoregcomp.c: Generate EXACTFU nodes
Karl Williamson [Sun, 28 Nov 2010 03:37:05 +0000 (20:37 -0700)]
regcomp.c: Generate EXACTFU nodes

13 years agoregcomp.c: remove unnecessary tests
Karl Williamson [Sun, 28 Nov 2010 02:40:58 +0000 (19:40 -0700)]
regcomp.c: remove unnecessary tests

The tests in the else are unnecessary as they comprise everything else
but what the 'if' says.

13 years agoregexec.c: Add handling for EXACTFU nodes
Karl Williamson [Sat, 27 Nov 2010 22:26:31 +0000 (15:26 -0700)]
regexec.c: Add handling for EXACTFU nodes

A later commit will cause these nodes to be generated.

This commit changes how to find the handling of the various nodes to
switch statements, hopefully for efficiency.

13 years agoregexec.c: pull array lookup out of loop
Karl Williamson [Sat, 27 Nov 2010 22:19:31 +0000 (15:19 -0700)]
regexec.c: pull array lookup out of loop

13 years agoutf8.h: Add #define for Greek small MU
Karl Williamson [Sat, 27 Nov 2010 22:16:47 +0000 (15:16 -0700)]
utf8.h: Add #define for Greek small MU

13 years agoregexec.c: clarify comments
Karl Williamson [Sat, 27 Nov 2010 22:08:34 +0000 (15:08 -0700)]
regexec.c: clarify comments

13 years agoregcomp.sym: Add EXACTFU regnode
Karl Williamson [Sat, 27 Nov 2010 17:57:01 +0000 (10:57 -0700)]
regcomp.sym: Add EXACTFU regnode

This node will be used for matching case insensitive exactish nodes
using Unicode semantics

13 years agoregexec.c: Latin1 chars can fold match UTF8_ALL
Karl Williamson [Sat, 27 Nov 2010 17:26:01 +0000 (10:26 -0700)]
regexec.c: Latin1 chars can fold match UTF8_ALL

Some ANYOF regnodes have the ANYOF_UNICODE_ALL flag set, which means
they match any non-Latin1 character.  These should match /i (in a utf8
target string) any ASCII or Latin1 character that folds outside the
Latin1 range

As part of this patch, an internal only macro is renamed to account for its
new use in regexec.c.  The cumbersome name is to ward off others from
using it until the final semantics have been settled on.

13 years agofold_grind.t: Make unicode semantics pattern differently
Karl Williamson [Sat, 27 Nov 2010 17:10:52 +0000 (10:10 -0700)]
fold_grind.t: Make unicode semantics pattern differently

This changes to use 'use re "/u"' to specify that a pattern is supposed
to match with unicode semantics, instead of upgrading it to utf8.  The
variable name changes accordingly

13 years agoAdd Perl_foldEQ_latin1()
Karl Williamson [Sat, 27 Nov 2010 16:42:48 +0000 (09:42 -0700)]
Add Perl_foldEQ_latin1()

This function compares two non-utf8 strings to see if they are
equivalent without regards to case differences.  It does not work nor
check for  three problematic code points that require special handling:
MICRO_SIGN, LATIN_SMALL_LETTER_SHARP_S, and
LATIN_SMALL_LETTER_Y_WITH_DIAERESIS.

make regen required

13 years agoperldelta for 04698ff
Father Chrysostomos [Sun, 28 Nov 2010 07:52:44 +0000 (23:52 -0800)]
perldelta for 04698ff

13 years agoperldelta up to a51ee39b
Father Chrysostomos [Sun, 28 Nov 2010 07:46:26 +0000 (23:46 -0800)]
perldelta up to a51ee39b

13 years agoperldelta up to abf9167d
Father Chrysostomos [Sun, 28 Nov 2010 07:38:43 +0000 (23:38 -0800)]
perldelta up to abf9167d

13 years agoBring core Perl in line with CPAN 0.86 release
John Peacock [Sun, 28 Nov 2010 06:05:41 +0000 (22:05 -0800)]
Bring core Perl in line with CPAN 0.86 release

Attached is a patch that bring the core Perl version code inline with
the latest CPAN release.  The vast majority of changes are in code that
does not execute in core, but that makes it easier to keep the core and
CPAN changes in sync.

13 years agoAdd Socket version numbers to perldelta
Father Chrysostomos [Sat, 27 Nov 2010 21:46:32 +0000 (13:46 -0800)]
Add Socket version numbers to perldelta

13 years agoIncrease Socket.pm’s version
Father Chrysostomos [Sat, 27 Nov 2010 21:45:58 +0000 (13:45 -0800)]
Increase Socket.pm’s version

13 years agoperldelta up to 2a25d7b6
Father Chrysostomos [Sat, 27 Nov 2010 21:25:07 +0000 (13:25 -0800)]
perldelta up to 2a25d7b6

13 years agoSuppress test warning added by 04698ff6
Father Chrysostomos [Sat, 27 Nov 2010 21:02:49 +0000 (13:02 -0800)]
Suppress test warning added by 04698ff6

13 years agoMake *ISA assignment slightly faster
Father Chrysostomos [Sat, 27 Nov 2010 21:05:16 +0000 (13:05 -0800)]
Make *ISA assignment slightly faster

Since we already know the array is magical and we already
have a pointer to the magic half the time, we can call
Perl_magic_clearisa directly.

13 years agoBump Time::HiRes version after 4edfaa8809ab489b9ce1c7936973edc2c80216db.
Craig A. Berry [Sat, 27 Nov 2010 15:50:30 +0000 (09:50 -0600)]
Bump Time::HiRes version after 4edfaa8809ab489b9ce1c7936973edc2c80216db.

13 years agoIncrease PerlIO::scalar’s version
Father Chrysostomos [Sat, 27 Nov 2010 15:43:18 +0000 (07:43 -0800)]
Increase PerlIO::scalar’s version

13 years agomro.c: Assert that the previous commit is correct
Father Chrysostomos [Sat, 27 Nov 2010 15:13:13 +0000 (07:13 -0800)]
mro.c: Assert that the previous commit is correct

13 years agoAvoid a redundant check in mro.c
Father Chrysostomos [Sat, 27 Nov 2010 15:11:20 +0000 (07:11 -0800)]
Avoid a redundant check in mro.c

This code is never reached if oldstash is a hash without an HvENAME.

So instead of checking oldstash in the ?:, then hvename in the if(),
we can do one check.

If oldstash is no longer in the symbol table, then this code is never
reached, because of the if(!fetched_isarev) guard.

13 years agoIncrease overload.pm’s version
Father Chrysostomos [Sat, 27 Nov 2010 14:42:52 +0000 (06:42 -0800)]
Increase overload.pm’s version

13 years ago[perl #79680] overload 1.10 sprintf fails taint checking
Michael Fig [Sat, 27 Nov 2010 13:44:26 +0000 (05:44 -0800)]
[perl #79680] overload 1.10 sprintf fails taint checking

[Note from the committer: I cannot reproduce the bug this is intended
to fix. I suspect the author has a botched Scalar::Util installation.
But it *does* make the code go faster, as it uses fewer ops. That’s my
reason for appling it.]

13 years agoAdd Michael Fig to AUTHORS
Father Chrysostomos [Sat, 27 Nov 2010 14:41:40 +0000 (06:41 -0800)]
Add Michael Fig to AUTHORS

13 years ago[perl #78716] Bogus read after seek beyond end of string
Father Chrysostomos [Sat, 27 Nov 2010 13:40:53 +0000 (05:40 -0800)]
[perl #78716] Bogus read after seek beyond end of string

This is a signedness problem that ffe0bb5ab did not take into account.
(STRLEN)-10 > 0 returns true for me.

13 years agoAdd Devel:: to the -d:- perldelta entry
Father Chrysostomos [Sat, 27 Nov 2010 14:39:19 +0000 (06:39 -0800)]
Add Devel:: to the -d:- perldelta entry

13 years agoperldelta up to a3179684
Father Chrysostomos [Sat, 27 Nov 2010 14:37:58 +0000 (06:37 -0800)]
perldelta up to a3179684

13 years ago[perl #79178] STORE/FETCH of tie()d hash get stringified key
Father Chrysostomos [Sat, 27 Nov 2010 14:22:24 +0000 (06:22 -0800)]
[perl #79178] STORE/FETCH of tie()d hash get stringified key

This bug has been present in non-threaded builds for a long time.
Change 38bb37b9aa introduced it to threaded builds.

$hash{...} makes its operand a shared-PV scalar if it is an OP_CONST.
But \"foo" is also an OP_CONST, as is anything generated with use
constant. This is the sort of thing that results:

$ perl5.8.5 -MO=Concise -e '$a{\"foo"}'
7  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 1 -e:1) v ->3
6     <2> helem vK/2 ->7
4        <1> rv2hv sKR/1 ->5
3           <$> gv(*a) s ->4
5        <$> const(PVIV "SCALAR(0x81b378)") s ->6
-e syntax OK

(My 5.8.5 installation is non-threaded.)

See the "SCALAR(0x81b378)" in there?

So this commit skips that optimisation if the key is ROK or if it is a
PVMG or higher.

13 years agoFix a warning (that spotted a potential mro bug that I could not produce)
Rafael Garcia-Suarez [Sat, 27 Nov 2010 14:47:44 +0000 (15:47 +0100)]
Fix a warning (that spotted a potential mro bug that I could not produce)

13 years agoSkip multi-arg piped open in autodie test on VMS.
Craig A. Berry [Sat, 27 Nov 2010 00:45:24 +0000 (18:45 -0600)]
Skip multi-arg piped open in autodie test on VMS.

Awaiting upstream integration at:

https://rt.cpan.org/Ticket/Display.html?id=59123

13 years agoSkip t/porting/FindExt.t on VMS.
Craig A. Berry [Sat, 27 Nov 2010 00:33:54 +0000 (18:33 -0600)]
Skip t/porting/FindExt.t on VMS.

win32::FindExt doesn't work on VMS, but it's only intended to work
on Windows, so there's not much reason to port it or to test it.

13 years agoFix Time::HiRes probes on VMS.
Craig A. Berry [Sat, 27 Nov 2010 00:29:42 +0000 (18:29 -0600)]
Fix Time::HiRes probes on VMS.

We have not been correctly building this on VMS since the location
was changed in core because we have not been able to loate include
files.  This mirrors the upstream patch at:

https://rt.cpan.org/Ticket/Display.html?id=63363

13 years ago[perl #78908] Reinstate mod for one more stable release
Father Chrysostomos [Fri, 26 Nov 2010 23:52:54 +0000 (15:52 -0800)]
[perl #78908] Reinstate mod for one more stable release

13 years agoUpdate MIME-Base64 to CPAN version 3.13
Chris 'BinGOs' Williams [Fri, 26 Nov 2010 23:24:22 +0000 (23:24 +0000)]
Update MIME-Base64 to CPAN version 3.13

  [DELTA]

  2010-10-26   Gisle Aas <gisle@ActiveState.com>

   Release 3.13

   The fix in v3.12 to try to preserve the SvUTF8 flag was buggy
   and actually managed to set the flag on strings that did not
   have it originally.

This resolves the test failures for Encode::Encoder

13 years agoClarify op_lvalue’s docs
Father Chrysostomos [Fri, 26 Nov 2010 22:51:07 +0000 (14:51 -0800)]
Clarify op_lvalue’s docs

as requested by Reini Urban [perl #78908]

13 years ago[perl #78810] PERLDB_NOOPT ignored by adjacent nextstate optimisation
Father Chrysostomos [Fri, 26 Nov 2010 22:24:30 +0000 (14:24 -0800)]
[perl #78810] PERLDB_NOOPT ignored by adjacent nextstate optimisation

As mentioned in the RT ticket, ac56e7d did not take PERLDB_NOOPT
into account.

13 years agoNo need to nest printfs. DIE() takes format strings.
Rafael Garcia-Suarez [Fri, 26 Nov 2010 22:30:06 +0000 (23:30 +0100)]
No need to nest printfs. DIE() takes format strings.

13 years agoFix compiler warning
Father Chrysostomos [Fri, 26 Nov 2010 22:00:56 +0000 (14:00 -0800)]
Fix compiler warning

13 years agoAvoid redundant hv_delete call in pp_entereval
Father Chrysostomos [Fri, 26 Nov 2010 20:44:43 +0000 (12:44 -0800)]
Avoid redundant hv_delete call in pp_entereval

This commit just avoids a redundant hv_delete call if leave_scope is
already going to do it.

13 years ago[perl #78634] Conflict in defining constant INIT
Father Chrysostomos [Fri, 26 Nov 2010 15:22:47 +0000 (07:22 -0800)]
[perl #78634] Conflict in defining constant INIT

When gv_init tries to turn a constant named INIT into a CV, the auto-
matic special processing of the INIT ‘block’ kicks in, which removes
the CV from the GV.

This should not happen with gv_init, as $::{INIT} = \5 is supposed
to be equivalent to *INIT = sub(){5}, which does not do that.

This commit makes gv_init check for that, increase the reference
count, and reassign the CV. It does not stop the CV from being called
as a special block, but it is harmless to call a constant CV.

13 years agoMake PerlIO marginally reentrant
David Mitchell [Mon, 22 Nov 2010 19:18:49 +0000 (19:18 +0000)]
Make PerlIO marginally reentrant

Currently if an operation on a file handle is interrupted, and if
the signal handler accesses that same file handle (e.g. closes it),
then perl will crash. See [perl #75556].

This commit provides some basic infrastructure to avoid segfaults.
Basically it adds a lock count field to each handle (by re-purposing the
unused flags field in the PL_perlio array), then each time a signal
handler is called, the count is incremented. Then various parts of PerlIO
use a positive count to change behaviour. Most importantly, when layers
are popped, the PerlIOl structure is cleared, but not freed, and is left
in the chain of layers. This means that callers still holding pointers to
the various layers won't access freed structures. It does however mean
that PerlIOl structs may be leaked, and possibly slots in PL_perlio. But
this is better than crashing.

Not much has been done to give sensible behaviour on re-entrancy; for
example, a buffer that has already been written once might get written
again. Fixing this sort of thing would require a large-scale audit of
perlio.c.

13 years agoperlio: always guard against null function table
David Mitchell [Fri, 19 Nov 2010 17:23:17 +0000 (17:23 +0000)]
perlio: always guard against null function table

In some places it already checks for a null tab field; extend that
coverage. This is in preparation for a commit which may leave active
layers with a null tab field.

13 years agoadd PerlIO_init_table() to initialise PL_perio
David Mitchell [Wed, 17 Nov 2010 16:29:04 +0000 (16:29 +0000)]
add PerlIO_init_table() to initialise PL_perio

Previously, the PL_perio table was initialised by calling PerlIO_allocate,
and throwing away the result. Since a slot with a null ->next was regarded
as freed, the next call to PerlIO_allocate would reuse that slot, which is
important, as STDIN etc are expected to occupy slots 1,2,3.

Once reference counting of the slots is introduced, however, the first
slot will leak, and STDIN etc will be assigned to the wrong slots. So do it
properly now.

13 years agoadd 'head' field to PerlIOl struct
David Mitchell [Tue, 16 Nov 2010 22:44:34 +0000 (22:44 +0000)]
add 'head' field to PerlIOl struct

This allows any layer to find the top of the layer stack,
or more specifically, the entry in PL_perlio that points to
the top.

Needed for the next commit, which will implement a reference counting
scheme.

There's currently a bug in MakeMaker which causes several extensions to
miss the dependency on perliol.h having changed, so this commit includes
a gratuitous whitespace change to perl.h to hopefully force recompilation.

13 years agomake PL_perlio an array of PerlIOl, not PerlIO *
David Mitchell [Mon, 15 Nov 2010 17:06:37 +0000 (17:06 +0000)]
make PL_perlio an array of PerlIOl, not PerlIO *

Layers in PerlIO are implemented as a linked list of PerlIOl structs;
eaxch one has a 'next' field pointing to the next layer. Now here's the
clever bit: When PerlIO* pointers are passed around to refer to a
particular handle, these are actually pointers to the 'next' field of the
*parent* layer (so to access the flags field say of a PerlIOl, you have to
double-defref it, e.g. (*f)->flags). The big advantage of this is that
it's easy for a layer to pop itself; when you call PerlIO_pop(f), f is a
pointer to the parent's 'next' field, so pop(f) can just do
*f = (*f)->next.

This means that there has to be a fake 'next' field above the topmost
layer. This is where PL_perlio comes in: it's a pointer to an arena of
arrays of pointers, each one capable of pointing to a PerlIOl structure.
When  a new handle is created, a spare arena slot is grabbed, and the
address of that slot is returned. This also allows for a handle with no
layers.

What this commit does is change PL_perlio from being an array of
PerlIO* into an array of PerlIOl structures - i.e. each element in the
array goes from being a single pointer, to having several fields. These
will be made used of in follow-up commits.

13 years agoIn deparse.t, give a description to every test. Remove the test numbers.
Nicholas Clark [Fri, 26 Nov 2010 15:29:07 +0000 (15:29 +0000)]
In deparse.t, give a description to every test. Remove the test numbers.

Pass all test descriptions to Test::More. Remove one duplicated test.

13 years agoStop eval "BEGIN{die}" from leaking
Father Chrysostomos [Fri, 26 Nov 2010 14:25:36 +0000 (06:25 -0800)]
Stop eval "BEGIN{die}" from leaking

This fixes the rest of [perl #78438].

eval "BEGIN{die}" creates a *{"_<(eval 1)"} glob regardless of $^P’s
setting in non-threaded builds as of change f9bddea (5.12.0).

Here are the results with various configurations:

version  threaded  eval text  $^P  Is *{"_<(eval 1)"} set?
-------  --------  ---------  ---  -----------------------
5.10.1   yes       BEGIN{}      0  no
5.10.1   yes       BEGIN{die}   0  no
5.10.1   yes       BEGIN{}    0xA  yes
5.10.1   yes       BEGIN{die} 0xA  no

5.10.1   no        BEGIN{}      0  no
5.10.1   no        BEGIN{die}   0  no
5.10.1   no        BEGIN{}    0xA  yes
5.10.1   no        BEGIN{die} 0xA  no

5.13.7   yes       BEGIN{}      0  no
5.13.7   yes       BEGIN{die}   0  no
5.13.7   yes       BEGIN{}    0xA  yes
5.13.7   yes       BEGIN{die} 0xA  yes

5.13.7   no        BEGIN{}      0  no
5.13.7   no        BEGIN{die}   0  yes
5.13.7   no        BEGIN{}    0xA  yes
5.13.7   no        BEGIN{die} 0xA  yes

Notice that, for non-threaded builds, BEGIN{die} goes from never sav-
ing the text to always saving it.

The commit in question is:

commit f9bddea7d2a0d824366014c8ee6ba57e7dedd8c3
Author: Nicholas Clark <nick@ccl4.org>
Date:   Tue Dec 2 20:43:58 2008 +0000

    Implement PERLDBf_SAVESRC_INVALID, which saves source lines for string
    evals that fail to compile.

    p4raw-id: //depot/perl@34985

It stops unconditionally using the scoping mechanism to delete
$::{"_<(eval $num)"} on compilation failure:

-    safestr = savepvn(tmpbuf, len);
-    SAVEDELETE(PL_defstash, safestr, len);

but instead does it explicitly in this block:

+    if (doeval(gimme, NULL, runcv, seq)) {
+ if (was != PL_breakable_sub_gen /* Some subs defined here. */
+     ? (PERLDB_LINE || PERLDB_SAVESRC)
+     :  PERLDB_SAVESRC_NOSUBS) {
+     /* Retain the filegv we created.  */
+ } else {
+     char *const safestr = savepvn(tmpbuf, len);
+     SAVEDELETE(PL_defstash, safestr, len);
+ }
+ return DOCATCH(PL_eval_start);
+    } else {
+ /* We have already left the scope set up earler thanks to the LEAVE
+    in doeval().  */
+ if (PERLDB_SAVESRC_INVALID) {
+     /* Retain the filegv we created.  */
+ } else {
+     (void)hv_delete(PL_defstash, tmpbuf, len, G_DISCARD);
+ }
+ return PL_op->op_next;
+    }

In the case of BEGIN{die}, that doeval() never returns, so the
clean-up code is not reached.

S_doeval never returns because call_list calls Perl_croak if it
catches a BEGIN error (appending the extra ‘BEGIN failed--compilation
aborted’, etc.). That takes execution all the way back to perl_run, so
it bypasses the clean-up code in pp_entereval.

What’s leaking is the GV created earlier in pp_entereval by this line:

    CopFILE_set(&PL_compiling, tmpbuf+2);

CopFILE_set simply stores a string under threads, but creates a GV
under non-threaded builds.

This commit solves the problem by scheduling a deletion *before* call-
ing doeval, if the source lines have not been saved.

This works because the usual code to handle it is only bypassed when
there is a BEGIN block (a subroutine), so PL_breakable_sub_gen will
have gone up. So we never need to delete the saved lines when that
code is bypassed.

13 years agoSpecial compiler settings only change for 64bitall, not for 64bitint
H.Merijn Brand [Fri, 26 Nov 2010 09:03:46 +0000 (10:03 +0100)]
Special compiler settings only change for 64bitall, not for 64bitint

13 years agoUpdate MIME-Base64 to CPAN version 3.12
Chris 'BinGOs' Williams [Fri, 26 Nov 2010 00:46:37 +0000 (00:46 +0000)]
Update MIME-Base64 to CPAN version 3.12

  [DELTA]

  2010-10-25   Gisle Aas <gisle@ActiveState.com>

   Release 3.12

   Don't change SvUTF8 flag on the strings encoded [RT#60105]

   Documentation tweaks

13 years agoCan't spawn fresh Perl interpreter with an empty PATH
Jan Dubois [Fri, 26 Nov 2010 00:26:51 +0000 (16:26 -0800)]
Can't spawn fresh Perl interpreter with an empty PATH

13 years agoSync win32/Makefile with win32/makefile.mk
Jan Dubois [Thu, 25 Nov 2010 22:26:21 +0000 (14:26 -0800)]
Sync win32/Makefile with win32/makefile.mk

13 years agoPass STATIC_EXT to t/porting/FindExt.t
Jan Dubois [Thu, 25 Nov 2010 22:14:18 +0000 (14:14 -0800)]
Pass STATIC_EXT to t/porting/FindExt.t

The list of static extensions on Windows is only known
inside win32/Makefile and win32/makefile.mk, so we need
to somehow pass it to t/porting/FindExt.t to give it
a chance to pass on Windows.

Unfortunately this means that PERL_STATIC_EXT will have
to be set manually if this test is to be run directly
and not via the Makefile.

13 years agoInclude ws2tcpip.h to get IPv6 definitions
Jan Dubois [Thu, 25 Nov 2010 20:23:05 +0000 (12:23 -0800)]
Include ws2tcpip.h to get IPv6 definitions

This commit also moves down the 'extern "C"' wrapper so that
it doesn't apply to any #included headers because they may
generate C++ code (templates) which doesn't confirm to "C"
linkage (when this header is included in C++ mode, e.g. while
compiling win32/perllib.c).

13 years ago[PATCH 5/5] Added Paul Evans to AUTHORS
Paul Evans [Thu, 25 Nov 2010 20:10:25 +0000 (20:10 +0000)]
[PATCH 5/5] Added Paul Evans to AUTHORS

Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
13 years ago[PATCH 4/5] Adjust unit tests to cope with new sockaddr_in6 functions in Socket ...
Paul Evans [Thu, 25 Nov 2010 20:09:15 +0000 (20:09 +0000)]
[PATCH 4/5] Adjust unit tests to cope with new sockaddr_in6 functions in Socket (pulled in via IO::Socket)

Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
13 years ago[PATCH 3/3] Provide wrappers for IN6ADDR_ANY and IN6ADDR_LOOPBACK
Paul Evans [Thu, 25 Nov 2010 20:08:05 +0000 (20:08 +0000)]
[PATCH 3/3] Provide wrappers for IN6ADDR_ANY and IN6ADDR_LOOPBACK

Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
13 years ago[PATCH 2/3] Implement sockaddr_in6 wrapper
Paul Evans [Thu, 25 Nov 2010 20:07:23 +0000 (20:07 +0000)]
[PATCH 2/3] Implement sockaddr_in6 wrapper

Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
13 years ago[PATCH 1/3] Implement Socket::pack_sockaddr_in6() and unpack_sockaddr_in6()
Paul Evans [Thu, 25 Nov 2010 20:06:36 +0000 (20:06 +0000)]
[PATCH 1/3] Implement Socket::pack_sockaddr_in6() and unpack_sockaddr_in6()

Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
13 years ago[perl #78438] Memory leak with 'use v5.42'
Father Chrysostomos [Thu, 25 Nov 2010 14:14:40 +0000 (06:14 -0800)]
[perl #78438] Memory leak with 'use v5.42'

13 years agoStop eval "use 6" from leaking
Father Chrysostomos [Thu, 25 Nov 2010 14:11:12 +0000 (06:11 -0800)]
Stop eval "use 6" from leaking

13 years agoStop eval "no 5" from leaking
Father Chrysostomos [Thu, 25 Nov 2010 14:06:31 +0000 (06:06 -0800)]
Stop eval "no 5" from leaking

13 years agoMake BEGIN {require 5.12.0} behave as documented.
Nicholas Clark [Thu, 25 Nov 2010 17:08:18 +0000 (17:08 +0000)]
Make BEGIN {require 5.12.0} behave as documented.

Previously in a BEGIN block, require was behaving identically to use 5.12.0 -
ie erroneously executing the use feature ':5.12.0'; and use strict;
use warnings behaviour, which only use was documented to provide.