ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
752 stars 911 forks source link

Problems with autocompleting `rosbag play` in zsh #2240

Open mnissov opened 2 years ago

mnissov commented 2 years ago

Tab-autocomplete in zsh is not working as expected with rosbag. Note, I'll start lines run in zsh with and lines run in bash with $

Demo

Create a workspace and create folders for two packages, pkg1 and pkg2. One will be symlinked and the other will be placed in the src/ folders.

❯ mkdir ~/catkin_ws/src -p
❯ mkdir ~/pkg1
❯ mkdir ~/catkin_ws/src/pkg2
❯ ln -s ~/pkg1 ~/catkin_ws/src
❯  ls ~/catkin_ws/src -al
total 12
drwxrwxr-x 3 arl arl 4096 May  2 11:20 .
drwxrwxr-x 3 arl arl 4096 May  2 11:19 ..
drwxrwxr-x 2 arl arl 4096 May  2 11:19 pkg2
lrwxrwxrwx 1 arl arl   14 May  2 11:20 pkg1 -> /home/arl/pkg1

Behavior

Expected behavior from bash

$ rosbag play catkin_ws/src/pkg
pkg1/ pkg2/ 

Pressing tab shows both options, i.e. autocomplete working as expected. Doing the equivalent operation in zsh results in

❯ rosbag play catkin_ws/src/pkg2/

autocompleting to pkg2, as if pkg1 didn't exist. Adding a third package mkdir ~/catkin_ws/src/pkg3 shows that pkg1 is entirely ignored

❯ rosbag play catkin_ws/src/pkg
pkg2/  pkg3/

Tab autocompleting in zsh works when using other commands, e.g. ls

❯ ls ~/catkin_ws/src/pkg
pkg1@  pkg2/  pkg3/

Misc

System running PopOs 20.04 LTS and ros noetic.

Included in the ~/.zshrc is the following line

source /opt/ros/noetic/setup.zsh