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

Change the contract of get_typesupport_handle_function. #102

Draft
wants to merge 1 commit into
base: rolling
Choose a base branch
from

Conversation

clalancette
Copy link
Contributor

@clalancette clalancette commented Jan 6, 2021

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 clalancette@openrobotics.org

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

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 <clalancette@openrobotics.org>
@clalancette
Copy link
Contributor Author

clalancette commented Jan 6, 2021

Full CI:

Copy link
Contributor

@sloretz sloretz left a 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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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;
Copy link
Contributor

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 *.

Copy link
Contributor Author

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.

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.

Review the contract of get_typesupport_handle_function
2 participants