google / gvisor

Application Kernel for Containers

Home Page:https://gvisor.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Switching from canonical to non-canonical mode in a PTY can cause EOF when reading

thecodingwizard opened this issue · comments

Description

I think this line of code:

l.inQueue.readable = true
should be len(l.inQueue.buffer) > 0 rather than true. Otherwise, it seems like switching from canonical to non-canonical mode in a PTY, then reading from the input, could cause an EOF. Making this change fixes my reproduction below, but I'm quite new to this codebase so perhaps I'm mistaken about what's going on.

Steps to reproduce

Install IPython and create a Python file:

import IPython
IPython.embed()

Run this Python file within a pty. One option might be import pty; pty.spawn(["python", "main.py"])

Press question mark + enter a few times; you should see an EOF error.

runsc version

No response

docker version (if using docker)

No response

uname

Linux ip-10-1-5-239 5.15.0-1048-aws #53~20.04.1-Ubuntu SMP Wed Oct 4 16:44:20 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

kubectl (if using Kubernetes)

No response

repo state (if built from source)

release-20240122.0-27-gac416763d

runsc debug logs (if available)

No response