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

udev_enumerate_scan_devices() fails with ENOENT because of missing "bus" and "class" folders #144

Closed
dlech opened this issue Sep 10, 2021 · 0 comments · Fixed by #145
Closed

Comments

@dlech
Copy link
Contributor

dlech commented Sep 10, 2021

When using umockdev without loading any devices, udev_enumerate_scan_devices() will return -ENOENT since the "bus" and "class" directories have not been created yet. The current test for this doesn't fail because GUdev ignores the error from this function.

dlech added a commit to dlech/umockdev that referenced this issue Sep 10, 2021
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
dlech added a commit to dlech/umockdev that referenced this issue Sep 10, 2021
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
martinpitt pushed a commit that referenced this issue Sep 11, 2021
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 #144
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 a pull request may close this issue.

1 participant