-
Notifications
You must be signed in to change notification settings - Fork 125
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
bin/xbps-repodb: add new tool to manage multiple repositories at once #286
base: master
Are you sure you want to change the base?
Conversation
This currently only supports -p/--purge to remove obsolete binary package files from repositories with the awareness that different noarch package version can co-exist within a repository in different architectures repository indexes.
This pull request introduces 1 alert when merging 0aa996b into 1594129 - view on LGTM.com new alerts:
|
xbps_error_printf("invalid repodata: %s\n", name); | ||
exit(1); | ||
} | ||
strncpy(arch->arch, name, d-name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strncpy(3)
should use the size of the destination for n
, i.e. strncpy(arch->arch, name, sizeof(arch->arch));
, not a size depending on the source. I see you made sure it fits into arch->arch
before but gcc or clang will probably complain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... no, they don't complain. Probably gcc is smart enough to see that this is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used to copy only the architecture part from from XXX-repodata
, n is used here as how many bytes to copy and not as limit, for the limit use case I would have used xbps_strlcpy
.
I have another use case. I accidentially just added |
I think its better to not allow |
Hmm this shouldn't have been possible, xbps/bin/xbps-rindex/index-add.c Lines 271 to 276 in 1594129
|
My bad. I didn't see the error message and for |
My plan for
|
Great that you found time to start working on this! |
Is it assured that for each stagedata there is repodata at same time? |
struct xbps_handle xh; | ||
const struct option longopts[] = { | ||
{ "debug", no_argument, NULL, 'd' }, | ||
{ "dry-run", no_argument, NULL, 'n' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing "purge" long option here
main(int argc, char **argv) | ||
{ | ||
int c = 0, rv = 0; | ||
struct xbps_handle xh; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you do struct xbps_handle xh = { };
instead of a memset below? It should initialize the whole struct to zero and is easier to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this isn't ISO C. struct xbps_handle xh = { 0 };
should work too.
This currently only supports -p/--purge to remove obsolete binary
package files from repositories with the awareness that different
noarch package version can co-exist within a repository in
different architectures repository indexes.