-
Notifications
You must be signed in to change notification settings - Fork 139
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
Subject.get_best_query
's with_filenames
argument is not honored
#1673
Comments
After a bit of experimenting - this regression is a side effect of the patch #1670. Lines 2751 to 2757 in fbd3447
This causes the query is returned even before the string was searched in file lists. It looks like |
The change in behavior with POOL_FLAG_ADDFILEPROVIDESFILTERED is unintended. I changed the way libsolv sets up the lazy fileprovides lookup so that it works like before. See openSUSE/libsolv@2150865 I don't know if this is relevant to the slowness issue. |
Turning on POOL_FLAG_ADDFILEPROVIDESFILTERED made the lookup of all file dependencies lazy, not only the ones required by some dependency. This changes the way searching works and may also slow down some use cases. We now changed addfileprovides() to record the needed non-standard file dependencies and only make those lazy in createwhatprovides().
@mlschroe the linked commit doesn't seem to affect this particular issue. Though while looking into this I extracted the following snippet: #include "solv/pool.h"
#include "solv/repo.h"
static const char * input = "/usr/lib/file";
int main() {
Id p, pp;
Solvable * s;
Pool * pool = pool_create();
pool_set_flag(pool, POOL_FLAG_ADDFILEPROVIDESFILTERED, 1);
Repo * repo = repo_create(pool, "repo");
Repodata * data = repo_add_repodata(repo, 0);
// add pkg with provide
s = pool_id2solvable(pool, repo_add_solvable(repo));
s->name = pool_str2id(pool, "foo", 1);
s->evr = pool_str2id(pool, "1-2", 1);
s->arch = pool_str2id(pool, "x86_64", 1);
Id reldep = pool_rel2id(pool, s->name, s->evr, REL_EQ, 1);
s->provides = repo_addid_dep(repo, s->provides, reldep, 0);
// add "/usr/lib/file" file to pkg
Id did = repodata_str2dir(data, "/usr/lib", 1);
repodata_add_dirstr(data, s - pool->solvables, SOLVABLE_FILELIST, did, "file");
repodata_internalize(data);
pool_addfileprovides(pool);
pool_createwhatprovides(pool);
// Get all packages providing `input`
Id path_id = pool_str2id(pool, input, 1);
FOR_PROVIDES(p, pp, path_id) {
s = pool->solvables + p;
printf("FOR_PROVIDES: %s\n", pool_solvable2str(pool, s));
}
pool_free(pool);
return 0;
} It is odd to me that while the I did find another approach that seems to work regardless of the int flags;
Queue q;
queue_init(&q);
flags = SELECTION_PROVIDES;
selection_make(pool, &q, input, flags);
flags = SELECTION_FILELIST|SELECTION_SUBTRACT;
selection_make(pool, &q, input, flags);
Queue pq;
queue_init(&pq);
selection_solvables(pool, &q, &pq);
for (int j = 0; j < pq.count; j++) {
printf("provides wihtout filelists: %s\n", pool_solvable2str(pool, pool_id2solvable(pool, pq.elements[j])));
}
queue_free(&q); |
Yes, this happens because the path_id is added after the pool_createwhatprovides(() call. Fixed now in commit openSUSE/libsolv@081580d |
Thanks, that fixes this issue. |
Since the latest libdnf update,
hawkey.Subject.get_best_query
does not honor thewith_filenames
argument. Filenames are still matched even ifwith_filenames
is explicitly set toFalse
.This is breaking fedrq's unit tests that check that our wrapper of the Subject API returns the correct results when
with_filenames
is disabled.The text was updated successfully, but these errors were encountered: