-
Notifications
You must be signed in to change notification settings - Fork 35
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
Change the contract of get_typesupport_handle_function. #102
base: rolling
Are you sure you want to change the base?
Change the contract of get_typesupport_handle_function. #102
Conversation
Before it would set an RCUTILS error if the typesupport didn't match. But because this is essentially a probe, we change it to not set that on error and instead just return a nullptr. Callers can disambiguate between the probe not finding a typesupport and a real error by checking the return value for nullptr and then checking if `rcutils_error_is_set`. Signed-off-by: Chris Lalancette <[email protected]>
Full CI:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change to not set an error seems fine, though it's hard to judge because the purpose of the existing code is not clear to me.
The unrelated change to the first conditional change seems fine, but it makes the diff pretty hard to follow.
std::string library_name; | ||
try { | ||
library_name = rcpputils::get_platform_library_name(library_basename); | ||
} catch (const std::runtime_error & e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming exception
-> runtime_error
change is due to:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly.
return nullptr; | ||
} | ||
map->data[i] = lib; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any explanation of how this code works that you're aware of? It's a little strange that it modifies a non-const void **
member of a const type_support_t *
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I just moved it around. @hidmic was involved in the latest rewrite of it, I believe. Maybe he can shed some light.
Before it would set an RCUTILS error if the typesupport
didn't match. But because this is essentially a probe, we
change it to not set that on error and instead just return
a nullptr. Callers can disambiguate between the probe not
finding a typesupport and a real error by checking the return
value for nullptr and then checking if
rcutils_error_is_set
.Signed-off-by: Chris Lalancette [email protected]
I went ahead and checked all of the callers of these functions that I could find, and as far as I can tell all of them will be OK with this change. There may be some additional tests that are expecting the old error; besides the ones I fixed here, I didn't find any additional ones. But I didn't run them all, so the full CI run should help track that down.
This change should help resolve some of the errors on CentOS that occurred in CI in combination with ros2/rmw#293 . This is still a draft PR since I'm not 100% sure we want to do this; opinions welcome.
If we merge this, this will fix #100