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

Fix getting properties #23

Merged

Conversation

Apostoln
Copy link
Contributor

  • Use syspath instead of sysname for udev
  • Add dev_path_to_sys_path() function
  • Return error if there no sys path

Close #22

There was a bug with incorrect syspath for udev. I've fixed it making an assumption we work only with block devices (and return the Error otherwise) and the syspath is always like /sys/class/block/.

I've tested it locally and with the integration tests in our project where we use block-utils. However, it's a bit complicated to write unit tests in the scope of this repo because it requires a kind of testing framework for loop devices, disks, partitions, filesystems, and so on. We have a kind of such one in progress, but it hasn't opensourced yet.

Well, I'm not sure by 100% that the assumption about /sys/class/block is general truth and this path exists for all block devices. There are a lot of other sys paths like /sys/devices/virtual/block/ and /sys/block/. Anyway, it looks like /sys/class/block is an expected syspath according to the examples in udev.

 - Use syspath instead of sysname for udev
 - Add dev_path_to_sys_path() function
 - Return error if there no sys path
@Apostoln
Copy link
Contributor Author

Apostoln commented Nov 17, 2020

I've found some potential problems, please don't merge now.

@Apostoln Apostoln marked this pull request as draft November 17, 2020 18:00
@Apostoln
Copy link
Contributor Author

Doesn't matter, it were unrelated problems with Fedora 33.

@Apostoln Apostoln marked this pull request as ready for review November 17, 2020 18:57
@cholcombe973
Copy link
Owner

This PR looks reasonable to me. Would you like me to merge it?

@Apostoln
Copy link
Contributor Author

@cholcombe973 Yes, thank you :)

@cholcombe973 cholcombe973 merged commit 5c2d130 into cholcombe973:master Nov 23, 2020
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.

get_block_dev_properties doesn't work
2 participants