[pacman-dev] pacman -Q broken
Hello, this commit broke pacman -Q : http://projects.archlinux.org/git/gitweb.cgi?p=pacman.git;a=commit;h=722db45... If the list of targets is empty, then it doesn't enter the loop, and no code is executed. Handling the case where there are no targets inside the loop visiting the targets is pretty funny in my opinion. So I tried to handle this case separately, but I find the whole function still very messy. Because this case is handled differently depending on the type of query. So what about making new function for each different query ? And not trying to handle all the cases in the same big for loop, but having a separate loop for each. Maybe it could be better that way.
I'm not sure it's a good idea, but I gave it a try. I added a function for config->group (-Qg) : query_group for config->op_q_isfile (-Q --file) : query_isfile and for config->op_q_search (-Qs) : query_search They all take a alpm_list_t *targets as argument. I changed query_fileowner to be consistent with the others, so it takes a list of targets too, instead of a single target. The patch is a bit long but is very simple, it mostly copy/pastes code around. I used the -b arg to ignore indentation fix, because it caused the patch to be twice bigger.
On 6/2/07, Xavier <shiningxc@gmail.com> wrote:
I'm not sure it's a good idea, but I gave it a try. I added a function for config->group (-Qg) : query_group for config->op_q_isfile (-Q --file) : query_isfile and for config->op_q_search (-Qs) : query_search They all take a alpm_list_t *targets as argument. I changed query_fileowner to be consistent with the others, so it takes a list of targets too, instead of a single target.
The patch is a bit long but is very simple, it mostly copy/pastes code around. I used the -b arg to ignore indentation fix, because it caused the patch to be twice bigger.
FYI, when you do submit the final patch, don't use the -b option next time- we don't care how long it gets, but we do want the final indentation to be right. I took your patch and applied it, and did some further work from there. (making the functions static, fixing indentation, etc.) I fixed the bug that broke pacman -Q in the same way it was fixed in the sync code. The next step here is to refactor the common code between the sync and query code into some unified functions. It shouldn't be too hard to do, but we do need to find a place for it. /me thinks It is sitting in my GIT working tree for now, it will eventually get pushed to the master branch on al.org. Thanks! -Dan
participants (2)
-
Dan McGee
-
Xavier