Skip to content
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

Ensure that provides/requires versions are factored into dep filtering #68

Closed

Conversation

Conan-Kudo
Copy link
Member

This PR includes a patch from @mlschroe that fixes #67.

Reference: https://bugs.mageia.org/show_bug.cgi?id=19509

if (g_hash_table_lookup_extended(provided_hashtable, filename, NULL, &pvalue)) {
struct ap_value_struct *ap_value = pvalue;
if (!ap_value->flags || !ap_value->flags[0] || !flags || !flags[0] ||
(!g_strcmp0(ap_value->flags, flags) && !strcmp(ap_value->version, full_version)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strcmp -> g_strcmp0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in glibify commit

GHashTable *provided_hashtable = g_hash_table_new_full(g_str_hash,
g_str_equal,
NULL,
free);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g_free

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in glibify commit

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(you're aware that all those non-glib code is just copy'n'paste from some lines above/below? Now doing some glibification makes the code pretty inconsistent...)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mlschroe then someone have to change code from where it was copied ;)

pkg->provides = g_slist_prepend(pkg->provides, dependency);
struct ap_value_struct *pvalue = malloc(sizeof(struct ap_value_struct));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g_malloc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in glibify commit

@ignatenkobrain
Copy link

@Conan-Kudo also would be nice to get test for this.

@Conan-Kudo
Copy link
Member Author

Conan-Kudo commented Dec 15, 2016

@ignatenkobrain I'm not sure how to write tests for this. And in any case, this fix is rather important, since at least in Mageia, this broke the GNOME stack. It can break things subtly in other places using createrepo_c, like COPR and eventually Koji.

@Conan-Kudo
Copy link
Member Author

@Tojaj What do you think of the fix?

gpointer pvalue;
if (g_hash_table_lookup_extended(provided_hashtable, filename, NULL, &pvalue)) {
struct ap_value_struct *ap_value = pvalue;
if (!ap_value->flags || !ap_value->flags[0] || !flags || !flags[0] ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand this correctly then:
I we already have a file which doesn't have any flags in the hash table (!ap_value->flags) then we don't care about any other files with the same filename even if flags and versions are different?

struct ap_value_struct *ap_value = pvalue;
if (!ap_value->flags || !ap_value->flags[0] || !flags || !flags[0] ||
(!g_strcmp0(ap_value->flags, flags) && !g_strcmp0(ap_value->version, full_version)))
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the condition is on two lines and indentation could be confusing, could you please put curly brackets around the continue; single line scope?

Tojaj added a commit that referenced this pull request Dec 26, 2016
This should avoid situations where a package provides and requires same
capability (a dependency) with different versions but createrepo_c
strip the require down (because it already saw it in provides).

This should fix the issue in a better way than PR #68
@Tojaj
Copy link
Contributor

Tojaj commented Dec 26, 2016

I created a new PR #70 which uses name-flags-version for dep checking, thus with this patch, if a package provides foo <= 20 and requires foo > 20then it should be processed correctly (the provide shouldn't be stripped).

@Conan-Kudo
Copy link
Member Author

Closing in favor of #70

@Conan-Kudo Conan-Kudo closed this Jan 16, 2017
@Conan-Kudo Conan-Kudo deleted the fixdepfiltering branch January 16, 2017 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

createrepo_c filters requires from a package in metadata even when it provides a different version of it
4 participants