-
Notifications
You must be signed in to change notification settings - Fork 14
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
(flatpak-spawn) Unable to read struct signalfd_siginfo: Bad file descriptor #55
Comments
Is this running in This seems like it's probably a bug in the version of https://github.com/flatpak/flatpak-xdg-utils in whatever runtime you're using. |
This would indicate that the |
Actually, I think this might be a bug in https://github.com/flathub/org.flatpak.Builder/blob/master/fusermount-wrapper.sh. It's blindly forwarding fd 3 to the host, even if fd 3 is not actually open. If fd 3 is the signalfd that flatpak-spawn uses internally, then it'll get closed, leading to failure. Ideally |
Yes @smcv should I open issue in org.flatpak.Builder repo at flathub then or it has to be fixed here? |
@smcv looks like that file dates back to beginning of the repo in 2018. Is there a spec somewhere of how the fd handling is actually supposed to work like? Can there be more fd's than 1, 2 and 3? Would it work to go through /proc/self/fd/? |
fds 0, 1 and 2 (stdin, stdout and stderr respectively) are always forwarded, so forwarding those explicitly is unnecessary. Any other file descriptor should only be forwarded if it is both: (a) already open, and (b) necessary to forward. If you don't know whether a file descriptor is necessary to forward, then it isn't. They should only be necessary to forward if there is some "protocol" or "API" that tells the child process which file descriptors it should be reading or writing. For example, imagine you are running an instance of It looks as though when libfuse runs For a very complicated version of this, look at pressure-vessel, which forwards a lot of fds (I would guess a 2-digit number of them) through The default in historical Unix (and therefore in shells) is that every fd is inherited unless explicitly flagged to not be inherited. The default in flatpak-spawn is that every fd is not "inherited" (really forwarded) unless explicitly flagged. With hindsight, this would have been a better default for Unix too, but we're about 40 years too late to fix that.
Yes, up to hundreds of thousands on modern systems, but typically somewhere in the range 3 to 100.
I think that would be wrong, because the shell will have fds open for its own purposes that are not intended to be inherited by (flatpak-spawn and therefore) fusermount. |
What I would do [edit: to resolve flathub/org.flatpak.Builder#42] is: Try removing all the If it doesn't work, then investigate what fd 3 is/was, and why it is (sometimes? always?) necessary. |
Meanwhile, let's use this issue to represent the thing that is wrong in flatpak-spawn:
|
@smcv what should it do on user error? (incorrect error passes) Should it fail? |
If fd 3 is not a valid fd at startup, then I'm not sure whether |
Linux distribution and version
Arch Linux
Flatpak version
Flatpak 1.11.2
Description of the problem
While building flatpaks using flatpak-builder flatpak there are a lot (hundreds) of warnings related to flatpak-spawn printed in output at various stages:
Beside of the above the build succeeds.
Steps to reproduce
Build flatpak using flatpak-builder flatpak, i.e
flatpak run org.flatpak.Builder build org.flatpak.Builder.yml
The text was updated successfully, but these errors were encountered: