summaryrefslogtreecommitdiff
path: root/t
Commit message (Collapse)AuthorAgeFilesLines
* Update META files and remove blead customizations following previous commitSteve Hay2014-03-061-2/+0
| | | | | | (The customizations were added to "fix" failures caused by the previous upgrade of CPAN::Meta. This upgrade reverts the offending parts, so those "fix"es can now be reverted too.)
* Temporary fixes for test failures after (Parse::)CPAN::Meta upgradesSteve Hay2014-03-051-0/+2
|
* make OP_AELEMFAST work with negative indicesDavid Mitchell2014-02-281-1/+44
| | | | | | | | | | Use aelemfast for literal index array access where the index is in the range -128..127, rather than 0..255. You'd expect something like $a[-1] or $a[-2] to be a lot more common than $a[100] say. In fact a quick CPAN grep shows 66 distributions matching /\$\w+\[\d{3,}\]/, but "at least" 1000 matching /\$\w+\[\-\d\]/. And most of the former appear to be table initialisations.
* Update CPAN-Meta-YAML to CPAN version 0.012Chris 'BinGOs' Williams2014-02-251-1/+0
| | | | | | | | | | Includes cc53c151 fix for VMS [DELTA] 0.012 2014-02-24 13:07:18-05:00 America/New_York - Generated from ETHER/YAML-Tiny-1.61.tar.gz
* Fix RT #121321 - Fencepost error causes infinite loop in regex compilationYves Orton2014-02-251-0/+12
| | | | | | | | | | Due to a fencepost error if a pattern had more than 9 capture buffers and after the last capture buffer there was an octal style escape which when interpreted as decimal evaluated to one more than the number of defined buffers then the regex compiler would go into an infinite loop. This fixes the fencepost error, adds tests, and adds some comments to explain what is going on.
* fix RT #121299 - Inconsistent behavior with backreferences nested inside ↵Yves Orton2014-02-241-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | subpattern references Match variables should be dynamically scoped during GOSUB and GOSTART. The callers state should be inherited by the callee, but once the callee returns, the callers state should be restored. This is different from EVAL, where the callers and callees state are expected to not be the same (although might be the same), and where the "reasonable" match semantics differ. Currently the following two one liners will produce different results: $ ./perl -Ilib -le'"<ab><>>" =~/ < (?: \1 | [ab]+ ) (>) (?0)? /x and print $&;' <ab><>> $ ./perl -Ilib -le'$qr= qr/ < (?: \1 | [ab]+ ) (>) (??{ $qr })? /x; "<ab><>>" =~ m/$qr/ and print $&;' <ab> While I think reasonable people could argue that we should special case things when we know that the return from (??{ ... }) is the same as the currently executing pattern I think explaining the difference would be harder than necessary. On the contrary making GOSUB/GOSTART exactly the same as EVAL, so that the match vars were totally independent seems to throw away an opportunity for much more powerful semantics than can be offered by EVAL.
* test nit in CPAN-Meta-YAML/t/31_local_tml.tCraig A. Berry2014-02-231-2/+1
| | | | | | | | | | Directories on VMS have a .DIR extension. This test appears to be constructing method names from directory names, so we need to trim off the extension to get it to pass. Awaiting upstream application at: https://rt.cpan.org/Public/Bug/Display.html?id=93297
* [perl #120939] at least fix the leak in const_av_xsubTony Cook2014-02-211-1/+5
|
* Change 'semantics' to 'rules'Karl Williamson2014-02-201-1/+1
| | | | | | The term 'semantics' in documentation when applied to character sets is changed to 'rules' as being a shorter less-jargony synonym in this case. This was discussed several releases ago, but I didn't get around to it.
* run/locale.t: White-space onlyKarl Williamson2014-02-191-1/+1
| | | | Align a column
* locale.c: Another POSIX emulation fix on WindowsKarl Williamson2014-02-191-1/+15
| | | | | | Right after I pushed the previous commit, I realized that the system default locale on Windows should also have lower priority (besides LANG) than the LC_foo environment variables. This should do that.
* perlootut: replace Object::Tiny with Class::TinyDavid Golden2014-02-191-1/+2
| | | | | | | | | Class::Tiny is similarly small and simple in API, but with more powerful features available. Comparison to Object::Tiny and Class::Accessor is here: https://metacpan.org/pod/Class::Tiny#RATIONALE At mst's suggestion, a link to Class::Tiny::Antlers for Moose-syntax is included.
* Fix pod errorsKarl Williamson2014-02-181-1/+0
|
* [perl #120936] op/taint.t handling of no ipcsysv on cygwinTony Cook2014-02-181-4/+14
| | | | | | | | shmget() and msgget() produce a SIGSYS on cygwin if cygserver isn't running, crashing op/taint.t. Perform similar checks to those done in io/shm.t to make sure these are handled gracefully.
* test.pl uses skip_all(...), not plan(skip_all => ...)Tony Cook2014-02-181-2/+2
| | | | | This was causing noise on cygwin systems that don't have cygserver running.
* PATCH [perl #121257] blead fails at run/locale.tKarl Williamson2014-02-161-1/+2
| | | | | | | | | | Commit 65ebb05984db179833ff252f547043f32184d893changed the locale initialization code to look at the LANG environment variable as a fallback if there was a problem with a higher priority variable. Thus, when trying to have an empty environment for testing, one now needs to cause LANG to be unset, which wasn't the case before..This commit adds that unset to the test that needs an empty environment.
* t/run/locale.t: Fix skip countKarl Williamson2014-02-161-2/+2
| | | | | | This skipped the wrong number of tests on platforms that don't have a locale whose decimal radix character isn't a dot. (e.g. no locales with a comma).
* [perl #121255] Call set-magic when setting $DB::subFather Chrysostomos2014-02-161-1/+23
| | | | | | Otherwise UTF8 length caches will not be reset, resulting in panicks when ${^UTF8CACHE} is -1 or wrongs answers from length($DB::sub) when ${^UTF8CACHE} is 1.
* Revert "Free up bit for regex ANYOF nodes"Karl Williamson2014-02-151-1/+1
| | | | | This reverts commit 34fdef848b1687b91892ba55e9e0c3430e0770f6, and adds comments referring to it, in case it is ever needed.
* Free up bit for regex ANYOF nodesKarl Williamson2014-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit frees up a bit by using an extra regnode to pass the information to the regex engine instead of the flag. I originally thought that if this was needed, it should be the ANYOF_ABOVE_LATIN1_ALL bit, as that might speed some things up. But if we need to do this again by adding another node to get another bit, we want one that is mutually exclusive of the first one we did, For otherwise we start having to make 3 nodes instead of two to get the combinations: 1 0 0 1 1 1 This combinatorial problem is avoided by using bits that are mutually exclusive, which the ABOVE_LATIN1_ALL isn't, but the one freed by this commit ANYOF_NON_UTF8_NON_ASCII_ALL is only set under /d matching, and there are other bits that are set only under /l, so if we need to do this again, we should use one of those. I wrote this code when I thought I really needed a bit. But since, I have figured out a better way to get the bit needed now. But I don't want to lose this code to posterity, so this commit is being made long enough to get the commit number, then it will be reverted, adding comments referring to the commit number, so that it can easily be reconstructed when necessary.
* t/test.pl: Don't read uninitialized variableKarl Williamson2014-02-151-1/+1
| | | | | Commit 97dffe50643dd18f87b33b7ec6f8b55bbfd1fd74 introduced an attempt to access an unitialized hash value.
* t/run/locale.t: Fix SKIP end positionKarl Williamson2014-02-151-3/+1
| | | | | On the platforms where this skip gets engaged, it would have skipped too much
* Improve fallback during locale initializationKarl Williamson2014-02-151-2/+41
| | | | | | | | | | | | | If Perl encounters a problem during startup trying to initialize the locales from the environment it has immediately reverted to the "C" locale. This commit generalizes that so it tries each of the applicable environment variables in order of priority until it works, or it gives up and uses the "C" locale. For example, if LC_ALL is set to something that is invalid, but LANG is valid, LANG will be used. This was motivated by trying to get the Windows system default locale used in preference to "C" if all else fails.
* t/test.pl: Add option to runperl to suppress STDERRKarl Williamson2014-02-151-2/+8
|
* [perl #121242] Fix crash in gp_free when gv is freedFather Chrysostomos2014-02-151-1/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 4571f4a caused the gp to have a refcount of 1, not 0, in gp_free when the contents of the glob are freed. This makes gv_try_downgrade see the gv as a candidate for downgrading in this example: sub Fred::AUTOLOAD { $Fred::AUTOLOAD } undef *{"Fred::AUTOLOAD"}; When the glob is undefined, the sub inside it is freed, and the gvop ($Fred::AUTOLOAD), when freed, tries to downgrade the glob (*Fred::AUTOLOAD). Since it is empty, it deletes it completely from the containing stash, so the GV is freed out from under gp_free, which is still using it, causing an assertion failure. We can trigger a similar condition more explicitly: $ ./miniperl -e 'DESTROY{delete $::{foo}} ${"foo"} = bless []; undef *{"foo"}' This bug is nothing new. On a non-debugging 5.18.2, I get this: $ perl5.18.2 -e 'DESTROY{delete $::{foo}} ${"foo"} = bless []; undef *{"foo"}' Attempt to free unreferenced glob pointers at -e line 1. Segmentation fault: 11 That crashes in pp_undef after the call to gp_free, becaues pp_undef continues to manipulate the GV. The problem occurs not only with pp_undef, but also with other func- tions calling gp_free: sv_setsv_flags: $ ./miniperl -e 'DESTROY{delete $::{foo}} ${"foo"} = bless []; *{"foo"}="bar"' glob_assign_glob: $ ./miniperl -e 'DESTROY{delete $::{foo}} ${"foo"} = bless []; *{"foo"}=*bar' sv_unglob, reached through various paths: $ ./miniperl -e 'DESTROY{delete $::{foo}} ${"foo"} = do {local *bar}; $${"foo"} = bless []; ${"foo"} = 3' $ ./miniperl -e 'DESTROY{delete $::{foo}} ${"foo"} = do {local *bar}; $${"foo"} = bless []; utf8::encode(${"foo"})' $ ./miniperl -e 'DESTROY{delete $::{foo}} ${"foo"} = do {local *bar}; $${"foo"} = bless []; open bar, "t/TEST"; ${"foo"} .= <bar>' $ ./miniperl -e 'DESTROY{delete $::{foo}} ${"foo"} = do {local *bar}; $${"foo"} = bless []; ${"foo"}++' $ ./miniperl -e 'DESTROY{delete $::{foo}} ${"foo"} = do {local *bar}; $${"foo"} = bless []; undef ${"foo"}' $ ./miniperl -e 'DESTROY{delete $::{foo}} ${"foo"} = 3; ${"foo"} =~ s/3/${"foo"} = do {local *bar}; $${"foo"} = bless []; 4/e' And there are probably more ways to trigger this through sv_unglob. (I stopped looking when I thought of the fix.) This patch fixes the problem by protecting the GV using the mortals stack in functions that call gp_free. I did not change gp_free itself, since it is an API function that as yet does not touch the mortals stack, and I am not sure that should change. All of its callers that this patch touches already do sv_2mortal in some cir- cumstances.
* re_intuit_start(): fix SEGV in /^../m codeDavid Mitchell2014-02-141-0/+4
| | | | | | | | | | | | | | RT #121248 Part of my recent refactoring of the code in re_intuit_start() - the bit that searches for \n's in /^../m patterns (d0880ea) - introduced a segfault, due to the count arg of memchr() going negative. This is due to the stclass code (which I haven't refactored yet) incrementing rx_origin beyond the last point it could match, then jumping back to the MBOL block. In theory the stclass block should be fixed, but until I get round to that, I've just added a test to the MBOL block instead.
* perldelta.pod: Fix broken linksKarl Williamson2014-02-131-1/+1
| | | | | See commit b3a2acfa0c0e4f8e48e1f6eb4d6fd143f293d2c6 and http://markmail.org/message/x2sr55ekvos5k6wc
* Make sure that tempfile() in t/test.pl removes the temp filesBrad Gilbert2014-02-131-0/+15
| | | | | Run a program within t/test_pl/tempfile.t that uses tempfile() to make sure that the temp file is removed when the tests are done.
* Add register_tempfile() to t/test.plBrad Gilbert2014-02-132-1/+26
| | | | | | | | This convenience function causes files to be removed in the same way that tempfile() does. It uses the same variable that tempfile() does, to catch and warn on any collisions.
* Test that tempfile() in t/test.pl skips files that already existBrad Gilbert2014-02-131-1/+12
|
* Improve error diagnostics in t/test_pl/tempfile.tBrad Gilbert2014-02-131-2/+6
| | | | Tony: add a missing local
* Update Module-Build to CPAN version 0.4205Chris 'BinGOs' Williams2014-02-091-1/+1
| | | | | | | | | | | | | | | | [DELTA] 0.4205 - Sun Feb 9 17:51:22 CET 2014 [BUG FIXES] - FIX license code regression for artistic license [Roy Ivy III, Leon Timmermans] - Don't swallow ExtUtils::CBuilder loading errors [Matthew Horsfall, Leon Timmermans] - Handle testing on cross-compile builds [Brian Fraser] - Protect against platforms without getpw{nam,uid} [Brian Fraser]
* Use ‘an’ for $/=[] error messageFather Chrysostomos2014-02-091-1/+3
| | | | | | | | | | | | | | This says ‘an ARRAY’: $ perl -Mstrict -e '@{"a"}' Can't use string ("a") as an ARRAY ref while "strict refs" in use at -e line 1. This says ‘a ARRAY’: $ ./miniperl -e '$/=[]' Setting $/ to a ARRAY reference is forbidden at -e line 1. It ought to say ‘an’.
* [perl #120374] Stop for($h{k}||'') from vivifyingFather Chrysostomos2014-02-091-2/+15
| | | | | | | | | | | | | | | | | | Commit 2e73d70e52 broke this (made it vivify) by propagating lvalue context to the branches of || and && (to fix another bug). It broke App::JobLog as a result. Because foreach does not do defelem magic (i.e., it vivifies), this ends up extending vivification to happen where it did not before. Fixing foreach to do defelem magic (create ‘deferred element’ scalars, the way sub calls do, to avoid vivifying immediately) would be another way to fix this, but it is controversial. See ticket #2166. So, if either argument to || (or &&) is a vivifying op, don’t propa- gate the lvalue context, unless this is the return value of an lvalue sub (necessary for if/else with implicit return to work correctly in lvalue subs).
* re_intuit_start(): don't decrease other_lastDavid Mitchell2014-02-081-1/+5
| | | | | | | | | | | | | | | | The /^../m failure code did an unconditional other_last = rx_origin; if other_last was already high, it could get shrunk and we'd end up running fbm over the same bit of string repeatedly. The following code $s = "-ab\n" x 500_000; $s .= 'abx'; $s =~ /^ab.*x/m; (which went quadratic on length) reduces from minutes to millisecs with this commit. This is because we'd keep going back to near the beginning of the string and searching for 'x' again.
* re_intuit_start(): don't decrease rx_originDavid Mitchell2014-02-081-1/+7
| | | | | | | | | | | | | When calculating the new rx_origin after a successful check match, don't set it to a lower value than it already is. This can avoid having to do repeated HOP(check_at, -max_offset) over the same section of string, which makes the following take milliseconds rather than 10's of seconds: $s = "-a-bc" x 250_000; $s .= "1a1bc"; utf8::upgrade($s); $s =~ /\da\d{0,30000}bc/ or die;
* re_intuit_start(): fix another utf8 slowdownDavid Mitchell2014-02-071-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code that looks for a floating substr after a fixed substr has already been found, was very slow on long utf8 strings. For example this used to take an hour or more, and now takes millisecs: $s = "ab" x 1_000_000; utf8::upgrade($s); $s =~ /ab.{1,2}x/; When calculating the maximum position at which the floating substr could start, there are two possible upper limits. First, the absolute max position, ignoring the results of the previous fixed substr match - this is the end-of-string less a bit (last1); Second, float_max_offset on from the current origin of the regex (this is dependent on where the fixed substr previously matched). To decide which of these two values to use (the smaller), it used to calculate the distance in chars from the regex origin to last1, and if this was greater than float_max_offset, it used origin + float_max_offset (in chars) instead. This distance calculation involved doing a utf8 length calculation on the majority of the string, which for long strings was a big slowdown. Fix this by instead always using HOP3(origin + float_max_offset), but using last1 as the upper HOP limit rather than strend, so it's always limited to <= last1. If L is number of chars that had to be hopped over for the distance calculation (which could be most of the string), and if M is the chars hopped for origin + float_max_offset (typically either small or infinite), then we: previously hopped: (M>=L ? L : L+M) chars now hop: min(L,M) chars; or if M is infinite, hop 0 chars Which is always less than or equal to the amount of work done previously, and is a very big win for long strings with smallish maximum float offsets.
* test for single-line ^ within /mDavid Mitchell2014-02-071-0/+3
| | | | | | | | | This combo doesn't appear to be tested anywhere; specifically, adding this in re_intuit_start() didn't trigger the assertion when run against the test suite: if (prog->extflags & RXf_ANCH_BOL) assert(!multiline);
* RT#120692 slow intuit with long utf8 stringsDavid Mitchell2014-02-072-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | Some code in re_intuit_start() that tries to find the range of chars to which the BM substr find can be applied, uses logic that is very inefficient once utf8 was enabled. Basically the code tries to find the maximum end-point where the substr could be found, by taking the minimum of: * start + prog->check_offset_max + length(substr) * end - prog->check_end_shift Except that these values are in char lengths and need to be converted to bytes before calling fbm_instr(). The code formerly involved scanning the whole of the remaining string to determine how many chars it had. By doing the calculation a different way, we can avoid this. This makes the following two regexps each take milliseconds rather than 10s of seconds: my $s = 'ab' x 1_000_000; utf8::upgrade($s); 1 while $s =~ m/\Ga+ba+b/g; $s=~ /^a{1,2}x/ for 1..10_000;
* regcomp utf8 len cache panicDavid Mitchell2014-02-071-0/+4
| | | | | | | | | | | | | | | | | Compiling this regex: /\x{100}[xy]\x{100}{2}/ caused this: panic: sv_len_utf8 cache 1 real 2 This was due to the code in S_study_chunk() mixing up char and byte lengths when updating the utf8 length cache on a utf8 string that had been extended by repeatedly duplicating the last n chars. (The second test is for an issue introduced during an initial attempt to fix this).
* merge basic zefram/purple_signatures into bleadZefram2014-02-063-4/+1327
|\
| * more tests for signaturesZefram2014-02-021-1/+71
| |
| * more torture tests for signaturesZefram2014-02-011-1/+145
| | | | | | | | Based on tests supplied by Robert 'phaylon' Sedlacek.
| * Merge blead into zefram/purple_signaturesZefram2014-02-017-10/+27
| |\
| * | subroutine signaturesZefram2014-02-013-4/+1113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Declarative syntax to unwrap argument list into lexical variables. "sub foo ($a,$b) {...}" checks number of arguments and puts the arguments into lexical variables. Signatures are not equivalent to the existing idiom of "sub foo { my($a,$b) = @_; ... }". Signatures are only available by enabling a non-default feature, and generate warnings about being experimental. The syntactic clash with prototypes is managed by disabling the short prototype syntax when signatures are enabled.
* | | t/run/locale.t: Rmv test that isn't generally validKarl Williamson2014-02-061-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The return from setlocale() on a new locale is documented in Linux as opaque, even though the Linux smokers we have return the name of the new locale. It turns out that VMS actually does return something different, and this test fails there. So, the test is testing for something that just happens to be currently true on many of our systems; hence isn't general, and hence shouldn't be tested for. And, the test isn't necessary, as we can infer from the other tests in the file that a locale passed via the environment actually takes hold, as we do so for a locale which has a comma radix, and test that the radix is correctly set.
* | | Make a literal "{" fatal after \b and \B in regexesKarl Williamson2014-02-051-2/+2
| | | | | | | | | | | | These have been deprecated since v5.14.
* | | Add testsKarl Williamson2014-02-052-1/+9
| | | | | | | | | | | | These are for commit 421e43ba3017755892f18a5690b66a6ed8717fa9
* | | Fix more tests to work on systems that don't define LC_ALL and friendsBrian Fraser2014-02-053-3/+4
| | |
* | | Forbid "\c{" and \c{non-ascii}Karl Williamson2014-02-051-7/+9
| | | | | | | | | | | | | | | These constructs have been deprecated since v5.14 with the intention of making them fatal in 5.18. This wasn't done; and is being done now.