martinpitt / umockdev

Mock hardware devices for creating unit tests and bug reporting
https://launchpad.net/umockdev
GNU Lesser General Public License v2.1
308 stars 55 forks source link

Fix uevent race condition in add_from_string() #174

Closed martinpitt closed 2 years ago

martinpitt commented 2 years ago

We were sending the add uevent before setting up the binary/link attributes and setting up the device node, which causes race conditions in consumers.

To fix that, introduce an internal add_devicev_no_uevent() method which does everything from testbed_add_devicev() except sending the uevent. Use that new helper from both that function and add_from_string() after everything is ready.

Fixes #173