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.
Nicholas Clark [Tue, 15 Mar 2011 14:23:16 +0000 (14:23 +0000)]
Convert t/op/oct.t to using test.pl for comparisons and diagnostics.
This eliminates the hard-coded test numbers, which will allow the tests to
be re-ordered.
Nicholas Clark [Sun, 13 Mar 2011 21:45:16 +0000 (21:45 +0000)]
Don't set $ENV{PERL5LIB} in t/op/{anonsub,fork}.t as it isn't needed.
Nicholas Clark [Mon, 14 Mar 2011 20:02:36 +0000 (20:02 +0000)]
Bring the joy of strict (and warnings) to t/op/method.t
Father Chrysostomos [Mon, 14 Mar 2011 19:46:56 +0000 (12:46 -0700)]
perldelta up to b38b314
Nicholas Clark [Mon, 14 Mar 2011 19:05:40 +0000 (19:05 +0000)]
Convert the remainder of t/op/eval.t to test.pl
In places this involves decoupling the control flow from the output of test
diagnostics to STDOUT. It reduces the line count by 25%, and should give
better diagnostics on failure.
Nicholas Clark [Mon, 14 Mar 2011 15:07:12 +0000 (15:07 +0000)]
In t/op/eval.t, move logic from a spawned program into the main test script.
This also allows a chunk of it to be removed. There's no need inside a spawned
script to
a: dup STDERR so that it can be restored
b: open STDERR to a temporary file
c: call Devel::Peek::Dump
d: close the temporary file
e: restore STDERR
f: open it for reading
g: manipulate the contents
h: return ok/not ot
when instead we can run step 'c' only, with STDERR captured, perform step 'g'
only in the main script, and finish with an is() test instead of an ok()
This also saves having to substitute a generated temporary filename into the
code for the spawned script.
[Collateral "damage" is converting the next test to use test.pl's is()]
Karl Williamson [Mon, 14 Mar 2011 16:25:09 +0000 (10:25 -0600)]
utf8_heavy.pl: Use CORE:: case function overridden
Because an overridden case changing function may end up calling this
routine, it's better to use the CORE:: to avoid a recursive call
Chris 'BinGOs' Williams [Mon, 14 Mar 2011 16:57:16 +0000 (16:57 +0000)]
Resolved RT #59511 for Module::CoreList
Silenced the 'Can't call method "isa" without a package or object reference'
warnings for the functions.
David Mitchell [Mon, 14 Mar 2011 16:04:59 +0000 (16:04 +0000)]
[perl #82250] fix tainted (s)print format
commit
20ee07fbbcfa6be9f90bb8e5474a4d69d7396617
introduced dieing in (s)printf when the format is tainted;
however it only worked when the format is part of an expression
(because TAINT_PROPER checks for PL_tainted being set).
Fix by doing TAINT_PROPER only after get magic has been done on the format
SV (which will set PL_tainted). This is done by moving the checks in
pp_sprintf and pp_prtf into do_sprintf() (which is called by the two pp
functions).
Karl Williamson [Mon, 14 Mar 2011 15:18:28 +0000 (09:18 -0600)]
regcomp.c: utf8 pattern implies uni rules
This fixes a regression introduced with charset regex modifiers. A utf8
pattern without a charset is supposed to mean unicode semantics. But
it didn't until this patch.
Nicholas Clark [Mon, 14 Mar 2011 11:29:19 +0000 (11:29 +0000)]
Convert t/re/regexp_unicode_prop.t to using test.pl's functions for testing.
Nicholas Clark [Mon, 14 Mar 2011 11:03:55 +0000 (11:03 +0000)]
Convert the remainder of t/op/numconvert.t to test.pl, strict and warnings.
Nicholas Clark [Mon, 14 Mar 2011 09:00:44 +0000 (09:00 +0000)]
Convert t/re/subst_amp.t to test.pl, strict and warnings.
This reduces the line count by about 25%.
Also, remove the unneeded code to load Config, which is never referenced.
Nicholas Clark [Sun, 13 Mar 2011 17:58:29 +0000 (17:58 +0000)]
Add a test to ensure that test.pl doesn't mention $&
This will allow it to be used safely for tests that explicitly want to test the
behaviour of perl without (and with) $& having been seen by the parser.
Father Chrysostomos [Mon, 14 Mar 2011 05:28:46 +0000 (22:28 -0700)]
perlop: Mention the s///le special case
This is apparently undocumented except in perldiag and a previous
perldelta.
David Golden [Mon, 14 Mar 2011 00:53:57 +0000 (20:53 -0400)]
Update CPAN.pm to CPAN version 1.9600
Only blead-visible change from 1.94_65 are version numbers and
the addition of the 2011 PAUSE batch signing key.
Father Chrysostomos [Mon, 14 Mar 2011 00:26:27 +0000 (17:26 -0700)]
Nicholas Clark [Sun, 13 Mar 2011 23:18:58 +0000 (23:18 +0000)]
Refactor t/op/assignwarn.t to generate all the tested code from data structures
Nicholas Clark [Sun, 13 Mar 2011 21:33:25 +0000 (21:33 +0000)]
Convert t/op/anonsub.t to test.pl, strict and warnings.
test.pl no longer uses closures, which removes the principal reason for
avoiding it until now. anonsub.t is now 25% shorter.
Nicholas Clark [Sun, 13 Mar 2011 21:30:55 +0000 (21:30 +0000)]
In test.pl, avoid using a closure to capture warnings.
In the general case a closure is the "right" way to do "it". However, closures,
unlike local and regular subroutines, have some complexity at compile time,
which means that using closures in test.pl runs the risk of closure bugs
causing spurious hard to diagnose collateral damage to other tests. local is
already in use, and "has" to work for capturing warnings, as $SIG{__WARN__} is
localised already.
Nicholas Clark [Sun, 13 Mar 2011 19:08:57 +0000 (19:08 +0000)]
Convert t/re/reg_mesg.t to test.pl and strict.
This reduces its line count by 25%, with no loss of functionality.
(It actually tests slightly more, specifically that the regexps in @death don't
generate warnings, just die.)
Nicholas Clark [Sun, 13 Mar 2011 16:42:50 +0000 (16:42 +0000)]
Move t/re/reg_unsafe.t's test to a fresh_perl_is() inside pat_advanced.t
Add a passing variant which mentions $&. Note the bug number (#86042) in the
TODO test.
Nicholas Clark [Sun, 13 Mar 2011 15:49:50 +0000 (15:49 +0000)]
Convert t/re/reg_email.t to test.pl, strict and warnings.
Nicholas Clark [Sun, 13 Mar 2011 15:20:07 +0000 (15:20 +0000)]
In overload.t, move require './test.pl' into BEGIN to avoid stubbing subs.
Also move the use of strict and warnings after the BEGIN block, so that they
can take advantage of the @INC setting it performs. Swap to done_testing().
Nicholas Clark [Sun, 13 Mar 2011 15:16:15 +0000 (15:16 +0000)]
Convert t/op/magic.t to test.pl, strict and warnings.
Use ok() rather than the more "obvious" is(), cmp_ok() etc to strictly control
the number of accesses made to the passed in value. For example, is() accesses
its $got more than once, which defeats the purpose of this test.
Nicholas Clark [Sun, 13 Mar 2011 15:04:42 +0000 (15:04 +0000)]
Convert t/op/die_unwind.t to test.pl, strict and warnings.
Nicholas Clark [Sun, 13 Mar 2011 14:44:47 +0000 (14:44 +0000)]
Convert t/op/die_except.t to test.pl, strict and warnings.
David Leadbeater [Sun, 13 Mar 2011 13:26:18 +0000 (14:26 +0100)]
Remove the couple of references to AutoLoader that remained in
DynaLoader after
0a0b6c96e6.
Nicholas Clark [Sun, 13 Mar 2011 14:08:36 +0000 (14:08 +0000)]
Convert t/op/do.t to test.pl, strict and warnings.
Also use tempfile(), rather than names derived from the process ID.
Nicholas Clark [Sun, 13 Mar 2011 13:19:29 +0000 (13:19 +0000)]
Convert t/op/pwent.t to test.pl, strict and warnings.
Move most of the logic for "hunt the password data" out of the BEGIN block, as
it has no special reason to be in one.
Nicholas Clark [Sun, 13 Mar 2011 12:50:14 +0000 (12:50 +0000)]
C<not> should be C<!> in pwent.t, to fix a precedence bug.
Fortunately the effects are mostly benign. There are two boolean conditions -
$where defined, and PerlIO available, making 4 possible combinations. As was,
the code was:
if (not defined $where && $Config{useperlio} eq 'define') {
...
if (-x '/usr/bin/dscl') {
...
if (open (PW, '<', \$data)) {
$where = ...;
would enter the first if block for 3 out of 4 possibilities, skipping only if
*both* $where as defined *and* PerlIO was available. This was not the intent.
However, if PerlIO is unavailable, then the open will fail, $where won't be
set, and the logic continues on below, falling back to /etc/passwd
The intended logic is
if (!defined $where && $Config{useperlio} eq 'define') {
...
ie only enter on 1 of the 4 possibilities - skip unless $where was undefined
and PerlIO was available.
The net effect was that usually the behaviour was the same. The only difference
will be if PerlIO is not available (not the default, and rarely changed),
the password data *is* available from one of the services tested earlier, and
an /usr/bin/dscl executable is present.
In this case, the old code would have reached the open, which would have
failed, but would have closed PW as a side effect. However, because $where
would be defined, the fallback to /etc/passwd would not have been tried.
This would have caused the regression test to fail.
Also, the test C<$Config{useperlio} eq 'define'> is not quite correct, as
$Config{useperlio} will be undef if PerlIO is disabled, and the eq will warn.
Nicholas Clark [Sat, 12 Mar 2011 18:55:18 +0000 (18:55 +0000)]
In pwent.t, sanitise the logic for opening /etc/passwd, and calling skip_all()
It is now clearer what the code is doing when, and why.
Nicholas Clark [Sun, 13 Mar 2011 11:02:08 +0000 (11:02 +0000)]
Convert t/op/mydef.t to test.pl, strict and warnings.
Nicholas Clark [Sun, 13 Mar 2011 10:39:15 +0000 (10:39 +0000)]
In t/op/mydef.t, add missing C<eval> to a test.
As the test is for 'ne', it passes without the eval. However, the test's
description and surrounding code make it clear that it is a test for the
results of eval.
David Mitchell [Sat, 12 Mar 2011 22:01:26 +0000 (22:01 +0000)]
[perl #82111] de-pessimise some my @array = ...
Due to obscure closure and goto tricks, it's sometimes possible for the
array or hash in the LHS of 'my @a = ...' and 'my %h = ...' to be
non-empty. At compile-time, these conditions are detected and the assign
op is compiled with the OPpASSIGN_COMMON, making the assignment slower.
This commit speeds it up again by adding a run-time check to pp_aassign
to only do the OPpASSIGN_COMMON code-branch if the LHS isn't an empty
array or hash.
See also #70171.
Nicholas Clark [Sat, 12 Mar 2011 22:33:01 +0000 (22:33 +0000)]
Convert t/op/inc.t to test.pl and use strict.
Nicholas Clark [Sat, 12 Mar 2011 22:16:46 +0000 (22:16 +0000)]
Fix long-standing bug in t/op/inc.t, whereby ok() ignored a failed match.
Unlike test.pl and Test::More, the home-rolled ok() in t/op/inc.t didn't have
a prototype. Hence its arguments are in *list* context, meaning that any match
will return an *empty list* if it fails. Provided ok() was called with a
second, true, parameter, the failed match would not be noticed, because ok()
would register a test pass, because it would now be testing the (intended)
second parameter.
Add a prototype, and fix the logic for the tests affected.
Fortunately this wasn't concealing any bugs.
Nicholas Clark [Sat, 12 Mar 2011 21:37:58 +0000 (21:37 +0000)]
In t/op/inc.t, inline check_some_code() into its only call point.
Nicholas Clark [Sat, 12 Mar 2011 21:25:47 +0000 (21:25 +0000)]
In t/op/inc.t, reorder the parameters to check_some_code()
This allows the two (inner) loops that call it to be merged into one.
Swapping the (now merged) inner and outer loops will aid subsequent
refactoring.
Father Chrysostomos [Sat, 12 Mar 2011 22:14:17 +0000 (14:14 -0800)]
perldelta entries
Father Chrysostomos [Sat, 12 Mar 2011 20:52:35 +0000 (12:52 -0800)]
release_managers_guide.pod: Add Module::CoreList to perldelta
perl 5.13.6 to 5.13.10 did not include perldelta entries for
Module::CoreList.
Father Chrysostomos [Sat, 12 Mar 2011 20:56:12 +0000 (12:56 -0800)]
perlunicode: double space
David Leadbeater [Tue, 8 Mar 2011 21:49:54 +0000 (21:49 +0000)]
Switch Storable to IO::File from FileHandle, only load if needed
On blead IO::File would be autoloaded but can't rely on this as
Storable is dual life.
David Leadbeater [Tue, 8 Mar 2011 21:45:48 +0000 (21:45 +0000)]
Stop using AutoLoader in Storable
Storable isn't that large by today's standards; using AutoLoader
doesn't make much sense now. Although barely significant this shaves
about 1% off the execution time of the tests on my machine.
David Leadbeater [Tue, 8 Mar 2011 21:41:51 +0000 (21:41 +0000)]
Switch Storable to XSLoader from DynaLoader
Karl Williamson [Sat, 12 Mar 2011 19:37:40 +0000 (12:37 -0700)]
regcomp.c: /a should handle /\xdf/i same as /u
/a and /u should match identically case-insensitively, but they didn't.
Nor was /a being tested because it was thought that they handled things
identically, and the tests were already taking too long. So this adds
some tests as well.
Nicholas Clark [Sat, 12 Mar 2011 19:35:00 +0000 (19:35 +0000)]
Convert t/op/study.t to use test.pl, strict and warnings.
Replace its alarm_ok() with test.pl's watchdog().
Nicholas Clark [Sat, 12 Mar 2011 18:11:56 +0000 (18:11 +0000)]
Convert t/op/utf8cache.t to test.pl, strict and warnings.
Nicholas Clark [Sat, 12 Mar 2011 18:08:24 +0000 (18:08 +0000)]
skip_all_without_dynamic_extension() should accepted names containing ::s
Whilst the package separator is a double colon, config.sh ends up using a /
for the package separator, reflecting how, historically, extensions were
laid out in nested directories beneath ext/. The layout has changed, but the
convention in the config.sh entries, and hence the %Config::Config values,
remains the same.
Hence skip_all_without_dynamic_extension() needs to convert passed-in ::s to
/ before performing a lookup.
Nicholas Clark [Sat, 12 Mar 2011 17:44:59 +0000 (17:44 +0000)]
Rename test.pl's skip_all_without_extension to *_dynamic_extension().
All callers were using it with dynamic extensions, and also had a
skip_all_if_miniperl() for the same extension. Merge the two tests into one
function to save repetition.
Nicholas Clark [Sat, 12 Mar 2011 17:22:44 +0000 (17:22 +0000)]
Convert t/op/readdir.t to test.pl, strict and warnings.
Nicholas Clark [Sat, 12 Mar 2011 17:06:48 +0000 (17:06 +0000)]
Convert t/op/goto_xs.t to test.pl, strict and warnings.
Nicholas Clark [Fri, 11 Mar 2011 15:00:31 +0000 (15:00 +0000)]
Move pwent.t's test for NIS+ earlier, before the "fallback" of /etc/passwd
This seems a more logical place for it, on the assumptions that
a: only 1 of the 4 programs tried will produce results
b: Reading from /etc/passwd is intended as a fallback if none produce results.
Nicholas Clark [Fri, 11 Mar 2011 14:52:44 +0000 (14:52 +0000)]
In t/op/pwent.t, create try_prog() for the common 'try this command' logic.
Also refactor the clearing of $reason, without changing the behaviour of when
it is cleared (which is slightly less than logical.)
Nicholas Clark [Sat, 12 Mar 2011 16:32:08 +0000 (16:32 +0000)]
Add PERL_PRESERVE_IVUV to non_bincompat_options.
It's actually the default, but as all the C code is conditionally (not)
compiled on the basis of that pre-processor macro, seems that it is the one
that needs to be reported.
Yves Orton [Sat, 12 Mar 2011 16:21:54 +0000 (17:21 +0100)]
Fix RT #84294 /((\w+)(?{print $2})){2,2}/ problem
When we are doing a CURLYX/WHILEM loop and the min iterations is
larger than zero we were not saving the buffer state before each
iteration. This mean that partial matches would end up with strange
buffer pointers, with the start *after* the end point.
In more detail WHILEM has four exits, three of which as far as I could
tell would do a regcppush/regcppop in their state transitions, only one,
WHILEM_A_pre which is entered when (n < min) would not. And it is this state
that we repeatedly enter when performing A the min number of times.
When I made the logic similar to the handling of ( n < max ), the bug
went away, and as far as I can tell nothing else broke.
Review by Dave Mitchell required before release.
Yves Orton [Sat, 12 Mar 2011 16:17:22 +0000 (17:17 +0100)]
Add tests for RT #84294 /((\w+)(?{print $2})){2,2}/ problem
Original ticket reports:
print "Match: \$1=$1 \$2=$2" if 'ab' =~/^((\w+)(?{print defined $2 ? "\$2=$2\n" : "\$2 not defined\n"})){2}$/;
Produces the following incorrect output:
$2=ab
$2 not defined
$2=b
Match: $1=b $2=b
It should produce:
$2=ab
$2=a
$2=b
Match: $1=b $2=b
This adds a TODO test to verify this behavior.