Florian Ragwitz [Sun, 20 Mar 2011 18:47:34 +0000 (19:47 +0100)]
Trim some trailing whitespace from epigraphs.pod
Karl Williamson [Sun, 20 Mar 2011 17:57:20 +0000 (11:57 -0600)]
regex .t's: Remove now passing TODOs
Karl Williamson [Sun, 20 Mar 2011 17:56:11 +0000 (11:56 -0600)]
regexec.c: Rmv special code no longer needed
The trickyness has been resolved elsewhere
Karl Williamson [Sun, 20 Mar 2011 01:29:17 +0000 (19:29 -0600)]
regcharclass: Add tricky fold characters.
The tricky fold characters need to be expanded to include the ones
that map to the same ones as the original set. This isn't because the
new ones have a length issue, it's that they get left out of comparisons
because of the special regnodes generated for the tricky ones.
Karl Williamson [Sun, 20 Mar 2011 17:32:11 +0000 (11:32 -0600)]
regcomp.c: Remove FOLDCHAR generation
ANYOFV handles multi-char folds in ANYOF nodes, and it turns
out it is a superset of what FOLDCHAR does, which never got fully
implemented in regexec.c, whereas ANYOFV is. FOLDCHAR may be the better
way to go in the long-term, as it takes less space and is faster, but
this gives us the functionality today, with no extra work.
FOLDCHAR had been generated only when the character in question is a
literal in the input stream, and wasn't touched for the probably more
common use of \N{} or \x, which were fixed from not doing anything
special to using ANYOFV earlier in the 5.13 series, and it turns out
that the code that does it all is in a part of the code that gets
executed anyway, so that simply removing the special FOLDCHAR code
causes execution to drop down to this code.
I'm thinking at the moment that for 5.16, ANYOV should be removed in
favor of branches, using the technique of recursion that has recently
been added to \N{}. That would enable easier trie generation and
simplify things in regexec and the optimizer.
Karl Williamson [Sun, 20 Mar 2011 17:26:14 +0000 (11:26 -0600)]
regcomp.c: Use mnemonic instead of hex value
Karl Williamson [Sun, 20 Mar 2011 17:23:14 +0000 (11:23 -0600)]
regcomp.c: Handle inverse tricky folds
The tricky folds have only worked one direction. This handles the
other, when it sees something the tricky fold folds to it converts that
to the tricky fold op.
Karl Williamson [Sun, 20 Mar 2011 17:18:17 +0000 (11:18 -0600)]
regcomp.c: Move opening block brace
This is in preparation for future commits. The declarations don't
depend on the two code lines.
Karl Williamson [Sun, 20 Mar 2011 17:14:28 +0000 (11:14 -0600)]
regcomp.c: Add special case for a Unicode char
This failed under some circumstances
Karl Williamson [Sun, 20 Mar 2011 16:25:17 +0000 (10:25 -0600)]
reg_namedseq: Restructure so doesn't duplicate code
This routine now calls reg() recursively after converting the parse
to something the rest of the code understands. This eliminates
duplicated code, and allows for uniform treatment of code points, as
things were getting out of sync. It also eliminates the restrction on
how many characters a named sequence can expand to.
toke now converts its input (which is in Unicode terms) to native on
EBCDIC platforms, so the rest of the code can can continue to ignore
that.
The restriction on the length of the number of characters a named
sequence is hereby removed, because reg() handles that.
Karl Williamson [Sun, 20 Mar 2011 16:20:14 +0000 (10:20 -0600)]
Add depth parameter to reg_namedseq
Karl Williamson [Sun, 20 Mar 2011 15:59:26 +0000 (09:59 -0600)]
regcomp.c: Add element to structure
Karl Williamson [Sun, 20 Mar 2011 15:58:44 +0000 (09:58 -0600)]
utf8.h: Add #define
Florian Ragwitz [Sun, 20 Mar 2011 15:16:49 +0000 (16:16 +0100)]
Simplify a tiny bit of the release manager guide
Florian Ragwitz [Sun, 20 Mar 2011 15:14:43 +0000 (16:14 +0100)]
Add 5.13.11 to perlhist
Florian Ragwitz [Sun, 20 Mar 2011 14:40:16 +0000 (15:40 +0100)]
Update corelist for 5.13.11
Nicholas Clark [Sun, 20 Mar 2011 14:37:39 +0000 (14:37 +0000)]
Avoid warnings in pat_advanced.t in the logic for skipping a test.
Also, change the skip added in
2feceb76bc07c897 to a todo skip.
Florian Ragwitz [Sun, 20 Mar 2011 14:31:55 +0000 (15:31 +0100)]
Fill the Acknowledgements section in perldelta
Florian Ragwitz [Wed, 9 Mar 2011 22:41:46 +0000 (23:41 +0100)]
Bump the perl version for 5.13.11
Florian Ragwitz [Sun, 20 Mar 2011 13:58:19 +0000 (14:58 +0100)]
Fix a tiny pod nit in perldelta
Florian Ragwitz [Sun, 20 Mar 2011 13:55:29 +0000 (14:55 +0100)]
Remove empty perldelta sections
Only the Acknowledgements section still needs filling in.
Florian Ragwitz [Sun, 20 Mar 2011 13:49:47 +0000 (14:49 +0100)]
Complete the perldelta for 5.13.11
Nicholas Clark [Sun, 20 Mar 2011 11:19:23 +0000 (11:19 +0000)]
Skip test in pat_advanced_thr.t as it triggers an unrelated thread bug.
Nicholas Clark [Sun, 20 Mar 2011 10:25:21 +0000 (10:25 +0000)]
Minimise the actions of the BEGIN block in B.pm
Retain the call to XSLoader::load() at BEGIN time, as we want the constants
loaded before the compiler meets OPf_KIDS below, as the combination of having
the constant stay a Proxy Constant Subroutine and its value being inlined
saves a little over .5K
Nicholas Clark [Sun, 20 Mar 2011 10:03:15 +0000 (10:03 +0000)]
In B, use typeglob aliasing instead of subref to typeglob assignment.
Typeglob aliasing saves just about 1.25K, because fewer internal structures are
created. In the general case the behaviour of the two differs, but as the
only package variables of these names are subroutines, and we are within our
own namespace, there is no difference here.
Jan Dubois [Fri, 18 Mar 2011 22:37:20 +0000 (15:37 -0700)]
#84774: local $_ calls STORE when $_ is aliased to a tied hash element
local($_) will now strip all magic from $_, so that it is always safe
to localize $_, regardless what kind of special (or tied) variable it
may have been aliased to.
Karl Williamson [Sun, 20 Mar 2011 01:19:50 +0000 (19:19 -0600)]
regexec.c: Update comment
Karl Williamson [Sun, 20 Mar 2011 01:18:47 +0000 (19:18 -0600)]
regcomp.h: Add comment
Karl Williamson [Sun, 20 Mar 2011 01:11:16 +0000 (19:11 -0600)]
mktables: Include simple case foldings
F(ull) case foldings are not handled all that well in Perl. It turns out
that a number of them have S foldings as well. In all cases, what
matches in S is supposed to also match in F, but Perl doesn't always
know that; this adds that information.
David Golden [Sun, 20 Mar 2011 01:55:15 +0000 (21:55 -0400)]
perlfunc: clarified 'do FILE' error checking
Partial fix for RT #80626
Father Chrysostomos [Sun, 20 Mar 2011 01:52:35 +0000 (18:52 -0700)]
perl5123delta: Improve description
‘lvalue sub return values are now COW’ is not very clear.
I know 5.12.3 is already released, but at least for posterity’s
sake it’s nice to make this more descriptive.
Father Chrysostomos [Sun, 20 Mar 2011 01:42:25 +0000 (18:42 -0700)]
perl5122delta: typo
Father Chrysostomos [Sun, 20 Mar 2011 00:50:31 +0000 (17:50 -0700)]
perl5122delta: Correct two references
These are CPAN tickets, not perl tickets.
David Golden [Sun, 20 Mar 2011 00:51:48 +0000 (20:51 -0400)]
Updated HTTP::Tiny to CPAN version 0.011
[DELTA]
0.011 2011-03-19 20:48:39 America/New_York
[BUG FIXES]
- Made t/000_load.t less verbose under harness (RT#65507) [Dave Mitchell]
- Removed 'Errno' as an explicit prefix (it is a core module, but not
indexed by PAUSE, which might confuse some installers
Karl Williamson [Sun, 20 Mar 2011 00:41:48 +0000 (18:41 -0600)]
regcomp.c: RT#77414. Initialize flag
As indicated in the comments, this flag needs to be initialized to
1 or the optimizer loses the fact that something could match a
character that isn't in utf8 and whose bitmap bit isn't set. This
happens, for example, with Unicode properties.
Thus this fixes #77414. That ticket had been closed recently because
it went away due to another patch that caused the optimizer to be
bypassed in the cases tested for. But when that patch was reverted,
and cleaned-up, this bug came back. Now, I believe I have found the
root cause.
Karl Williamson [Sun, 20 Mar 2011 00:37:53 +0000 (18:37 -0600)]
regcomp.c: /l uses the \w, etc. classes
For non-locale, \d, etc are compiled in with their actual code points they
match, so the class portion of the synthetic start class node is
irrelevant, and should initialized to zero to avoid confusion. But for
locale it is highly relevant, and should be initialized to all ones, to
indicate matching anything.
Karl Williamson [Sun, 20 Mar 2011 00:33:17 +0000 (18:33 -0600)]
regcomp.c: Optimizer could lose some info
When ORing two nodes together for the synthetic start class, and one
matches outside the 256-char bitmap, we currently don't know what it
matches. In some cases it could be some or all of those 256 characters.
If so, we have to assume it's all of them.
Karl Williamson [Sun, 20 Mar 2011 00:21:32 +0000 (18:21 -0600)]
regcomp.c: Move statement down.
This is in prep for another commit which needs the flags to be
untouched for some tests.
Karl Williamson [Sun, 20 Mar 2011 00:18:39 +0000 (18:18 -0600)]
pat_advanced.t: Bump watchdog timeout
When my system was at 100%, the 2 seconds wasn't enough. I set it
to 10 seconds which is the most common value used in other .t's
Karl Williamson [Sat, 19 Mar 2011 21:10:21 +0000 (15:10 -0600)]
regcomp.h: Add ANYOF_CLASS_SETALL()
This macro sets all the bits of the class (for \w, etc) for use during
initialization
Karl Williamson [Sat, 19 Mar 2011 21:31:30 +0000 (15:31 -0600)]
utf8.h: A fold buffer needs to hold any utf8 char
It can't just be large enough to hold the Unicode subset.
Karl Williamson [Sat, 19 Mar 2011 21:22:11 +0000 (15:22 -0600)]
regexec.c: execute inappropriately skipped code
The comment said that there was no use doing this in lenp was NULL,
but there is, as it sees if there is a match or not and sets the
appropriate variable.
Karl Williamson [Sat, 19 Mar 2011 21:19:00 +0000 (15:19 -0600)]
regexec.c: Chg var. name for clarity
Chris 'BinGOs' Williams [Sun, 20 Mar 2011 00:37:18 +0000 (00:37 +0000)]
Update CPANPLUS to CPAN version 0.9103
[DELTA]
Changes for 0.9103 Sun Mar 20 00:38:05 2011
================================================
* Fixed the logic not sending NA reports when
'perl' is expressed as a prereq
Father Chrysostomos [Sun, 20 Mar 2011 00:39:14 +0000 (17:39 -0700)]
More version bumps in view of recent PERL_NO_GE_CONTEXT commits
Michael Witten [Sun, 20 Mar 2011 00:34:58 +0000 (17:34 -0700)]
Clean: Move old comment to proper location
This:
commit
0298d7b92741692bcf2e34c418a564332bb034e6:
Date: Tue May 31 10:40:01 2005 +0000
Avoid updating a variable in a loop.
Only calculate the number of links in a hash bucket chain if we really
need it.
p4raw-id: //depot/perl@24648
forgot to move a large comment to its new location; this new commit
fixes that.
Alastair Douglas [Sun, 20 Mar 2011 00:26:43 +0000 (17:26 -0700)]
Doc patch for perlsyn, clarification in given/when
I had about an hour of über confusion regarding smart matching in a
when, and when I finally clocked on to what the POD was telling me I
thought clarification would be in order. Many agreed :)
The chief change I would make is to use the word 'operands' instead of
'arguments' when referring to the ... and ..., ... && ... etc
sections; this was the major cause of my confusion. Second
clarification is that 'the test' in question is whether to use smart
matching, not the result of using smart matching!
Patch follows; please go ahead and amend as required :)
Father Chrysostomos [Sun, 20 Mar 2011 00:26:38 +0000 (17:26 -0700)]
Add Alastair Douglas to AUTHORS
David Mitchell [Sat, 19 Mar 2011 21:49:34 +0000 (21:49 +0000)]
Perl_sighandler: only inc SS_ix for unsafe signals
Perl_sighandler currently increments the savestack by 5
before running a signal handler, to avoid messing with a
partially completed SS push operation that's been interrupted.
This is irrelevant for safe signals, so make this action conditional on
unsafe signals only.
David Mitchell [Sat, 19 Mar 2011 21:29:16 +0000 (21:29 +0000)]
In signal handler, don't inc stack pointers
In Perl_sighandler, we currently increment PL_markstack_ptr and
PL_scopestack_ix.
This was added back in 1997 in the era of unsafe signals, to make them
slightly less unsafe. The idea presumably was to stop signal handlers
inadvertently corrupting the top element of each stack. However, given that
the normal method of pushing something onto those stacks is to increment
the pointer before pushing the value, I don't see how that can happen.
The downside of this is that an uninitialised or stale value can be left
in the 'hole' left on these stacks. When exiting from a signal handler via
exit(), these holes can be read and corruption occur, while stack
unwinding is taking place. The ordering of things means we can't use
SAVEDESTRUCTOR_X to undo the damage.
This commit leaves the 'PL_savestack_ix += 5', because in this case, with
unsafe signals, it *is* possible to interrupt halfway through a new set of
save data being pushed onto the stack, and it *is* possible for this to be
undone via SAVEDESTRUCTOR_X. (But it's still unsafe and half-baked.)
This fixes [perl #85206].
Nicholas Clark [Sat, 19 Mar 2011 21:20:46 +0000 (21:20 +0000)]
Add PERL_NO_GET_CONTEXT to NDBM_File
For threaded platforms, this reduces the object code size, and should slightly
reduce CPU usage.
Nicholas Clark [Sat, 19 Mar 2011 21:19:58 +0000 (21:19 +0000)]
Add PERL_NO_GET_CONTEXT to GDBM_File
For threaded platforms, this reduces the object code size, and should slightly
reduce CPU usage.
Father Chrysostomos [Sat, 19 Mar 2011 21:40:36 +0000 (14:40 -0700)]
Version bumps for the recent PERL_NO_GET_CONTEXT commits
Father Chrysostomos [Sat, 19 Mar 2011 19:02:14 +0000 (12:02 -0700)]
perl5121delta: #72998 was introduced earlier
Nicholas Clark [Sat, 19 Mar 2011 20:51:18 +0000 (20:51 +0000)]
Add PERL_NO_GET_CONTEXT to mro
For threaded platforms, this reduces the object code size, and should slightly
reduce CPU usage.
Nicholas Clark [Sat, 19 Mar 2011 20:43:32 +0000 (20:43 +0000)]
Add PERL_NO_GET_CONTEXT to attributes
For threaded platforms, this reduces the object code size, and should slightly
reduce CPU usage.
Nicholas Clark [Sat, 19 Mar 2011 20:36:38 +0000 (20:36 +0000)]
Add PERL_NO_GET_CONTEXT to XS::Typemap
For threaded platforms, this almost halves the object code size.
Nicholas Clark [Sat, 19 Mar 2011 20:28:55 +0000 (20:28 +0000)]
Add PERL_NO_GET_CONTEXT to Sys::Hostname
For threaded platforms, this reduces the object code size, and should slightly
reduce CPU usage.
Nicholas Clark [Sat, 19 Mar 2011 20:22:08 +0000 (20:22 +0000)]
Add PERL_NO_GET_CONTEXT to I18N::Langinfo
For threaded platforms, this reduces the object code size, and should slightly
reduce CPU usage.
Nicholas Clark [Sat, 19 Mar 2011 20:15:19 +0000 (20:15 +0000)]
Add PERL_NO_GET_CONTEXT to Hash::Util
For threaded platforms, this reduces the object code size, and should slightly
reduce CPU usage.
Nicholas Clark [Sat, 19 Mar 2011 20:03:47 +0000 (20:03 +0000)]
Add PERL_NO_GET_CONTEXT to Hash::Util::FieldHash
For threaded platforms, this reduces the object code size, and should slight
reduce CPU usage.
Nicholas Clark [Sat, 19 Mar 2011 19:40:20 +0000 (19:40 +0000)]
Add PERL_NO_GET_CONTEXT to File::Glob
For threaded platforms, this reduces the object code size, and should slightly
reduce CPU usage.
Nicholas Clark [Sat, 19 Mar 2011 19:10:42 +0000 (19:10 +0000)]
Add PERL_NO_GET_CONTEXT to dl_dlopen.xs
For threaded builds on platforms using dlopen() for dynamic loading, this
should reduce object size, and slightly reduce CPU usage when loading
extensions.
Karl Williamson [Sat, 19 Mar 2011 20:50:46 +0000 (14:50 -0600)]
Stop hang in regex
The algorithm for mapping multi-char fold matches back to the source in
processing ANYOF nodes was defective. This caused the regex engine to
hang on certain character combinations. I've also added an assert to
stop instead of loop.
David Mitchell [Sat, 19 Mar 2011 19:26:49 +0000 (19:26 +0000)]
reset pos and utf8 cache when de/encoding utf8 str
When using
utf8::upgrade
utf8::downgrade
utf8::encode
utf8::decode
or the underlying C-level functions
sv_utf8_upgrade_flags_grow
sv_utf8_downgrade
sv_utf8_encode
sv_utf8_decode
and
sv_recode_to_utf8
update the position of the pos magic, if any, and clear the utf8
length/position-mapping cache.
This fixes [perl #80190].
Jan Dubois [Sat, 19 Mar 2011 00:45:10 +0000 (17:45 -0700)]
Fixup errno definitions for Windows
Redefine all winsock based Exxxx error constants used in the
core: For VS2010 we don't want to use the errno.h values, and
for older compiler versions we don't have a definition anyways.
Also remove the warnings about VS2010 from README.win32, as
they should all be resolved now.
Steve Hay [Sat, 19 Mar 2011 00:04:35 +0000 (17:04 -0700)]
Redefine errno values for Visual Studio 2010
Perl traditionally stores WinSock error codes (values above 10000) in
errno, with corresponding support for $! to stringify them properly.
In Visual Studio 2010 (and presumably newer Windows SDKs) Microsoft
has started to define additional errno constants in errno.h (values
between 100 and 200) with conflicting names (e.g. EWOULDBLOCK).
There are 2 ways to deal with this situation:
1) Redefine the errno.h constants back to the winsock values for
the Errno and POSIX modules.
2) Translate the winsock error codes to the new errno constants
in the socket implementation in win32/win32sck.c.
Solution 1) has the advantage that any existing Perl code that has
numeric error codes hard-coded in it will continue to work.
Solution 2) has the advantage that XS code using external libaries can
set errno to the new constants, and they will be handled consistently
in the Perl core. It will however need additional support for other
compilers and runtime libraries that don't support these new error
codes.
This commit implements solution 1).
Blame attribution: the commit message is from Jan Dubois,
the actual patch was created by Steve Hay.
Signed-off-by: Jan Dubois <jand@activestate.com>
Moritz Lenz [Sat, 19 Mar 2011 10:44:23 +0000 (10:44 +0000)]
[PATCH] [pod] improve documentation for (?(cond)yes|no)
perlre: Include a high-level description of what it does, and what a missing
pattern means
perlreref: Include missing look-around cases
Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
Karl Williamson [Fri, 18 Mar 2011 16:24:04 +0000 (10:24 -0600)]
regcomp.c: Reorder if to silence valgrind
It is better to test that a pointer is in bounds before dereferencing it
even though in this case it doesn't lead to an actual error.
Karl Williamson [Fri, 18 Mar 2011 14:36:17 +0000 (08:36 -0600)]
regex: Fix locale regression
Things like \S have not been accessible to the synthetic start class
under locale matching rules. They have been placed there, but the
start class didn't know they were there.
This patch sets ANYOF_CLASS in initializing the synthetic start class
so that downstream code knows it is a charclass_class, and removes
the code that partially allowed this bit to be shared, and which isn't
needed in 5.14, and more thought would have to go into doing it than
was reflected in the code.
I can't come up with a test case that would verify that this works,
because of general locale testing issues, except it looked at a dump of
the generated regex synthetic start class, but the dump isn't the same
thing as the real behavior, and using one is also subject to breakage if
the regex code changes in the slightest.
Karl Williamson [Thu, 17 Mar 2011 19:55:35 +0000 (13:55 -0600)]
charset.t: Skip locale tests depending on platform
The locale tests in this file assume that the code points 128-255 are
not printable, etc in the C locale. Some platforms do not conform to that
so test at the beginning for that.
Jan Dubois [Thu, 17 Mar 2011 17:38:18 +0000 (10:38 -0700)]
Add perldelta entry about improved kill(9,$pid) on Windows
I'm only adding it because there was a comment at the top of
perldelta that this change was missing an entry. I'm not
sure it has to be mentioned at all, as it is not a full fix,
just making the issue less likely to occur.
Jan Dubois [Thu, 17 Mar 2011 17:14:19 +0000 (10:14 -0700)]
#81026: Perl binary no longer relocatable
Provide a preprocessor macro PERL_RELOCATABLE_INCPUSH to tell
incpush_use_sep() to ignore the passed in len argument. This
enables relocatable Perl distributions that patch the various
paths at install time.
Core Perl neither provides actual relocation scripts/programs,
nor endorses this practise as being "supported"; this patch
only makes it possible to create such tools. It is therefore
undocumented outside the source level comments.
Karl Williamson [Thu, 17 Mar 2011 16:24:28 +0000 (10:24 -0600)]
regcomp.c: Avoid locale in optimizer unless necessary
This is further work along the lines in RT #85964 and commit
af302e7fa58415c2d8454c8cbef7bccd8b504257. It reverts, for the the most
part, commits
aa19b56b2f07e9eabf57540f00d312d8093e9d28 (Remove unused
parameter) and
c613755a4b4fc8e64a77639d47d7e208fee68edc (/l in synthetic
start class).
Those commits caused the synthetic start class to often be marked as
matching under locale rules, even if there was no part of the regular
expression that used locale. This led to RT #85964, which made apparent
that there were a number of assumptions in the optimizer about locale
that were no longer necessarily true. This new commit changes things so
that locale has to be somewhere in the regex in order to get the
synthetic start class to include /l. In other words, this reverts the
effect of those commits to regular expression which have /l -- we go
back to the old way of doing things for non-locale regexes. This limits
any bugs that may have been introduced by the addition of /l (and being
able to match only sub-parts of a regex under locale) to the relatively
uncommon regexes which actually use it. There are a number of bugs
that have surfaced for the locale rules regexes that have gone
unreported; and some say locale rules regexes should be deprecated.
Karl Williamson [Thu, 17 Mar 2011 16:14:58 +0000 (10:14 -0600)]
Revert "re/pat.t: Remove TODO message on passing tests"
This reverts commit
b8953805dfeee53cd2300f61834ba32ccaaefaa8.
These tests started passing as a side effect of a commit which now needs
to be reverted for other reasons.
Karl Williamson [Thu, 17 Mar 2011 15:45:38 +0000 (09:45 -0600)]
Revert "regcomp.c: Rmv unused parameter"
This reverts commit
c45df5a16bb5a26a06275cc63f2c3e6b1d708184.
The parameter is about to be put back in.
Karl Williamson [Thu, 17 Mar 2011 15:40:13 +0000 (09:40 -0600)]
regcomp.c: Add flag for /l occurring anywhere
If any part of a pattern has /l, this flag will get set; for future
use.
Karl Williamson [Thu, 17 Mar 2011 14:24:51 +0000 (08:24 -0600)]
regcomp.c: Move comment
Father Chrysostomos [Thu, 17 Mar 2011 13:03:59 +0000 (06:03 -0700)]
perldelta for 007f907
Father Chrysostomos [Thu, 17 Mar 2011 12:46:25 +0000 (05:46 -0700)]
[perl #86328] coredump in cleaning up circular magic
The following program dumps core:
=============================================
#!/usr/bin/perl
use Scalar::Util qw(weaken);
sub TIEHASH {
return bless [];
}
sub DESTROY {
my ($tied) = @_;
my $b = $tied->[0];
}
my $a = {};
tie %$a, "main";
weaken((tied %$a)->[0] = $a);
# Done setting up the evil data structure
$a = undef;
=============================================
The problem here, as Ton Hospel correctly observed in the ticket, is
that the DESTROY method called when tie magic is freed sees the weak
reference still in existence pointing to an SV with a refcount of 0.
This worked in 5.8.x, because the back-references were killed
before the tie magic was freed. It was a matter of what order the
magic is stored, as demonstrated by this script, which crashes in
5.8.x as well:
=============================================
#!/usr/bin/perl
use Scalar::Util qw(weaken);
sub TIEHASH {
return $_[1];
}
sub DESTROY {
my ($tied) = @_;
my $b = $tied->[0];
}
my $a = {};
my $o = bless [];
weaken($o->[0] = $a);
tie %$a, "main", $o;
# Done setting up the evil data structure
$a = undef;
=============================================
In 5.10.0, with commit 86f5593, HVs stopped storing their back-refer-
ences in magic most of the time, and sv_clear started killing those
HV back-references after freeing magic; hence the change in order.
This commit solves the problem simply by freeing back-references
before magic. To take non-hash SVs (and undeffed hashes) into account,
it also frees backref magic before any other kind.
(This commit message started off as my own notes. But then it turned
into a history lesson. :-)
Karl Williamson [Thu, 17 Mar 2011 03:40:03 +0000 (21:40 -0600)]
regcomp.c: Omitted hard-coded case mapping
The code has hard-coded the possible case mappings for the code points
< 256. This one was omitted.
Karl Williamson [Thu, 17 Mar 2011 03:38:02 +0000 (21:38 -0600)]
regcomp.c: Restore ptr correctly
oldp contains the pointer that we want to get to. Use that instead
of a possibly invalid assumption about length
Karl Williamson [Thu, 17 Mar 2011 02:36:23 +0000 (20:36 -0600)]
regcomp.c: comment and white-space-only change
Karl Williamson [Wed, 16 Mar 2011 18:19:42 +0000 (12:19 -0600)]
RT #85964: bleadperl breaks CGI-FormBuilder
The introduction of the l regex modifier introduces the possibility that
a regular expression can have subportions that match under locale and
other portions that don't. I (khw) failed to see all the implications
of that in the optimizer. Unfortunately, things didn't start surfacing
until late in the development cycle.
The optimizer is structured so that a new blank node is initialized to
match anything, and the state is set to AND, so that the first real node
that comes along is supposed to be ANDed together; with the result being
that node. (Like an AND of all 1's with some bit pattern yields that
bit pattern.) Then the mode is switched to OR, so subsequent nodes that
could be the start ones are or'd in. *(see footnote below).
This design leads to some issues, like at the XXX line added by this
commit, which looks to be a work-around for the deficiencies of the
design.
Commit
cf34198ebe3dd876d67c10caa9acf491ad2a0c51 that led to this ticket
changed things to include LOCALE as part of the initialization, so that
the l could be on and off in various parts of the regex. I tried to
just revert that (plus associated parameter changes), and found that the
changes made to the AND and OR logic that fixed other problems really
depended on that commit. Perhaps those could be worked around, but it
is not the forward direction.
This commit works around things in a different way. What happened in
the earlier commit was that the synthetic start class (SSC) is, under
some circumstances, getting generated as matching locale even if there
is no locale matching in the regex. (This could not happen if the
design were as described in the footnote.) This shouldn't matter except
for potentially performance issues, as this would just be false
positives. However, it turns out there is code in the optimizer that
assumes that locale and non-locale are never mixed; and so does not do
the right thing.
This patch is aimed at safety. If the SSC is marked as locale, it sets
the bits for things like \w as if the SSC could also end up being for
non-locale. This can generate false positives for true locale matches
but shouldn't introduce actual optimizer errors, since it only adds to
what the SSC can match and doesn't make any restrictions.
* I don't see why this design; it seems to me easier to start with the
initial state set to all 0's, and then the first node gets OR'd in,
yielding exactly that first node; then you don't have to switch; you
still have to deal with AND cases, as for example in 0 length
lookaheads, but things are made easier.
Karl Williamson [Wed, 16 Mar 2011 17:58:04 +0000 (11:58 -0600)]
regcomp.c: white space only
Karl Williamson [Wed, 16 Mar 2011 17:49:48 +0000 (11:49 -0600)]
regcomp.c: \D and \d should work under locale
A number of earlier commits have fixed various places where the code
assumed that digits did not move under locale. This adds another two,
bringing the code here in line with the other sequences like \w
Karl Williamson [Wed, 16 Mar 2011 16:32:39 +0000 (10:32 -0600)]
regcomp.c: no bitmap means no bitmap
The line before this line indicates that there is no bitmap, but it
didn't clear this flag that says that there may be. This was likely
a contributory bug to what
ac51e94be5daabecdeb0ed734f3ccc059b7b77e3
tried to fix, and was eventually fixed in
6f8d7d0df3e3141d61246e6b0a3db12ab1fd7f92.
Karl Williamson [Wed, 16 Mar 2011 16:31:08 +0000 (10:31 -0600)]
regcomp.c: Add comment
Jan Dubois [Thu, 17 Mar 2011 00:45:29 +0000 (17:45 -0700)]
Read Perl code on Windows in text mode by default.
We used to read Perl code in binary mode to make life easier for
ByteLoder to include binary data in a source file. To maintain the
illusion of text mode for the DATA handle the filehandle was
transformed from binary mode to text mode when the parser reached the
__END__ or __DATA__ tokens.
This however never worked correctly, as the positions returned by
tell(DATA) were still based on reading part of the stream in binary
mode. And even worse, flushing all filehandles before calling
system(), backticks, or fork() would actually reposition the DATA
filehandle incorrectly, so future reads from it returned the wrong
data.
http://rt.perl.org/rt3/Ticket/Display.html?id=28106 contains several
bug reports that are all related to this problem. The new t/io/data.t
file contains the failing code samples from those bugs.
This patch changes the default build option for Windows to text mode.
ByteLoader will have to deal with this internally, e.g. by rewinding
DATA and switching to binary mode itself.
Karl Williamson [Wed, 16 Mar 2011 16:23:41 +0000 (10:23 -0600)]
Add TODO tests for #85964
Craig A. Berry [Wed, 16 Mar 2011 02:46:05 +0000 (21:46 -0500)]
t/op/eval.t tweak for VMS due to record-oriented pipes.
Broken in
0d804ff61f3a2df265fee122d53e0463dac6f878.
Craig A. Berry [Wed, 16 Mar 2011 02:41:25 +0000 (21:41 -0500)]
Restore
ada6eeb82df60fbe63c781f1a102393fd56d104b.
which was clobbered by
149d510d6e1a1cffb86aac23789fcb26ff67ffa9,
and is still awaiting upstream integration at:
https://rt.cpan.org/Ticket/Display.html?id=64353
Nicholas Clark [Wed, 16 Mar 2011 08:57:54 +0000 (08:57 +0000)]
Switch t/lib/no_load.t to done_testing() from using an explicit plan.
Using done_testing() means that it doesn't have to parse the test data
structure twice - firstly to calculate the number of tests, secondly to
actually run them.
Nicholas Clark [Tue, 15 Mar 2011 20:45:40 +0000 (20:45 +0000)]
Convert the remainder of t/op/closure.t to test.pl
Nicholas Clark [Tue, 15 Mar 2011 20:06:34 +0000 (20:06 +0000)]
Convert the middle test loops of closure.t to test.pl
The nested loops build tap-generating test programs, spawn them, capture their
output, directly print the output, and also run a rudimentary pass of it to
look for /not ok/, or anything on STDERR. Retain the same structure, and retain
the existing spawning code which (a) works and (b) has comments about being
careful to avoid problems with redirection and inherited STD*, but switch to
using test.pl in the test programs, giving each test an identifying
description, and better diagnostics if anything fails.
Nicholas Clark [Tue, 15 Mar 2011 17:23:53 +0000 (17:23 +0000)]
Convert the last third of t/op/closure.t to test.pl
closure.t's test function has a prototype of &, so all the blocks passed to it
may well be closures themselves, albeit simple ones over the outer lexicals of
the test script. However all of the tests are explicitly testing other
closures, systematically building up from these most simple behaviours, so
this is a side effect of the implementation, and removing it is not going to
leave particular behaviours untested. It may actually make the test more
robust, as particular closure bugs accidentally introduced will only cause
their tests to fail, instead of having the side effect of causing seemingly
unrelated tests to fail too.
Jan Dubois [Tue, 15 Mar 2011 23:53:00 +0000 (16:53 -0700)]
Hang on to child handle after signalling SIGTERM
This is a refinement of commit
3aa0ac5aa. We still want to hang on
to the mapping between pseudo-process and thread handle, so that we
can still waitpid() after signalling SIGTERM. We just don't want to
wait implicitly on the signalled process anymore.
Jan Dubois [Tue, 15 Mar 2011 19:34:10 +0000 (12:34 -0700)]
Don't wait for SIGTERM'ed forked children on Windows
SIGTERM may never get delivered when a thread/process is blocked in a
system call. To avoid a deadlock Perl will now no longer wait for
children to terminate after they have been signalled with SIGTERM.
Note: this *only* applies to fork() emulation on Windows. Read
pod/perlfork.pod for context on other limitation of this emulation.
Chris 'BinGOs' Williams [Tue, 15 Mar 2011 16:47:47 +0000 (16:47 +0000)]
Update Pod-Simple to CPAN version 3.16
[DELTA]
2011-03-14 David E. Wheeler <david@justatheory.org>
* Release 3.16
Fixed invalid HTML generated for nested lists by Pod::Simple::XHTML
(Fitz Elliott).
Replaced the invalid "<nobr>" tag -- created for "S<>" -- with
'<span style="white-space: nowrap;">' (Fitz Elliott).
Fixed some nerbles in our own Pod (Michael Stevens)
Improved the "Minimal code" example in Pod::Simple::HTML. The key
is to use pase_file(), not parse_from_file() (which should
otherwise be undocumented, and is just there for Pod::Parser
compatibility. Thanks to prodding from Ævar Arnfjörð Bjarmason (RT
#65428).
Added the html_charset() and html_encode_chars() attributes to
Pod::Simple::XHTML. Inspired by a bug report from Agent Zhang
(章亦春) (RT #29587).
Added "Minimal code" example to the Pod::Simple::XHTML documentation.
Fixed mispelling of the "=encoding" markup in the parser (it was
spelled "=encode"). Thanks to "TTY" for the patch. (RT #24820).
Nicholas Clark [Tue, 15 Mar 2011 15:14:28 +0000 (15:14 +0000)]
Convert t/op/oct.t's main tests to data structure and loops.
This will make it easier to test that expected warnings are generated. However,
parts of the existing perl code would generate warnings if warnings were
enabled, as it seems that the source code literals used are also intended as
tests for edge cases in the parser.