Skip Menu |
Report information
Id: 131924
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: testneeded
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [REGRESSION] \n\r and string concatenation improvements
Download (untitled) / with headers
text/plain 1.3k
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) https://github.com/rakudo/rakudo/commit/b81597bd867a0072cea6453529da89a13ede808c So it is due to “String concatenation improvements”, or so it seems.
It was fixed in this commit: https://github.com/MoarVM/MoarVM/commit/5363a0742d9ea7183200a747c2d7531e82bc5c71

samcv++

Tests needed.
On 2017-08-18 12:48:20, alex.jakimenko@gmail.com wrote:
Show quoted text
> 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)
> https://github.com/rakudo/rakudo/commit/b81597bd867a0072cea6453529da89a13ede808c
>
>
> So it is due to “String concatenation improvements”, or so it seems.


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:
> https://github.com/MoarVM/MoarVM/commit/5363a0742d9ea7183200a747c2d7531e82bc5c71
>
> 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)
> >
> https://github.com/rakudo/rakudo/commit/b81597bd867a0072cea6453529da89a13ede808c
> >
> >
> > So it is due to “String concatenation improvements”, or so it seems.


 

RT-Send-CC: perl6-compiler [...] perl.org


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org