Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Parrot readline sometimes requires more than one line #861

Closed
pmichaud opened this Issue · 3 comments

4 participants

@pmichaud
Owner

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
RELEASE_4_8_0-133-g1101abb
pmichaud@kiwi:~/p6/parrot$ cat z.pir
.sub 'main' :main
    .local pmc stdin
    stdin = getstdin
    stdin.'encoding'('utf8')
    sweep 1
    $I0 = 1000
  loop:
    unless $I0 > 0 goto done
    $S0 = $I0
    dec $I0
    goto loop
  done:
    print "Enter a line of text: "
    $S1 = stdin.'readline'()
    print "Your line is: "
    say $S1
.end

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

pmichaud@kiwi:~/p6/parrot$ 

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.

Pm

@leto
Owner

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

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

@rurban
Collaborator

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
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.