This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Steve Hay [Wed, 3 Oct 2012 13:06:34 +0000 (14:06 +0100)]
Steve Hay [Tue, 2 Oct 2012 08:11:48 +0000 (09:11 +0100)]
Bump $ExtUtils::CBuilder::VERSION and add Changes entry for prelink() fix
Steve Hay [Tue, 2 Oct 2012 08:07:03 +0000 (09:07 +0100)]
Add missing Changes entries for ExtUtils-CBuilder per its README.patching
Eric Brine [Tue, 2 Oct 2012 02:30:04 +0000 (19:30 -0700)]
Allow a list of symbols to export to be passed to link() when on Windows, as on other OSes.
Father Chrysostomos [Tue, 2 Oct 2012 16:59:30 +0000 (09:59 -0700)]
Fix uninit warnings under old cow
Applying copy-on-write to pad names when generating uninitial-
ised warnings results in modifications to SvPVX(sv) after
sv_setsv(sv,padname) affecting the pad name as well. sv_setsv_flags
with no flags avoids the COW.
Under PERL_OLD_COPY_ON_WRITE and warnings, this:
my (@ma);
$v = sin $ma[1000];
$v = sin $ma[$$];
was producing this:
$ pbpaste|./miniperl -w
Use of uninitialized value $ma[1000] in sin at - line 2.
Use of uninitialized value within $ma in sin at - line 3.
If you comment out the sceond line:
$ pbpaste|./miniperl -w
Name "main::v" used only once: possible typo at - line 3.
Use of uninitialized value within @ma in sin at - line 3.
Notice the @ma/$ma difference.
The first uninit warning was modifying the pad name.
Father Chrysostomos [Tue, 2 Oct 2012 05:10:53 +0000 (22:10 -0700)]
Stop sv_force_normal from crashing on ro globs under old cow
This allows t/lib/universal.t to pass under PERL_OLD_COPY_ON_WRITE.
Jerry D. Hedden [Tue, 2 Oct 2012 22:58:32 +0000 (18:58 -0400)]
Upgrade to threads::shared 1.42
Father Chrysostomos [Tue, 2 Oct 2012 23:11:17 +0000 (16:11 -0700)]
Revert "Upgrade to threads::shared 1.42"
This reverts commit
34bd199a87daedeaeadd8e9ef48032c8307eaa94.
Jerry D. Hedden [Tue, 2 Oct 2012 19:33:01 +0000 (15:33 -0400)]
Upgrade to threads::shared 1.42
Father Chrysostomos [Tue, 2 Oct 2012 03:05:45 +0000 (20:05 -0700)]
perly.c: Disarm the YYDEBUG defines in perly.h
See <craigberry-E9C729.
16313730092012@cpc2-bmly6-0-0-cust974.2-3.cable.virginmedia.com>.
Move the YYDEBUG defines in perly.c back where they were before, but
undefine YYDEBUG first. That leaves bison 2.6’s YYDEBUG defines in
perly.h harmless.
Father Chrysostomos [Mon, 1 Oct 2012 22:55:54 +0000 (15:55 -0700)]
substr.t: Fix for substr_thr.t
I was putting tests below run_tests by mistake. When substr_thr.t is
run, the tests below run first. Any warnings they cause will make the
no warnings tests at the top of the script fail.
Father Chrysostomos [Mon, 1 Oct 2012 21:26:20 +0000 (14:26 -0700)]
Oops; fix threaded build
Father Chrysostomos [Mon, 1 Oct 2012 19:52:10 +0000 (12:52 -0700)]
[Merge] utf8 caches and overload; other bug fixes
I began by trying to fix the remaining issues in ticket #114410,
namely, overloading interacting badly with utf8 caching. I discovered
other bugs along the way (some of which touch on #114690 and #80190),
fixing them in the process.
The core no longer uses length magic on scalars. mg_length is depre-
cated (see its docs for why). The PERL_MAGIC_scalar vtable no longer
contains a length function, and Perl_magic_len is gone. mg_length has
been corrected always to return a byte count, as it did originally,
instead of characters for scalars without length magic and bytes
otherwise.
sv_pos_u2b and sv_len_utf8 now only store utf8 caches on non-magical
PVs. They used to cause bugs not only on tied and overloaded values,
but also typeglobs and non-overloaded references.
sv_or_pv_len_utf8 and sv_or_pv_pos_u2b are two new macros for calling
the non-_or_pv versions on muggle scalars and using the pv directly
for SvGMAGICAL scalars.
sv_len_utf8 now returns a character count, as documented, instead of
assuming that what is passed to it is utf8 (an unreliable assumption,
as the UTF8 flag is meaningful only *after* stringification, and
sv_len_utf8 stringifies).
length, pos, substr and sprintf now avoid triggering overloading or
ties too many times or reading the UTF8 flag at the wrong time, by
following one of these sequences:
If the scalar is going to be stringified:
• Call get-magic.
• Stringify the scalar in place.
• Check the UTF8 flag.
• Use the non-magical variants of the above functions:
sv_pos_u2b_flags without SV_GMAGIC, and sv_len_utf8_nomg.
If the scalar is not going to be modified:
• Call get-magic.
• Stringify the scalar without coercing it, and save the string.
• Check the UTF8 flag.
• Use sv_or_pv_ macros.
sysread, syswrite and pack no longer need to be as complicated any
more, now that sv_pos_u2b and sv_len_utf8 (and their _or_pv variants)
are more friendly, so they have been simplified.
utf8::encode now calls FETCH and STORE on tied variables. It stopped
calling fetch with the magic flags patch. It had never called STORE.
utf8::decode now calls STORE, too. It likewise had never called it.
This means it no longer preserves pos.
Father Chrysostomos [Mon, 1 Oct 2012 16:08:18 +0000 (09:08 -0700)]
Make sprintf "%1s" and "%.1s" call overloading once
Calling overloading multiple times can probably result in mangled
UTF8, but it is much easier just to test for the number of calls.
Father Chrysostomos [Mon, 1 Oct 2012 16:01:37 +0000 (09:01 -0700)]
sprintf{2,}.t: Explain why we have two test files
Father Chrysostomos [Mon, 1 Oct 2012 13:28:48 +0000 (06:28 -0700)]
pp_sys.c: Simplify uses of sv_len_utf8
sv_len_utf8 is now careful not to record caches on magical or over-
loaded scalars (any non-PV, in fact). It also returns the number of logical characters correctly, regardless of whether its input is utf8.
So we can take advantage of that to simplify pp_sysread.
For pp_syswrite, we can use sv_or_pv_len_utf8 with the existing
string buffer.
Father Chrysostomos [Mon, 1 Oct 2012 06:54:17 +0000 (23:54 -0700)]
pp_pack.c: Simplify sv length determination in one spot
sv_len_utf8 is now careful not to record caches on magical or over-
loaded scalars (any non-PV, in fact). It also returns the number of
logical characters correctly, regardless of whether its input is utf8.
So we can greatly simplify this code.
Father Chrysostomos [Mon, 1 Oct 2012 06:28:12 +0000 (23:28 -0700)]
Call overloading once for utf8 ovld→substr assignment
Father Chrysostomos [Sun, 30 Sep 2012 20:04:53 +0000 (13:04 -0700)]
Make substr assignment work with changing UTF8ness
Assigning to a substr lvalue scalar was invoking overload too
many times if the target was a UTF8 string and the assigned sub-
string was not.
Since sv_insert_flags itself stringifies the scalar, the easiest
way to fix this is to force the target to a PV before doing any-
thing to it.
Father Chrysostomos [Sun, 30 Sep 2012 07:07:47 +0000 (00:07 -0700)]
mg.c:magic_setsubstr: rmv redundante null check
This was added in commit
9bf12eaf4 to fix a crash, but it is not
necessary any more, due to changes elsewhere.
Father Chrysostomos [Sun, 30 Sep 2012 07:06:46 +0000 (00:06 -0700)]
Test #7678
This was fixed in
9bf12eaf4, but apparently never tested.
It used to crash, so no is() is necessary.
Father Chrysostomos [Sun, 30 Sep 2012 06:56:56 +0000 (23:56 -0700)]
Make rvalue substr call overloading once on utf8 str
Father Chrysostomos [Sun, 30 Sep 2012 06:31:44 +0000 (23:31 -0700)]
sv.c: One less assignment in sv_pvutf8n_force
This function always assigns to *lp twice (though indirectly the first
time). It only needs to do so once.
Father Chrysostomos [Sun, 30 Sep 2012 05:58:55 +0000 (22:58 -0700)]
Make 4-arg substr call FETCH once when upgrading target
Father Chrysostomos [Sat, 29 Sep 2012 18:27:35 +0000 (11:27 -0700)]
Make 4-arg substr check SvUTF8(target) after stringfying
If it checks the UTF8 flag first, it might be looking at a stale flag,
resulting in malformed UTF8. Both tests added produced malformed utf8
strings before this commit.
Simply moving this:
if (!DO_UTF8(sv))
sv_utf8_upgrade(sv);
after the stringification is not enough to fix this, as the string
retrieved will be out of date after we do an upgrade. To avoid
stringifying twice, we use SvPV_force if there is a replacement. This
means rearranging if() blocks a little.
The use of SvPV_force also means that string overloading is no longer
called twice on the target scalar. This rearrangement also means
that targets upgraded to utf8 are no longer exempt from the refer-
ence warning. (Oh, and the test for that warning was not testing any-
thing in its no warnings test, because the target was no longer a ref-
erence; so I corrected the test.)
Father Chrysostomos [Fri, 28 Sep 2012 21:47:05 +0000 (14:47 -0700)]
Remove length magic on scalars
It is not possible to know how to interpret the returned length
without accessing the UTF8 flag, which is not reliable until
the SV has been stringified, which requires get-magic. So length
magic has not made senses since utf8 support was added. I have
removed all uses of length magic from the core, so this is now
dead code.
Father Chrysostomos [Fri, 28 Sep 2012 21:13:33 +0000 (14:13 -0700)]
Update utf8.t tests
Recent commits made utf8::decode and utf8::encode call STORE on tied
variables. This also causes pos to be reset. This seems the right
thing to me, as these function actually change the content of the SV,
not just the internal representation.
Father Chrysostomos [Fri, 28 Sep 2012 21:01:53 +0000 (14:01 -0700)]
sv.c: Don’t cache utf8 length on gmagical SVs
The cache will just be invalidate on the next fetch. This commit avoids
extra work in those cases that are detectable. We still have to invali-
date caches in mg_get, because caches can be created while magic is
being called and SvMAGICAL is off.
Father Chrysostomos [Fri, 28 Sep 2012 20:44:48 +0000 (13:44 -0700)]
pp_length should stringify before checking DO_UTF8
Typeglobs and references can change their UTF8ness upon string-
ification.
Father Chrysostomos [Fri, 28 Sep 2012 16:56:01 +0000 (09:56 -0700)]
Only cache utf8 offsets for PVs
References and typeglobs can change their stringification without the
SV itself being assigned to.
Father Chrysostomos [Fri, 28 Sep 2012 15:42:47 +0000 (08:42 -0700)]
Make substr = $utf8 call get-magic once
Father Chrysostomos [Fri, 28 Sep 2012 15:40:53 +0000 (08:40 -0700)]
Make utf8::decode respect set-magic
Father Chrysostomos [Fri, 28 Sep 2012 15:34:51 +0000 (08:34 -0700)]
Make utf8::encode respect magic
It has always ignored set-magic, as far as I can tell.
Since the magic flags patch (
4bac9ae47b), it has been ignor-
ing get- magic on magical scalars that were already PVs.
sv_utf8_upgrade_flags_grow begins with an if(!SvPOK(sv)) check, which
used to mean ‘if this scalar is magic or not a string’, but now means
simply ‘if this scalar is not a string’. SvPOK_nog is the new SvPOK.
Due to the way the flags now work, I had to modify sv_pvutf8n_force
as well, to keep existing tests passing.
Father Chrysostomos [Fri, 28 Sep 2012 13:16:55 +0000 (06:16 -0700)]
sv.c:sv_pos_u2b: Don’t cache anything on magical SVs
This should not change the behaviour. It is just unnecessary to cache
positions on a magical string, as we then just have to invalidate the
cache in mg_get. It will be more efficient just not to create the
cache to begin with.
This does not allow us to remove the cache invalidation in mg_get,
because the cache can sometimes be created while magic is being called
and SvMAGICAL is off. It just avoids extra work in those cases that
are detectable.
Father Chrysostomos [Fri, 28 Sep 2012 12:52:53 +0000 (05:52 -0700)]
Make magic_setsubstr check UTF8 flag after stringification
By checking it before, it can end up treating a UTF8 string as bytes
when calculating offsets if the UTF8 flag is not turned on until
the target is stringified. This can happen with overloading and
typeglobs.
This is a regression from 5.14. 5.14 itself was buggy, too, but one
would have to modify the target after creating the substr lvalue but
before assigning to it; and that because of another bug fixed by
83f78d1a27, which was cancelling out this one.
package o {
use overload '""' => sub { $_[0][0] }
}
my $refee = bless ["\x{100}a"], o::;
my $substr = \substr $refee, -2;
$$substr = "b";
warn $refee;
That prints:
Wide character in warn at - line 7.
Āb at - line 7.
In 5.14 it prints:
b at - line 7.
Father Chrysostomos [Fri, 28 Sep 2012 12:52:36 +0000 (05:52 -0700)]
Stop substr lvalues from being confused by changing UTF8ness
Father Chrysostomos [Fri, 28 Sep 2012 04:29:33 +0000 (21:29 -0700)]
Stop pos from panicking when overloading changes UTF8ness
This touches on issues raised in tickets #114410 and #114690.
If the UTF8ness of an overloaded string changes with each call, it
will make magic_setpos panic if it tries to stringify the SV multiple
times. We have to avoid any sv-specific utf8 length functions when
it comes to overloading. And we should do the same thing for gmagic,
too, to avoid creating caches that will shortly be invalidated.
The test class is very closely based on code written by Nicholas Clark
in a response to #114410.
Father Chrysostomos [Thu, 27 Sep 2012 03:39:55 +0000 (20:39 -0700)]
Make sv_len_utf8 return a character count as documented
Brought up in ticket #114690.
sv_len_utf8 does not make sense. It assumes that the string is UTF-8.
If it is not, it just does the wrong thing. For magical variables, it
expects mg_length to return the number of characters, but it would
only sometimes do that until the previous commit, which restored it to
returning bytes for all scalars.
Since you have to know already that a string is in utf8 before you
can call sv_len_utf8, but sv_len_utf8 might call get-magic which will
change the utf8-ness, it really makes no sense as an API. Up till
now, it has been consistently buggy with any magic scalars.
So I have changed sv_len_utf8 to do exactly what the documentation
says: return the number of characters.
This also causes an existing buggy code path in sv_len_utf8_nomg to be
reached (SvCUR without checking SvPOK), so this fixes that too.
Father Chrysostomos [Thu, 27 Sep 2012 00:45:51 +0000 (17:45 -0700)]
sv.c: Document that sv_len sets the UTF8 flag
Father Chrysostomos [Wed, 26 Sep 2012 22:20:52 +0000 (15:20 -0700)]
Deprecate mg_length; make it return bytes
mg_length returns the number of bytes if a scalar has length magic,
but the number of characters otherwise.
sv_len_utf8 used to assume that mg_length would return bytes. The
first mistake was added in commit
b76347f2eb, which assumed that
mg_length would return characters. But it was #ifdeffed out until
commit
ffc61ed20e.
Later, commit
5636d518683 met sv_len_utf8’s assumptions by making
mg_length return the length in characters, without accounting for
sv_len, which also used mg_length.
So we ended up with a buggy sv_len that would return a character
count for scalars with get- but not length-magic, and a byte count
otherwise.
In the previous commit, I fixed sv_len not to use mg_length at all. I
plan shortly to remove any use of mg_length (the one remaining use is
in sv_len_utf8, which is currently not called on magical values).
The reason for removing all calls to mg_length is that the returned
length cannot be converted to characters without access to the PV as
well, which requires get-magic. So length magic on scalars makes no
sense since the advent of utf8.
This commit restore mg_length to its old behaviour and lists it as
deprecated. This is mostly cosmetic, as there are no CPAN users. But
it is in the API, and I don’t know whether we can easily remove it.
Father Chrysostomos [Wed, 26 Sep 2012 03:33:30 +0000 (20:33 -0700)]
Make pos less volatile when UTF8-ness can change
This was brought up in ticket #114690.
pos checks the length of the string and then its UTF8-ness. But the
UTF8-ness is not updated by length magic. So it can get confused if
simply stringifying a match var happens to flip the UTF8 flag:
$ perl -le '"\x{100}a" =~ /(..)/; pos($1) = 2; print pos($1); "$1";
print pos($1)'
2
1
$ perl -le '"\x{100}a" =~ /(.)/; pos($1) = 2; print pos($1); "$1"; print
pos($1)'
1
Malformed UTF-8 character (unexpected end of string) in match position
at -e line 1.
0
As pointed out in that ticket, length magic on scalars cannot work
properly with UTF8, so stop using it.
Jerry D. Hedden [Mon, 1 Oct 2012 13:12:58 +0000 (09:12 -0400)]
Upgrade to threads::shared 1.42
Father Chrysostomos [Mon, 1 Oct 2012 06:31:40 +0000 (23:31 -0700)]
APItest.xs: Fix mem leak in lexsub test
Though this is harmless, since the test script is short-lived, it is
good to fix it in case this test is copied by module authors.
Yves Orton [Sun, 30 Sep 2012 23:01:26 +0000 (01:01 +0200)]
Fix [perl #115050] Double empty sub-regexp makes "panic!"
Code failed to check if we had a non-zero (END) trietype, and
thus under certain circumstances would panic. We now check that
the trietype is non-zero.
Paul Johnson [Wed, 26 Sep 2012 00:44:45 +0000 (02:44 +0200)]
Suggest cause of error requiring .pm file.
Following on from a recent thread I've put together a patch to expand
the error message when a module can't be loaded. With this patch,
instead of:
Can't locate Stuff/Of/Dreams.pm in @INC (@INC contains: ...)
You get:
Can't locate Stuff/Of/Dreams.pm in @INC (you may need to install the Stuff::Of::Dreams module) (@INC contains: ...)
[The committer tweaked the error message,
based on a suggestion by Tony Cook. See
<https://rt.perl.org/rt3/Ticket/Display.html?id=115048#txn-1157750>.]
Father Chrysostomos [Sun, 30 Sep 2012 05:43:38 +0000 (22:43 -0700)]
Increase $warnings::VERSION to 1.15
Father Chrysostomos [Sun, 30 Sep 2012 05:43:09 +0000 (22:43 -0700)]
Increase $feature::VERSION to 1.31
Father Chrysostomos [Sun, 30 Sep 2012 05:39:37 +0000 (22:39 -0700)]
Use two colons for lexsub warning
Yves Orton [Sat, 29 Sep 2012 22:00:25 +0000 (00:00 +0200)]
Merge branch 'rt_115078' into blead
This is a no-op merge which fixes the problem reported in perl #115078
and at the same time includes some modest improvements in the code
generated in regcharclass.h.
Yves Orton [Sat, 29 Sep 2012 21:58:03 +0000 (23:58 +0200)]
remove test define from regen/regcharclass.pl
Yves Orton [Sat, 29 Sep 2012 21:57:10 +0000 (23:57 +0200)]
improve conditional folding logic in regen/regcharclass.pl
Yves Orton [Sat, 29 Sep 2012 21:01:25 +0000 (23:01 +0200)]
fix perl #115078, ternary folding logic failure
Yves Orton [Sat, 29 Sep 2012 20:55:13 +0000 (22:55 +0200)]
add a new define for testing perl #115078
We dont have any easy way to test regen/regcharclass.pl currently.
Perl #115078 is related to a bug in the _cleanup() routine which is
fixed with next patch.
Chris 'BinGOs' Williams [Sat, 29 Sep 2012 11:04:06 +0000 (12:04 +0100)]
Update CPANPLUS to CPAN version 0.9133
[DELTA]
This a version bump only
Changes for 0.9133 Sat Sep 29 11:49:02 2012
================================================
* Fix MANIFEST for last release
Changes for 0.9132 Sat Sep 29 11:40:53 2012
================================================
* Resolve RT #79925, Module::Metadata was missing
from inc/bundle. Reported by Steve Sanbeg
James E Keenan [Sat, 29 Sep 2012 00:37:00 +0000 (20:37 -0400)]
Add one test for ord('').
"perldoc -f ord" states that if ord()'s argument is an empty string, the
function returns 0. Demonstrating that this is so.
Colin Kuskie [Fri, 28 Sep 2012 04:43:34 +0000 (21:43 -0700)]
Refactor t/op/chars.t to use test.pl instead of making TAP by hand.
Aaron Crane [Fri, 28 Sep 2012 13:14:47 +0000 (14:14 +0100)]
[perl #20636] Make h2xs skip #define macros with empty rhs
Otherwise the generated C code uses such macros in expressions, which causes
compilation errors because the macro is expanded to an empty token list.
Jerry D. Hedden [Fri, 28 Sep 2012 15:51:56 +0000 (11:51 -0400)]
Document :shared and :unique in attributes.pm
Add documentation to attributes.pm for :shared and :unique, and bump version.
Steve Hay [Fri, 28 Sep 2012 08:12:07 +0000 (09:12 +0100)]
Bump $Carp::Heavy::VERSION too to avoid test failure from
858e29b93a
Steve Hay [Fri, 28 Sep 2012 08:02:31 +0000 (09:02 +0100)]
Remove option to build without USE_SOCKETS_AS_HANDLES on Windows
The option is always defined by default and can't be disabled from the
makefiles. Manually disabling it causes several tests to fail, which
nobody has reported, so we presume nobody does this. The non-default
configuration is believed to be historical cruft with no value now, and
has clearly bitrotted in recent years (hence the test failures), so
remove it to simplify the codebase slightly.
Tony Cook [Fri, 28 Sep 2012 06:25:05 +0000 (16:25 +1000)]
perldelta for
ed5044532 and
858e29b9 (Carp)
Tony Cook [Fri, 28 Sep 2012 06:22:44 +0000 (16:22 +1000)]
bump Carp version to 1.27
Tony Cook [Fri, 28 Sep 2012 05:51:40 +0000 (15:51 +1000)]
fix -DPERL_GLOBAL_STRUCT build failure introduced in
97b03d64 and
e10681aa
Ricardo Signes [Fri, 28 Sep 2012 02:27:18 +0000 (22:27 -0400)]
todo: strict as warnings
jkeenan [Fri, 27 Jul 2012 01:33:03 +0000 (21:33 -0400)]
Document exportable subroutines longmess() and shortmess().
Per recommendation by srezic in RT #114280.
James E Keenan [Thu, 27 Sep 2012 23:05:15 +0000 (19:05 -0400)]
Clarify rationale for consulting L<feature>.
For RT #90178.
Dominic Hargreaves [Thu, 27 Sep 2012 17:31:45 +0000 (18:31 +0100)]
Revert "Add 5.14.3-RC1 to perlhist"
RC releases shouldn't be in perlhist
This reverts commit
bfec0e075afbe1005446f328adda6fefd2dc88ee.
Karl Williamson [Thu, 27 Sep 2012 03:40:22 +0000 (21:40 -0600)]
perlreguts: Fit long verbatim lines to 79 cols
Karl Williamson [Thu, 27 Sep 2012 16:12:41 +0000 (10:12 -0600)]
mktables: Mention USourceData in generated pod
These files were included by Unicode for the first time in the final
version of its version 6.2. They document proposals for encoding
Han characters in Unicode. As far as I can tell, they have no real use
except to people working on such proposals. They are considered part of
the Unicode Character Database, however, and should be mentioned in
perluniprops as data that Perl ignores from that database.
Karl Williamson [Thu, 27 Sep 2012 16:12:06 +0000 (10:12 -0600)]
mktables: Nits in comments, generated pod
David Golden [Thu, 27 Sep 2012 15:08:09 +0000 (11:08 -0400)]
perlpolicy.pod: clarify module deprecation/removal
Jesse Luehrs [Thu, 27 Sep 2012 15:03:13 +0000 (10:03 -0500)]
move perlrun to a more prominent place in perl.pod
the list of command line options in the synopsis is really not very
useful without knowing what they mean, and listing perlrun way down in
the table of contents doesn't make it very easy to figure out what they
mean.
Karl Williamson [Thu, 27 Sep 2012 02:41:58 +0000 (20:41 -0600)]
Use official Unicode 6.2
Unicode 6.2 has been officially released, and is delivered by this
commit. There are no substantive changes from the final 6.2 beta, which
this replaces.
James E Keenan [Thu, 27 Sep 2012 00:15:30 +0000 (20:15 -0400)]
Eliminate now superfluous counter.
Colin Kuskie [Mon, 10 Sep 2012 02:08:55 +0000 (19:08 -0700)]
Refactor t/op/lex_assign.t to use test.pl, and not make TAP by hand.
Dominic Hargreaves [Wed, 26 Sep 2012 22:48:48 +0000 (23:48 +0100)]
Add 5.14.3-RC1 to perlhist
Nicholas Clark [Sun, 23 Sep 2012 20:48:42 +0000 (22:48 +0200)]
Flush PL_stashcache when assigning a file handle to a typeglob.
File handles take priority over stashes for method dispatch. Assigning a
file handle to a typeglob potentially creates a file handle where one did
not exist before. As PL_stashcache only contains entries for names which
unambiguously resolve to stashes, such a change may mean that PL_stashcache
now contains an invalid entry. As it's hard to work out exactly which entries
might be affected, simply flush the entire cache and let it rebuild itself.
Nicholas Clark [Sun, 23 Sep 2012 20:21:14 +0000 (22:21 +0200)]
Restore use of PL_stashcache, the stash name lookup cache for method calls.
Commit
da6b625f78f5f133 in Aug 2011 inadvertently broke the code that looks
up values in PL_stashcache. As it's a only cache, quite correctly everything
carried on working without it.
Restoring it re-introduces two bugs first introduced when PL_stashcache was
added, by commit
081fc587427bbcef in Apr 2003.
Nicholas Clark [Sun, 23 Sep 2012 20:05:16 +0000 (22:05 +0200)]
-Do now also reports updates and use of PL_stashcache.
Nicholas Clark [Sun, 23 Sep 2012 20:01:14 +0000 (22:01 +0200)]
Test the resolution behaviour for file handles and package names.
Historical behaviour is that file handles take priority over package names,
and the use of PL_stashcache shouldn't change this.
Father Chrysostomos [Wed, 26 Sep 2012 20:12:57 +0000 (13:12 -0700)]
Restore special blocks to working order
I accidentally broke these in commit
85ffec3682, yet everything passed
for me under threads+mad.
PL_compcv is usually restored to its previous value at the end of
newATTRSUB when LEAVE_SCOPE is called. But BEGIN blocks are called
before that. I needed PL_compcv to be restored to its previ-
ous value before it was called, so I added LEAVE_SCOPE before
process_special_blocks.
But that caused the name to be freed before S_process_special_blocks
got a chance to look at it.
So I have now added a new parameter to S_process_special_blocks to
allow *it* to call LEAVE_SCOPE after it determines that it is a BEGIN
block, but before it calls it.
Karl Williamson [Wed, 26 Sep 2012 17:23:05 +0000 (11:23 -0600)]
perlreapi.pod: Reflow verbatim lines to 79 cols.
Karl Williamson [Wed, 26 Sep 2012 17:21:13 +0000 (11:21 -0600)]
porting/podcheck.t: Add test for removed files
If a file is removed from Perl that is in podcheck's data base,
it should be removed from the db at that time. This adds a check
to make sure that happens.
Karl Williamson [Wed, 26 Sep 2012 17:19:20 +0000 (11:19 -0600)]
podcheck.t: Return success/failure from ok()
This program has a private version of ok() to avoid messages that would
come from the standard one that would confuse things in these tests.
It did not return true/false prior to this commit
Karl Williamson [Wed, 26 Sep 2012 16:42:29 +0000 (10:42 -0600)]
regen podcheck after MPE port removed
Commit
b5afd3466ff5e5b70ea2921169f138f02727183e removed the MPE/iX
port, which included a file that had known (to podcheck.t) pod errors
podcheck doesn't currently check if a pod has been removed, so its data
base still contained the offending entry, which would be removed the
next time it is regenerated for another unrelated reason. This might
confuse spelunkers of perl history, so I'm regenerating it separately
now.
Karl Williamson [Wed, 12 Sep 2012 16:57:54 +0000 (10:57 -0600)]
regcomp.c: Add a less confusing #define alias
ALNUM (meaning \w) is too close to ALNUMC ([[:alnum:]]) for comfort
Karl Williamson [Wed, 12 Sep 2012 16:04:29 +0000 (10:04 -0600)]
regcomp.c: Properly handle no isblank(), isascii()
Configure probes whether or not these two C library functions are
present or not. (However until commit
1c6eef9acffe4b512210edba79119e423ea4874a it didn't find isblank() even
if present.)
However the code changed by this commit always presumed both functions
were present. That there were no failure reports from the field
indicates that Perl is being run on systems where they are present.
Karl Williamson [Mon, 17 Sep 2012 21:47:17 +0000 (15:47 -0600)]
pod/perlrecharclass.pod: Small corrections, typos
Karl Williamson [Thu, 13 Sep 2012 01:43:02 +0000 (19:43 -0600)]
perlvar.pod: Document UTF8CACHE
Peter Martini [Tue, 25 Sep 2012 12:45:43 +0000 (08:45 -0400)]
mg_get should be called before access
Father Chrysostomos [Wed, 26 Sep 2012 15:53:36 +0000 (08:53 -0700)]
Test XS registration of state subs
my subs do not currently work yet. I am not sure what the API
should be.
Father Chrysostomos [Wed, 26 Sep 2012 15:47:28 +0000 (08:47 -0700)]
Make PL_compcv visible to BEGIN blocks
This allows BEGIN { XS_func(); } to access the currently-com-
piling pad.
BEGIN blocks were unlike any other subroutine or special block in that
PL_compcv would be set to the BEGIN block itself at run time.
David Mitchell [Wed, 26 Sep 2012 09:13:03 +0000 (10:13 +0100)]
[MERGE] make regex engine handle non-null-terminated strings
David Mitchell [Fri, 21 Sep 2012 09:29:04 +0000 (10:29 +0100)]
stop regex engine reading beyond end of string
Historically the regex engine has assumed that any string passed to it
will have a trailing null char. This isn't normally an issue in perl code,
since perl strings *are* null terminated; but it could cause problems with
strings returned by XS code, or with someone calling the regex engine
directly from XS, with strend not pointing at a null char.
The engine currently relies on there being a null char in the following
ways.
First, when at the end of string, the main loop of regmatch() still reads
in the 'next' character (i.e. the character following the end of string)
even if it doesn't make any use of it. This precludes using memory mapped
files as strings for example, since the read off the end would SEGV.
Second, the matching algorithm often required the trailing character to be
\0 to work correctly: the test for 'EOF' was "if next char is null *and*
locinput >= PL_regeol, then stop". So a random non-null trailing char
could cause an overshoot.
Thirdly, some match ops require the trailing char to be null to operate
correctly; for example, \b applied at the end of the string only happens
to work because the trailing char (\0) happens to match \W.
Also, some utf8 ops will try to extract the code point at the end, which
can result in multiple bytes past the end of string being read, and
possible problems if they don't correspond to well-formed utf8.
The main fix is in S_regmatch, where the 'read next char' code has been
updated to set it to a special value, NEXTCHR_EOS instead, if we would be
reading past the end of the string.
Lots of other random bits in the regex engine needed to be fixed up too.
To track these down, I temporarily hacked regexec_flags() to make a copy
of the string but without trailing \0, then ran all the t/re/*.t tests
under valgrind to flush out all buffer overruns. So I think I've removed
most of the bad code, but by no means all of it. The code within the
various functions in regexec.c is far too complex to be able to visually
audit the code with any confidence.
David Mitchell [Sun, 16 Sep 2012 16:39:06 +0000 (17:39 +0100)]
regmatch(): fix typo in TRIE commentary text
David Mitchell [Sun, 16 Sep 2012 16:33:08 +0000 (17:33 +0100)]
regmatch() annotate ops and separate out branches
Annotate each 'case OP:' in the main switch in regmatch() to show
what regex pattern this implements. About half the ops had already been
done. Also add a blank line between each 'case' statement for readability.
(no code changes)
David Mitchell [Fri, 14 Sep 2012 15:19:10 +0000 (16:19 +0100)]
regmatch(): do nextchr=*locinput at top of loop
Currently each branch in the main regmatch() loop is responsible
re-initialising nextchar to UCHARAT(locinput) if locinput is modified.
By adding
nextchr = UCHARAT(locinput);
to the head of the loop, we can remove most of the nextchar assignments
in the individual branches. We lose slightly for the zero-width assertions
like \b which will re-read the same nextchar, but this will make it
easier to handle non-null-terminated strings.
David Mitchell [Fri, 14 Sep 2012 14:46:47 +0000 (15:46 +0100)]
regmatch(): nextchar should always be positive
Remove the one bit of code that tests for < 0, and put in a
general assert.
David Mitchell [Fri, 14 Sep 2012 11:37:33 +0000 (12:37 +0100)]
regmatch(): consolidate locinput++
There are several places in the code that increment locinput by 1 char
(which may or may not be 1 byte) then update nextchr.
Consolidate these into a single code block with the others goto'ing it.
This actually reduces the code more than it appears, since the CCC_TRY*
macros expand into several branches, each of which repeatthe
increment code.
David Mitchell [Fri, 14 Sep 2012 10:28:08 +0000 (11:28 +0100)]
regmatch(): use nextchar where available
In a couple of places the code was using *locinput, where
nextchar already equalled *locinput