-
Notifications
You must be signed in to change notification settings - Fork 42
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
Index bugfix and papercuts #224
Conversation
e0948ed
to
422af6b
Compare
422af6b
to
87a36eb
Compare
Some brown paperbag fixes 🤦 |
For non-alias indexes prefix is an empty string, where strbuf_pushchars() returns the number of characters added to the strbuf. Since those are zero, we end up completely skipping the dump process. Cc: Tobias Stoeckmann <[email protected]> Fixes: 889d02b ("libkmod: check strbuf return values") Signed-off-by: Emil Velikov <[email protected]>
As seen with previous commit, the way we pass an empty string to index_{,mm_}dump() is very error prone. Swap that with a bool, which makes things a lot more obvious. Signed-off-by: Emil Velikov <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>
The compiler already creates an empty string as applicable, drop the extra variable. Signed-off-by: Emil Velikov <[email protected]>
Create a simple helper and reuse it instead of duplicating code. Signed-off-by: Emil Velikov <[email protected]>
The callers are interested if the file is within the list of builtins or not. So change the return type and push the free() down the stack. Signed-off-by: Emil Velikov <[email protected]>
The index_mm_{search,read,dump}* API does not mutate the index_mm struct. So let's annotate it as constant. Signed-off-by: Emil Velikov <[email protected]>
87a36eb
to
113feec
Compare
@stoeckmann are you ok with this version? |
Won't stop merge process. I'd prefer |
For non-alias indexes prefix is an empty string, where strbuf_pushchars() returns the number of characters added to the strbuf. Since those are zero, we end up completely skipping the dump process. Cc: Tobias Stoeckmann <[email protected]> Fixes: 889d02b ("libkmod: check strbuf return values") Signed-off-by: Emil Velikov <[email protected]> Link: #224 Signed-off-by: Lucas De Marchi <[email protected]>
As seen with previous commit, the way we pass an empty string to index_{,mm_}dump() is very error prone. Swap that with a bool, which makes things a lot more obvious. Signed-off-by: Emil Velikov <[email protected]> Link: #224 Signed-off-by: Lucas De Marchi <[email protected]>
Signed-off-by: Emil Velikov <[email protected]> Link: #224 Signed-off-by: Lucas De Marchi <[email protected]>
The compiler already creates an empty string as applicable, drop the extra variable. Signed-off-by: Emil Velikov <[email protected]> Link: #224 Signed-off-by: Lucas De Marchi <[email protected]>
Create a simple helper and reuse it instead of duplicating code. Signed-off-by: Emil Velikov <[email protected]> Link: #224 Signed-off-by: Lucas De Marchi <[email protected]>
The callers are interested if the file is within the list of builtins or not. So change the return type and push the free() down the stack. Signed-off-by: Emil Velikov <[email protected]> Link: #224 Signed-off-by: Lucas De Marchi <[email protected]>
The index_mm_{search,read,dump}* API does not mutate the index_mm struct. So let's annotate it as constant. Signed-off-by: Emil Velikov <[email protected]> Link: #224 Signed-off-by: Lucas De Marchi <[email protected]>
@stoeckmann agreed. I created #233 so we don't forget. Let's see what is the clang-analyzer situation with that. Applied, thanks. |
We need tests for |
While looking at how to make the index API properly handle error conditions, I noticed that we completely broke the API.
The first commit fixes that + reintroduces earlier proposal of mine. The initial counter argument had a good point but was a bit absolute (aka thinking of a extreme case, that isn't applicable to us).
The rest are bunch of paper cuts, that I've accumulated as part of the initial goal.
/cc @stoeckmann can you check the first commit? can I offer some 🍪 for adding an in-tree test?
Random notes:
index_value::priority
is ignored when dumping... unlike thedepmod
equivalent