Skip to content
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

.readchars($size) sometimes returns $size+1 chars #6281

Closed
p6rt opened this issue May 27, 2017 · 5 comments
Closed

.readchars($size) sometimes returns $size+1 chars #6281

p6rt opened this issue May 27, 2017 · 5 comments
Labels
IO moar regression Issue did not exist previously

Comments

@p6rt
Copy link

p6rt commented May 27, 2017

Migrated from rt.perl.org#131383 (status was 'resolved')

Searchable as RT131383$

@p6rt
Copy link
Author

p6rt commented May 27, 2017

From @zoffixznet

Seems something with decoding actually, since using char of different size or adding another char after the heart avoids the issue​:

<Zoffix___> m​: my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "fo♥"; $f1.open.readchars(2).say
<camelia> rakudo-moar 0c5fe5​: OUTPUT​: «fo♥␤»
<Zoffix___> m​: my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "fo♥z"; $f1.open.readchars(2).say
<camelia> rakudo-moar 0c5fe5​: OUTPUT​: «fo␤»
<Zoffix___> m​: my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "foz"; $f1.open.readchars(2).say
<camelia> rakudo-moar 0c5fe5​: OUTPUT​: «fo␤»

Bisection results​:

<Zoffix___> bisect​: my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "fo♥"; $f1.open.readchars(2).say
<bisectable6> Zoffix___, Bisecting by output (old=2015.12 new=0c5fe56) because on both starting points the exit code is 0
<bisectable6> Zoffix___, bisect log​: https://gist.github.com/6417457868d7d3389761c1b1d1499ada
<bisectable6> Zoffix___, (2017-01-02) rakudo/rakudo@7c8b705
<Zoffix___> Geth, ver rakudo/rakudo@7c8b705
<Geth> Zoffix___, version bump brought in these changes​: Raku/nqp@2016.12-48-g5daf0e3...2016.12-55-gc782eb7c
<Zoffix___> Geth, ver Raku/nqp@c782eb7
<Geth> Zoffix___, version bump brought in these changes​: MoarVM/MoarVM@2016.12-35-g293bda71...2016.12-50-g9a9f2d46

<Zoffix___> m​: my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "fo♥"; with $f1.open { .readchars(1).say xx 3 }
<camelia> rakudo-moar 0c5fe5​: OUTPUT​: «f␤o♥␤␤»
<Zoffix___> c​: 7c8b705b33755 my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "fo♥"; $f1.open.readchars(2).say
<committable6> Zoffix___, ¦7c8b705​: «fo♥»
<Zoffix___> c​: 7c8b705b33755~ my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "fo♥"; $f1.open.readchars(2).say
<committable6> Zoffix___, ¦7c8b705b33755~​: «fo»

@p6rt
Copy link
Author

p6rt commented May 28, 2017

From @samcv

I bisected MoarVM and the offending commit is here​:

MoarVM/MoarVM@c98634c

From what I see, this commit did not actually cause the root bug, it just exposed it.

The Unicode Database was rebuilt so that NFG_QC=False for Emoji characters, which the ♥ is.

Also interestingly​:

  <samcv> m​:my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "fo♥22"; $f1.open.readchars(2).say
  <evalable6> samcv, rakudo-moar 0c5fe56cc​: OUTPUT​: «fo♥22»

@p6rt
Copy link
Author

p6rt commented May 28, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 14, 2017

From @jnthn

On Sat, 27 May 2017 07​:06​:59 -0700, cpan@​zoffix.com wrote​:

Seems something with decoding actually, since using char of different
size or adding another char after the heart avoids the issue​:

<Zoffix___> m​: my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "fo♥";
$f1.open.readchars(2).say
<camelia> rakudo-moar 0c5fe5​: OUTPUT​: «fo♥␤»
<Zoffix___> m​: my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "fo♥z";
$f1.open.readchars(2).say
<camelia> rakudo-moar 0c5fe5​: OUTPUT​: «fo␤»
<Zoffix___> m​: my $f1 = "/tmp/foo121212".IO; $f1.spurt​: "foz";
$f1.open.readchars(2).say
<camelia> rakudo-moar 0c5fe5​: OUTPUT​: «fo␤»

Fixed and tested in S16-io/readchars.t.

@p6rt p6rt closed this as completed Jul 14, 2017
@p6rt
Copy link
Author

p6rt commented Jul 14, 2017

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt added IO moar regression Issue did not exist previously labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO moar regression Issue did not exist previously
Projects
None yet
Development

No branches or pull requests

1 participant