-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Pony sets stdin to nonblocking, breaking almost every program not expecting it. #205
Comments
Also, please rename the title to something more appropriate because I am |
The title sums it up pretty well! Thanks for the report. I just pushed what might be a fix for this. It seems to work for me on OSX and Linux - can you please give it a try and see if it works for you? |
Yep, commit c5090ad fixes this issue appropriately, thanks. |
Many programs (like cat) cannot handle non-blocking file descriptors. This was causing a sporadic failure in the process monitor tests. This is similar to issue #205.
Edit: Removing the calls to
fd_nonblocking()
insideos_stdin_setup()
corrects this apparent broken behaviour but I have no idea what kind of
consequence that has.
Edit2: This may be related to the handling of non-blocking stdin internally,
this is usually accomplished with
e/poll()
andselect()
while stdfd.cdoesn't appear to use anything from aiso.h.
Edit3: It's likely because you set stdin to
NONBLOCK
which breaks manyprograms out there which don't handle, or need to handle, non-blocking stdin.
The need to use non-blocking stdin is also curious given the use of epoll and
blocking fd probably being more power friendly as well.
Edit4: This probably applies to stdout and stderr as well. Perhaps you should
not be setting them to non-blocking as it will break almost any filter program
too
A Bit of Background
The build system for Arch Linux -- makepkg -- is written in in bash.
As part of the build system you can install any missing dependencies, build
dependencies and test dependencies which will later be removed at the end.
As part of this process pacman (called via makepkg) will offer a confirmation
prompt to the user and ask if they would like to remove the target packages.
After the commit 07d9453 I had started to
notice this prompt would be skipped, essentially stdin was missing.
A Test Case
I have managed to reproduce this with a minimal pony program consisting of
just a main actor and an environment:
And a test script:
Running this results in the following error:
Addendum
The same thing works fine with zsh, albeit adjusting the read to match the
syntax of zsh (
read "?Prompt: " result
), however zsh seems to always tryagain if the result of the call to
read()
sets errnoEAGAIN
. (It alsoseems to set the fd to
O_NONBLOCK
).In both Bash and Dash the errno is also set to
EAGAIN
but they don't tryagain.
Here is a temporary snippet for strace output on both Zsh and Bash just after
the pony program ends: http://ix.io/iAT
References
The text was updated successfully, but these errors were encountered: