Skip to content

Fix ros2 interface show for msg files in subfolders (humble)#1249

Open
xin700 wants to merge 1 commit into
ros2:humblefrom
xin700:fix/interface-show-subfolder-msgs-humble
Open

Fix ros2 interface show for msg files in subfolders (humble)#1249
xin700 wants to merge 1 commit into
ros2:humblefrom
xin700:fix/interface-show-subfolder-msgs-humble

Conversation

@xin700

@xin700 xin700 commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • Fix ros2 interface show for packages that install interface files under nested subdirectories (e.g. msg-common/GenericObject.msg in mrpt_msgs).
  • Replace rosidl_runtime_py.get_interface_path() with lookup via the rosidl_interfaces ament index resource, matching the approach in fix non standard interface locations. (#1186) #1205 (kilted backport).

Fixes #1186

Problem

On Humble, ros2 interface show mrpt_msgs/msg/GenericObject fails with InvalidResourceName: // because get_interface_path() cannot resolve interfaces whose .msg files live outside the conventional msg/<Name>.msg layout.

Solution

Use ament_index_python.resources.get_resource('rosidl_interfaces', pkg_name) to find the installed interface file path, then open it from the package share directory.

Test plan

  • Reproduced failure on system Humble before fix:
    ros2 interface show mrpt_msgs/msg/GenericObject  # InvalidResourceName: //
  • Verified fix with overlay build:
    source install/setup.bash
    ros2 interface show mrpt_msgs/msg/GenericObject  # prints message definition
    ros2 interface show std_msgs/msg/String          # still works
  • Updated test_show_not_an_interface expected error message
  • colcon build --packages-select ros2interface succeeds
  • Full ros2interface CLI test suite (requires ros-humble-test-msgs in CI)

Related

Backport of the fix approach from #1205 to the humble branch.

Made with Cursor

Use rosidl_interfaces resource index instead of get_interface_path()
so interface files under nested directories (e.g. msg-common/Foo.msg)
resolve correctly. Backport of the approach from ros2cli#1205.

Fixes ros2#1186
@mergify

mergify Bot commented Jun 29, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@fujitatomoya fujitatomoya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

1st we need to make sure to merge #1205 to the rolling branch, and then we can backport the fix to the downstream automatically. it looks like backport is straightforward, i do not think we need this backport PR.

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.

2 participants