Repository navigation
keventd: fix ENV{} match on unset properties - #513
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: with --with-keventd and the curated rules, input devices end up in /run/udev/data/cN:M without ID_INPUT, so libinput finds no devices. As a result, anything relying on libinput (Wayland stack specifically) would either not start or otherwise error out. This issue got surfaced when using keventd together with apps linked against eudev's libudev (MangoWM in this case).
Cause: match_key() in keventd/rules.c returns (op == OP_MATCH_NE) when the subject is NULL, which is the case for an unset ENV{}. udev treats an unset property as the empty string. As a result, ENV{ID_INPUT}=="" and ENV{ID_BUS}=="" never match, so the input_id and usb_id builtins never run.
Fix: use "" as the subject when the property is unset (one line).
Behavior change: the != side changes too. ENV{x}!="" is now false for unset x, as in udev. In the shipped rules this affects:
50-udev-default.rules: ENV{MODALIAS}!="" guarding the hwdb import
70-joystick.rules and 70-touchpad.rules: ENV{ID_BUS}!=""
80-net-name-slot.rules: ENV{ID_NET_NAME_*}!="" guarding NAME=
50-udev-default.rules: ENV{REMOVE_CMD}!="" guarding RUN+=
All of these were previously true for unset properties and are now correctly false.
Tested the patch myself against 5.0-rc1, and verified successfully fixing the issue.