-
Notifications
You must be signed in to change notification settings - Fork 824
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
Fix polling in WasiPipe #3289
Fix polling in WasiPipe #3289
Conversation
fschutt
commented
Nov 8, 2022
TODO: when this is done and bash / dash is working, we can test it with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not familiar enough with this code to provide a comprehensive review.
Did notice one problematic pattern, though.
let buf_len = buf.len(); | ||
if buf_len > 0 { | ||
let reader = buf.as_ref(); | ||
let read = read_bytes(reader, memory, iov).map(|_| buf_len as usize)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like you are throwing away the actual amount of bytes read, which can be lower than the buffer size.
if buf_len > 0 { | ||
if inner_buf.len() > buf.len() { | ||
let mut reader = inner_buf.as_ref(); | ||
let read = reader.read_exact(buf).map(|_| buf.len())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing as above.
return Ok(read); | ||
} else { | ||
let mut reader = inner_buf.as_ref(); | ||
let read = reader.read(buf).map(|_| buf_len as usize)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above.
This will be subsumed by #3422 . |