writer: Fix return value of lcfs_node_unset_xattr#401
Merged
allisonkarlitskaya merged 2 commits intocomposefs:mainfrom Dec 9, 2024
Merged
writer: Fix return value of lcfs_node_unset_xattr#401allisonkarlitskaya merged 2 commits intocomposefs:mainfrom
allisonkarlitskaya merged 2 commits intocomposefs:mainfrom
Conversation
allisonkarlitskaya
requested changes
Dec 2, 2024
Collaborator
allisonkarlitskaya
left a comment
There was a problem hiding this comment.
Something went wrong with the commit message formatting...
Since the first creation of this code in 5ac1f5c "lib: Update xattr APIs" this function has always returned an error code - but nothing checked it, so it didn't matter. Now also, currently this function cannot fail but let's give ourselves some flexibility here; perhaps we want to e.g. invoke `realloc` and in that case we'd need to handle OOM. I just noticed this while working on commit 02077e8 to reject empty xattr names. Change this to return success, and also check its return value in the set path. Signed-off-by: Colin Walters <walters@verbum.org>
Came up in chat, the semantics defined today is last-one-wins. Let's test that. Signed-off-by: Colin Walters <walters@verbum.org>
586776f to
306f24d
Compare
Contributor
Author
|
I also added a test case for the multiple xattr path. |
Contributor
Author
Can you be more specific? |
Collaborator
Same as we talked about today. It's wrapped at 50. Not important :) |
allisonkarlitskaya
approved these changes
Dec 9, 2024
| else | ||
| node->xattr_size = 0; // If last xattr, remove the overhead too | ||
| assert(node->xattr_size >= 0); | ||
| if (index < 0) { |
Collaborator
There was a problem hiding this comment.
This way around reads a lot nicer now. Thanks for the change.
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.
Since the first creation of this code in
5ac1f5c "lib: Update xattr APIs" this function
has always returned an error code - but nothing
checked it, so it didn't matter.
Now also, currently this function cannot fail
but let's give ourselves some flexibility here;
perhaps we want to e.g. invoke
reallocand in that case we'd need to handle OOM.
I just noticed this while working on commit
02077e8
to reject empty xattr names.
Change this to return success, and also check its
return value in the set path.