Fix Solaris xattr write loop after partial write#1013
Open
AlphaGlider25 wants to merge 1 commit into
Open
Conversation
steadytao
requested changes
Jun 19, 2026
steadytao
left a comment
Member
There was a problem hiding this comment.
The size - bufpos fix seems right for the short-write case so I am happy with that but one nearby issue I noticed while reading the loop is that bufpos is a size_t so the existing bufpos = -1 failure sentinel wraps to SIZE_MAX and the final bufpos > 0 ? 0 : -1 can report success after a write failure.
Not caused by this PR but probably worth fixing in the same area as you are already touching the loop 🙂
Author
|
Thanks for the review. I've fixed the issue you identified and verified the change locally. Would you like me to add the update to this PR, or is there another preferred way to submit the additional commit? (Here is the commit link: AlphaGlider25@2a8bbb7) |
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.
This fixes a bug in the Solaris xattr backend's retry loop.
In
lib/sysxattrs.c, the loop advancesbufposafter a successful partial write, but subsequent retries continue to pass the originalsizevalue towrite()rather than the remaining byte count.As a result, if a short write occurs, the next iteration can attempt to write more bytes than remain in the source buffer.
The fix changes:
to:
This matches the corresponding logic in
read_xattr()and the existing retry-loop pattern used elsewhere in the file.Notes: