Skip to content

Parrot readline sometimes requires more than one line #861

pmichaud opened this Issue Oct 16, 2012 · 3 comments

4 participants

Parrot Virtual Machine member

Since the 4.8.0 release (and the io_rewrite branch merge), various Rakudo users have noticed that single-line reads often keep reading to EOF instead of stopping after a single line. I now have a pure-parrot program that exhibits the bug:

pmichaud@kiwi:~/p6/parrot$ git describe --tags
pmichaud@kiwi:~/p6/parrot$ cat z.pir
.sub 'main' :main
    .local pmc stdin
    stdin = getstdin
    sweep 1
    $I0 = 1000
    unless $I0 > 0 goto done
    $S0 = $I0
    dec $I0
    goto loop
    print "Enter a line of text: "
    $S1 = stdin.'readline'()
    print "Your line is: "
    say $S1

pmichaud@kiwi:~/p6/parrot$ ./parrot z.pir
Enter a line of text: hello
I already entered a line of text
Your line is: hello
I already entered a line of text


Notice how only a single line of text is requested, but I entered several lines and ultimately had to send EOF (Ctrl-D on Linux) after the "I already entered a line of text" input in order to get the program to proceed, at which point it returned all of my input lines in $S1.

This may be related to issues #860 and #834.

It is definitely a blocker for Rakudo -- Rakudo cannot use Parrot 4.8.0 or later until this bug is fixed.


Parrot Virtual Machine member
leto commented Oct 16, 2012

I am scheduled to release a stable version of Parrot today. If somebody thinks they can fix this issue quickly, please let me know. Otherwise, it looks like we will need a bugfix release to fix this.

gerdr commented Oct 21, 2012

As far as I can tell, luben's commit fixed the issue, ie only #834 needs resolution.

Parrot Virtual Machine member
rurban commented Dec 14, 2012

I added a sorta testcase as example/io/readline.pir, could not repro it anymore, with 5202bce (release 4.11.0)

Most likely fixed with 3c558c8.

@rurban rurban closed this Dec 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.