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

Testbed: Create "bus" and "class" dirs at init #145

Merged
merged 1 commit into from
Sep 11, 2021

Conversation

dlech
Copy link
Contributor

@dlech dlech commented Sep 10, 2021

libudev expects the "/sys/bus" and "/sys/class" directories to exist when calling udev_enumerate_scan_devices(). When this was called on an empty Testbed, it would return -ENOENT since these directories did not exist.

This fixes the issue by creating the "/sys/bus" and "/sys/class" directories at the same time that "/sys" is created in the Testbed.

num_udev_devices() is modified to call udev_enumerate_scan_devices() directly instead of using GUdev, which ignores the return value of udev_enumerate_scan_devices(). This makes t_testbed_empty() a valid test for the bug we are fixing.

Some vala tests also had to be modified to account for the change.

Fixes: #144

libudev expects the "bus" and "class" directories to exist when calling
udev_enumerate_scan_devices(). When this was called on an empty Testbed,
it would return -ENOENT since these directories did not exist.

This fixes the issue by creating the "/sys/bus" and "/sys/class" at the
same time that "/sys" is created in the Testbed.

num_udev_devices() is modified to call udev_enumerate_scan_devices()
directly instead of using GUdev, which ignores the return value of
udev_enumerate_scan_devices(). This makes t_testbed_empty() a valid
test for the bug we are fixing.

Some vala tests also had to be modified to account for the change.

Fixes: martinpitt#144
Copy link
Owner

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Very nice, thanks for the thorough fix and test!

@martinpitt martinpitt merged commit 5e82960 into martinpitt:master Sep 11, 2021
@dlech dlech deleted the fix-libudev-enumerate branch September 11, 2021 14:37
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.

udev_enumerate_scan_devices() fails with ENOENT because of missing "bus" and "class" folders
2 participants