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

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

Open
p6rt opened this issue May 1, 2016 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 1, 2016

Migrated from rt.perl.org#128047 (status was 'open')

Searchable as RT128047$

@p6rt
Copy link
Author

p6rt commented May 1, 2016

From @AlexDaniel

This bug report is somewhat related to https://rt-archive.perl.org/perl6/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.

@p6rt
Copy link
Author

p6rt commented Aug 23, 2016

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Feb 21, 2017

From @zoffixznet

On Sun, 01 May 2016 04​:12​:34 -0700, alex.jakimenko@​gmail.com wrote​:

This bug report is somewhat related to
https://rt-archive.perl.org/perl6/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
  readline requires an object with REPR MVMOSHandle
  in block <unit> at -e line 1
 
 

@p6rt
Copy link
Author

p6rt commented May 11, 2019

From @dogbert17

On Tue, 21 Feb 2017 11​:05​:15 -0800, cpan@​zoffix.com wrote​:

On Sun, 01 May 2016 04​:12​:34 -0700, alex.jakimenko@​gmail.com wrote​:

This bug report is somewhat related to
https://rt-archive.perl.org/perl6/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
readline requires an object with REPR MVMOSHandle
in block <unit> at -e line 1

Behavior has changed, the examples above now fail with​:

Cannot do 'get' on a handle in binary mode

@p6rt p6rt added the IO label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant