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
RH perl5.8.0 split loop in <STDIN> #6304
Comments
From widyono@cis.upenn.eduCreated by widyono@cis.upenn.eduThe following works: perl -e '@parse=split(/[, ]+/,"io0, io1"); print "$parse[0]\n$parse[1]\n";' The following works in 5.6.1 on linux, but in 5.8.0 (RedHat's 8.0 default perl -e '$input=<STDIN>;chop($input);@parse=split(/[, ]+/, $input);print Happens even if $input is reassigned to another var and that var is used Does not happen with LANG=C. No idea what to put for severity... Perl Info
|
From @jhiVerified to still exist in the maintenance branch. Easier way to reproduce -e '$input="foo bar";utf8::upgrade($input);@parse=split(/[, ]+/, $input);print "$parse[0]\n$parse[1]\n"' (For perl5-porters I) The "Split loop" comes if pp.c:Perl_pp_split() thinks that (For perl5-porters II) If you are using "./perl ..." don't forget also "-Ilib" since |
From enache@rdslink.roOn Thu, Feb 13, 2003 at 05:31:38AM -0000, widyono@cis.upenn.edu (via RT) wrote:
I can get it on bleadperl too. $ perl -le '$p="a,b"; utf8::upgrade $p; split(/[, ]+/,$p)' ( If the locales are utf8, $input=<STDIN> above become However, this works: $ perl -le '$p="a,b"; utf8::upgrade $p; print split(/[, ]+/,$p)' It obviously has to do with the trick pp_split() uses : if the When the string to be split is utf8 flagged, the regexp engine POPSTACK pops there to the PL_curstackinfo->si_stack, not to the The following fixes this bug. Please try. Inline Patch--- /arc/perl-current/pp.c 2003-02-02 19:59:19.000000000 +0200
+++ perl-current/pp.c 2003-02-15 00:29:51.000000000 +0200
@@ -4423,6 +4423,7 @@ PP(pp_split)
}
/* temporarily switch stacks */
SWITCHSTACK(PL_curstack, ary);
+ PL_curstackinfo->si_stack = ary;
make_mortal = 0;
}
}
@@ -4620,6 +4621,7 @@ PP(pp_split)
if (realarray) {
if (!mg) {
SWITCHSTACK(ary, oldstack);
+ PL_curstackinfo->si_stack = oldstack;
if (SvSMAGICAL(ary)) {
PUTBACK;
mg_set((SV*)ary);
----------------------------------------------------------------------------
eval { $p="a,b"; utf8::upgrade $p; split(/[, ]+/,$p) }; __END__ |
From @jhiYes, thanks, just as I suspected, that somehow the stack had got -- |
From @jhiThis issue got resolved, so I am marking also the problem ticket as such. |
@jhi - Status changed from 'new' to 'resolved' |
Migrated from rt.perl.org#20912 (status was 'resolved')
Searchable as RT20912$
The text was updated successfully, but these errors were encountered: