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

Iterate user table in a sorted way, fix tests with latest glib #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SunilMohanAdapa
Copy link
Contributor

This is primarily to help test cases which assume that the adopted algorithm
prioritizes the users in the exact reverse order they appear in the test
cases (and get inserted into the session in reverse order). With older glib
version, the five users being inserted happened to return the order expected by
the tests. With latest glib, due to a minor tweak in hashing strategy, the
insertion leads to unsorted list leading to failed tests.

In addition, GHashTable makes no guarantees about the stability of items when
iterating multiple times. Since the algorithm is sensitive to order of users, it
is best to return users in an order that is consistent over multiple calls and
stable over insert/remove operations.

This patch sorts the keys during iteration of users in the user table.

Closes: #22.

Signed-off-by: Sunil Mohan Adapa sunil@medhas.org

Tested on Debian:

  • Buster with libglib2.0-0: 2.58.3-2+deb10u2
  • Sid with libglib2.0-0: 2.64.3-1

This is primarily to help test cases which assume that the adopted algorithm
prioritizes the users in the exact reverse order they appear in the test
cases (and get inserted into the session in reverse order). With older glib
version, the five users being inserted happened to return the order expected by
the tests. With latest glib, due to a minor tweak in hashing strategy, the
insertion leads to unsorted list leading to failed tests.

In addition, GHashTable makes no guarantees about the stability of items when
iterating multiple times. Since the algorithm is sensitive to order of users, it
is best to return users in an order that is consistent over multiple calls and
stable over insert/remove operations.

This patch sorts the keys during iteration of users in the user table.

Closes: gobby#22.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
@SunilMohanAdapa
Copy link
Contributor Author

This is an alternative implementation to #25. Only one of the patches should be merged.

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.

test failure in Debian bullseye: session/test-01.xml... .(bcacfghi vs. acbcfghi) FAILED
1 participant