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

rules: Fix wild card handling #499

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Conversation

wismill
Copy link
Member

@wismill wismill commented Aug 20, 2024

The handling of wild card * is different in libxkbfile and X server: wild card matches empty strings for model and option but not for layout nor variant, while in libxkbcommon wild cards always match empty strings.

See:

The difference of handling between the components is unfortunately not documented, but we should follow the behavior of the original implementations for consistency.

  • Fixed by implementing the same behavior than libxkbfile.
  • Added tests and fixed failing tests.

Fixes #497

@wismill wismill requested review from bluetech and whot August 20, 2024 15:11
@wismill wismill added bug Indicates an unexpected problem or unintended behavior X11 legacy: compatibility Indicate a need to ensure compatibility with X11 labels Aug 20, 2024
src/xkbcomp/rules.c Outdated Show resolved Hide resolved
test/data/rules/wildcard Outdated Show resolved Hide resolved
@whot
Copy link
Contributor

whot commented Aug 22, 2024

let's cc @daniels and @bluetech explicitly, if this differs from the original implementation there may be a reason for it they remember?

The handling of wild card `*` is different in libxkbfile and X server:
wild card matches empty strings for model and option but not for layout
nor variant, while in libxkbcommon wild cards always match empty strings.

See:
- https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/blob/bf985c68acb1244f51ec91414532a2347fbc1c4c/src/maprules.c#L687
- https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/blob/bf985c68acb1244f51ec91414532a2347fbc1c4c/src/maprules.c#L712

The difference of handling between the components is unfortunately not
documented, but we should follow the behavior of the original
implementations for consistency.

- Fixed by implementing the same behavior than libxkbfile.
- Added tests and fixed failing tests.
- Improve the documentation of rules to highlight the special behavior.
@wismill
Copy link
Member Author

wismill commented Sep 8, 2024

@fooishbar @bluetech kind reminder 🙂

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

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

Looks good to me, I probably just didn't notice this difference in libxkbfile. Thanks!

@wismill wismill merged commit 05ba96d into xkbcommon:master Sep 16, 2024
4 checks passed
@wismill wismill deleted the rules/fix-wildcard branch September 16, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior X11 legacy: compatibility Indicate a need to ensure compatibility with X11
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rules: setxkbmap deals with empty component differently
3 participants