Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #128047] Rakudo may crash if you use get() when -n is used (perl6 -ne 'say get' <<< 'hello')

1 view
Skip to first unread message

Alex Jakimenko

unread,
May 1, 2016, 7:30:03 AM5/1/16
to bugs-bi...@rt.perl.org
# New Ticket Created by Alex Jakimenko
# Please include the string: [perl #128047]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=128047 >


This bug report is somewhat related to https://rt.perl.org/Ticket/Display.html?id=128046

get() crashes with a weird error if the stream has ended.

Command:
perl6 -ne 'get' <<< $'hello\nworld\ntest'

Result:
world
Nil
readline requires an object with REPR MVMOSHandle
in block <unit> at -e line 1

But it works if the number of lines is even.

Command:
perl6 -ne 'get' <<< $'hello\nworld'

Result:
world


It should not crash.

Zoffix Znet via RT

unread,
Feb 21, 2017, 2:15:02 PM2/21/17
to perl6-c...@perl.org
On Sun, 01 May 2016 04:12:34 -0700, alex.ja...@gmail.com wrote:
> This bug report is somewhat related to
> https://rt.perl.org/Ticket/Display.html?id=128046
>
> get() crashes with a weird error if the stream has ended.
>
> Command:
> perl6 -ne 'get' <<< $'hello\nworld\ntest'
>
> Result:
> world
> Nil
> readline requires an object with REPR MVMOSHandle
> in block <unit> at -e line 1
>
> But it works if the number of lines is even.
>
> Command:
> perl6 -ne 'get' <<< $'hello\nworld'
>
> Result:
> world
>
>
> It should not crash.

lines() appears to have a similar affliction, though I don't see any difference if the number of lines is even.

$ cat foo.txt
a
b
c

$ perl6 -ne '@ = lines' foo.txt
readline requires an object with REPR MVMOSHandle
in block <unit> at -e line 1


$ perl6 -ne 'lines.eager' foo.txt

Jan-Olof Hendig via RT

unread,
May 11, 2019, 11:45:03 AM5/11/19
to alex.ja...@gmail.com
Behavior has changed, the examples above now fail with:

Cannot do 'get' on a handle in binary mode

0 new messages