Skip to content
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

buildah run breaks stdin by setting O_NONBLOCK #3152

Closed
Vogtinator opened this issue Apr 16, 2021 · 7 comments · Fixed by #3338
Closed

buildah run breaks stdin by setting O_NONBLOCK #3152

Vogtinator opened this issue Apr 16, 2021 · 7 comments · Fixed by #3338

Comments

@Vogtinator
Copy link

Vogtinator commented Apr 16, 2021

Sometimes after running buildah run in a terminal, commands executed afterwards which try to read from stdin fail with EAGAIN. This is because it sets O_NONBLOCK on the FD:

f241:~ # grep flags /proc/self/fdinfo/0; while ! grep 'flags.*4002$' /proc/self/fdinfo/0; do buildah run sle15-working-container /bin/true; echo -n .; done; cat -
flags:  02
....................flags:      04002
cat: -: Resource temporarily unavailable

strace -k shows that this is caused by the runCopyStdio function:

if err := setNonblock(rfd, readDesc[rfd], true); err != nil {

For some reason this doesn't happen all the time and the O_NONBLOCK flag also disappears after some time, even after buildah exited. I suspect that the interactive shell is fixing that up at some point.

@rhatdan
Copy link
Member

rhatdan commented Apr 16, 2021

Is this something buildah could easily change back on exit?

@Vogtinator
Copy link
Author

It could just restore the previous descriptor flags, I suppose.

@rhatdan
Copy link
Member

rhatdan commented Apr 16, 2021

Interested in opening a PR?

@Vogtinator
Copy link
Author

Interested yes, but I unfortunately don't have the time to get familiar with the code and Go, at least not in the near future...

@rhatdan
Copy link
Member

rhatdan commented Apr 22, 2021

We have talked about this, and we are not sure there is an easy way to fix.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

rhatdan added a commit to rhatdan/buildah that referenced this issue Jun 24, 2021
Fixes: containers#3152

Sometimes after running buildah run in a terminal, commands executed afterwards which try to read from stdin fail with EAGAIN. This is because it sets O_NONBLOCK on the FD:

[NO TESTS NEEDED] Since I don't know how to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
rhatdan added a commit to rhatdan/buildah that referenced this issue Jun 24, 2021
Fixes: containers#3152

Sometimes after running buildah run in a terminal, commands executed afterwards which try to read from stdin fail with EAGAIN. This is because it sets O_NONBLOCK on the FD:

[NO TESTS NEEDED] Since I don't know how to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
rhatdan added a commit to rhatdan/buildah that referenced this issue Jun 24, 2021
Fixes: containers#3152

Sometimes after running buildah run in a terminal, commands executed afterwards which try to read from stdin fail with EAGAIN. This is because it sets O_NONBLOCK on the FD:

[NO TESTS NEEDED] Since I don't know how to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
rhatdan added a commit to rhatdan/buildah that referenced this issue Jun 24, 2021
Fixes: containers#3152

Sometimes after running buildah run in a terminal, commands executed afterwards which try to read from stdin fail with EAGAIN. This is because it sets O_NONBLOCK on the FD:

[NO TESTS NEEDED] Since I don't know how to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
rhatdan added a commit to rhatdan/buildah that referenced this issue Jun 24, 2021
Fixes: containers#3152

Sometimes after running buildah run in a terminal, commands executed afterwards which try to read from stdin fail with EAGAIN. This is because it sets O_NONBLOCK on the FD:

[NO TESTS NEEDED] Since I don't know how to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
rhatdan added a commit to rhatdan/buildah that referenced this issue Jun 24, 2021
Fixes: containers#3152

Sometimes after running buildah run in a terminal, commands executed afterwards which try to read from stdin fail with EAGAIN. This is because it sets O_NONBLOCK on the FD:

[NO TESTS NEEDED] Since I don't know how to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
rhatdan added a commit to rhatdan/buildah that referenced this issue Jun 25, 2021
Fixes: containers#3152

Sometimes after running buildah run in a terminal, commands executed afterwards which try to read from stdin fail with EAGAIN. This is because it sets O_NONBLOCK on the FD:

[NO TESTS NEEDED] Since I don't know how to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants