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

\n\r and string concatenation improvements #6454

Closed
p6rt opened this issue Aug 18, 2017 · 6 comments
Closed

\n\r and string concatenation improvements #6454

p6rt opened this issue Aug 18, 2017 · 6 comments
Labels
regression Issue did not exist previously testneeded

Comments

@p6rt
Copy link

p6rt commented Aug 18, 2017

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

Searchable as RT131924$

@p6rt
Copy link
Author

p6rt commented Aug 18, 2017

From @AlexDaniel

The issue happens in Email​::Simple (one of its tests is now failing, but it was ok in 2017.07).

Here's the code​:

use v6;
use Test;
use Email​::Simple;
my $nr = "\x0a\x0d";
my $nasty = "Subject​: test{$nr}To​: foo{$nr}{$nr}foo{$nr}";
my $mail = Email​::Simple.new($nasty);
is $mail.crlf, "{$nr}", "got correct line terminator";
is $mail.body, "foo{$nr}", "got correct body";
is ~$mail, $nasty, "Round trip nasty";

Result​:
ok 1 - got correct line terminator
ok 2 - got correct body
not ok 3 - Round trip nasty

# Failed test 'Round trip nasty'
# at t/basic.t line 9
# expected​: "Subject​: test\n\rTo​: foo\n\r\n\rfoo\n\r"
# got​: "Subject​: test\n\rTo​: foo\n\r\n\rfoo\n\r"

Yes, it displays two strings that look identical, but (~$mail eq $nasty) is actually False.

Bisected​:

<AlexDaniel> bisect​: old=2017.07 https://gist.githubusercontent.com/AlexDaniel/64032cb24876d9a1cfac44a752921d20/raw/2d242fa49eef2b74da1b6626e337631463471182/basic.t
<bisectable6> AlexDaniel, Successfully fetched the code from the provided URL.
<bisectable6> AlexDaniel, Bisecting by exit code (old=2017.07 new=1599873). Old exit code​: 0
<bisectable6> AlexDaniel, bisect log​: https://gist.github.com/d16b49e55a1102e25b95be5df7bbf902
<bisectable6> AlexDaniel, (2017-07-20) rakudo/rakudo@b81597b

So it is due to “String concatenation improvements”, or so it seems.

@p6rt
Copy link
Author

p6rt commented Aug 19, 2017

From @AlexDaniel

It was fixed in this commit​: MoarVM/MoarVM@5363a07

samcv++

Tests needed.
On 2017-08-18 12​:48​:20, alex.jakimenko@​gmail.com wrote​:

The issue happens in Email​::Simple (one of its tests is now failing,
but it was ok in 2017.07).

Here's the code​:

use v6;
use Test;
use Email​::Simple;
my $nr = "\x0a\x0d";
my $nasty = "Subject​: test{$nr}To​: foo{$nr}{$nr}foo{$nr}";
my $mail = Email​::Simple.new($nasty);
is $mail.crlf, "{$nr}", "got correct line terminator";
is $mail.body, "foo{$nr}", "got correct body";
is ~$mail, $nasty, "Round trip nasty";

Result​:
ok 1 - got correct line terminator
ok 2 - got correct body
not ok 3 - Round trip nasty

# Failed test 'Round trip nasty'
# at t/basic.t line 9
# expected​: "Subject​: test\n\rTo​: foo\n\r\n\rfoo\n\r"
# got​: "Subject​: test\n\rTo​: foo\n\r\n\rfoo\n\r"

Yes, it displays two strings that look identical, but (~$mail eq
$nasty) is actually False.

Bisected​:

<AlexDaniel> bisect​: old=2017.07
https://gist.githubusercontent.com/AlexDaniel/64032cb24876d9a1cfac44a752921d20/raw/2d242fa49eef2b74da1b6626e337631463471182/basic.t
<bisectable6> AlexDaniel, Successfully fetched the code from the
provided URL.
<bisectable6> AlexDaniel, Bisecting by exit code (old=2017.07
new=1599873). Old exit code​: 0
<bisectable6> AlexDaniel, bisect log​:
https://gist.github.com/d16b49e55a1102e25b95be5df7bbf902
<bisectable6> AlexDaniel, (2017-07-20)
rakudo/rakudo@b81597b

So it is due to “String concatenation improvements”, or so it seems.

@p6rt
Copy link
Author

p6rt commented Oct 11, 2017

From @AlexDaniel

  OK, so the test for this goes like this​:
 
  Create a file Simple.pm6 with this content​:

  unit class Simple; sub buggy-str is export { “​: {‘’}\n\r” ~ “\n\r” }
 
  Then run something like this​:
  use lib ‘sandbox’; # or whatever the path is for your Simple.pm6
  use Simple;
  say buggy-str() eq “​: \n\r\n\r”
 
 
  On buggy versions it returns False, even though both strings are identical. On HEAD it returns True correctly.
 
  On 2017-08-19 05​:33​:37, alex.jakimenko@​gmail.com wrote​:
  > It was fixed in this commit​:
  > MoarVM/MoarVM@5363a07
  >
  > samcv++
  >
  > Tests needed.
  > On 2017-08-18 12​:48​:20, alex.jakimenko@​gmail.com wrote​:
  > > The issue happens in Email​::Simple (one of its tests is now failing,
  > > but it was ok in 2017.07).
  > >
  > > Here's the code​:
  > >
  > > use v6;
  > > use Test;
  > > use Email​::Simple;
  > > my $nr = "\x0a\x0d";
  > > my $nasty = "Subject​: test{$nr}To​: foo{$nr}{$nr}foo{$nr}";
  > > my $mail = Email​::Simple.new($nasty);
  > > is $mail.crlf, "{$nr}", "got correct line terminator";
  > > is $mail.body, "foo{$nr}", "got correct body";
  > > is $mail, $nasty, "Round trip nasty";
  > >
  > >
  > > Result​:
  > > ok 1 - got correct line terminator
  > > ok 2 - got correct body
  > > not ok 3 - Round trip nasty
  > >
  > > # Failed test 'Round trip nasty'
  > > # at t/basic.t line 9
  > > # expected​: "Subject​: test\n\rTo​: foo\n\r\n\rfoo\n\r"
  > > # got​: "Subject​: test\n\rTo​: foo\n\r\n\rfoo\n\r"
  > >
  > >
  > > Yes, it displays two strings that look identical, but (
$mail eq
  > > $nasty) is actually False.
  > >
  > >
  > > Bisected​:
  > >
  > > <AlexDaniel> bisect​: old=2017.07
  > >
  > https://gist.githubusercontent.com/AlexDaniel/64032cb24876d9a1cfac44a752921d20/raw/2d242fa49eef2b74da1b6626e337631463471182/basic.t
  > > <bisectable6> AlexDaniel, Successfully fetched the code from the
  > > provided URL.
  > > <bisectable6> AlexDaniel, Bisecting by exit code (old=2017.07
  > > new=1599873). Old exit code​: 0
  > > <bisectable6> AlexDaniel, bisect log​:
  > > https://gist.github.com/d16b49e55a1102e25b95be5df7bbf902
  > > <bisectable6> AlexDaniel, (2017-07-20)
  > >
  > rakudo/rakudo@b81597b
  > >
  > >
  > > So it is due to “String concatenation improvements”, or so it seems.
 
 
   

@p6rt
Copy link
Author

p6rt commented Oct 11, 2017

From @zoffixznet

Tests in Raku/roast@28481cea18

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 11, 2017

From @zoffixznet

Tests in Raku/roast@28481cea18

@p6rt
Copy link
Author

p6rt commented Oct 11, 2017

@zoffixznet - Status changed from 'new' to 'resolved'

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

No branches or pull requests

1 participant