Fix double close on ubivol descriptor#1419
Closed
tvdstaaij wants to merge 1 commit into
Closed
Conversation
The g_output_stream_close call was introduced at some point after the casync functionality for UBI was introduced (rauc#501). This close call is fine for the copy_raw_image branch, but for the casync branch it causes the update to fail: rauc[250]: Installation error: Failed updating slot rootfs.1: \ Error closing file descriptor: Bad file descriptor This was also mentioned in rauc#1200. However it was not investigated there but instead sidestepped by using a different update approach. Investigation with strace shows that the desciptor is closed twice: 290 openat(AT_FDCWD, "/dev/ubi0_1", O_WRONLY|O_EXCL|O_LARGEFILE <unfinished ...> 290 <... openat resumed>) = 8 [snip] 290 close(8 <unfinished ...> 290 <... close resumed>) = 0 290 close(8 <unfinished ...> 290 <... close resumed>) = -1 EBADF (Bad file descriptor) This can be explained by the documentation of g_subprocess_launcher_close(): > Closes all the file descriptors previously passed to the object with > g_subprocess_launcher_take_fd(), g_subprocess_launcher_take_stderr_fd(), etc. > (...) > This function is called automatically when the #GSubprocessLauncher is disposed Signed-off-by: Tim van der Staaij <git@tim.vanderstaaij.email>
Member
|
The intention with the explicit close is to be able to catch more errors (some of which are only reported on Sadly this code is not covered by the CI, as we didn't want to build a custom version of casync systemd/casync#227. |
Contributor
Author
Ah, I wasn't aware of the existence of |
Member
|
Note that you can force-push to your branch to update this PR, which keeps the discussion in one place. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The g_output_stream_close call was introduced at some point after the casync functionality for UBI was introduced (#501). This close call is fine for the copy_raw_image branch, but for the casync branch it causes the update to fail:
rauc[250]: Installation error: Failed updating slot rootfs.1: Error closing file descriptor: Bad file descriptorThis was also mentioned in #1200. However it was not investigated there but instead sidestepped by using a different update approach.
Investigation with strace shows that the desciptor is closed twice:
This can be explained by the documentation of
g_subprocess_launcher_close():