-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utf8 messes global match array context #2910
Comments
From @jhiCreated by jhi@kosh.hut.fiUsing the /g match in array context seems to be the killer (it doesn't The test is a stripped down t/op/pat.t #44. Works fine without the -Mutf8. kosh:~/pp4/perl ; ./perl -Ilib -Mutf8 -e '@a=("b" =~ /(.)/g)' signal IOT/Abort trap at >*[__kill, 0x3ff800e9b78] beq r19, 0x3ff800e9b90
Perl Info
|
From @jhiJust for the bug db record, Robin managed to whittle the core dump ./perl -Ilib -Mutf8 -we 'map /()/, q()' Dumps core e.g. in Solaris, with or without use64bitint, but seemingly |
From @jhiOn Thu, Nov 30, 2000 at 12:00:11PM -0600, Jarkko Hietaniemi wrote:
Closing in on it... it's the sv_utf8_downgrade() call in the |
From @jhiThe below seems to fix the bug, just don't ask me why... Change 7936 by jhi@alpha on 2000/11/30 20:41:39 Fix for 20001128.006, be more careful in Perl_sv_utf8_downgrade(). Affected files ... ... //depot/perl/sv.c#299 edit Differences ... ==== //depot/perl/sv.c#299 (text) ==== Inline Patch--- perl/sv.c.~1~ Thu Nov 30 21:43:34 2000
+++ perl/sv.c Thu Nov 30 21:43:34 2000
@@ -2447,22 +2447,26 @@
Perl_sv_utf8_downgrade(pTHX_ register SV* sv, bool fail_ok)
{
if (SvPOK(sv) && SvUTF8(sv)) {
- char *c = SvPVX(sv);
- STRLEN len = SvCUR(sv) + 1; /* include trailing NUL */
- if (!utf8_to_bytes((U8*)c, &len)) {
- if (fail_ok)
- return FALSE;
- else {
- if (PL_op)
- Perl_croak(aTHX_ "Wide character in %s",
- PL_op_desc[PL_op->op_type]);
- else
- Perl_croak(aTHX_ "Wide character");
+ if (SvCUR(sv)) {
+ char *c = SvPVX(sv);
+ STRLEN len = SvCUR(sv);
+
+ if (!utf8_to_bytes((U8*)c, &len)) {
+ if (fail_ok)
+ return FALSE;
+ else {
+ if (PL_op)
+ Perl_croak(aTHX_ "Wide character in %s",
+ PL_op_desc[PL_op->op_type]);
+ else
+ Perl_croak(aTHX_ "Wide character");
+ }
}
+ SvCUR(sv) = len;
}
- SvCUR(sv) = len - 1;
SvUTF8_off(sv);
}
+
return TRUE;
}
End of Patch. |
From [Unknown Contact. See original ticket]
These often come from use64bitint, which the original bugee had. Robin |
From @jhi
Doesn't seem to be a use64bitint problem as such, I now built a Linux |
From @jhiOn Wed, Nov 29, 2000 at 06:55:27AM +0200, Jarkko Hietaniemi wrote:
Actually, the /g is a red herring. Just array context for a match is enough: /perl -Ilib -Mutf8 -e '@a=("bc" =~ /(.)(.)/)' Same stack dump. |
From @andk
> /perl -Ilib -Mutf8 -e '@a=("bc" =~ /(.)(.)/)' Works for all perls I have on linux . |
Migrated from rt.perl.org#4796 (status was 'resolved')
Searchable as RT4796$
The text was updated successfully, but these errors were encountered: