-
Notifications
You must be signed in to change notification settings - Fork 763
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
[rosbash] zsh completion error #83
Comments
The completion seems to work fine for me with the following example:
Can you please try it with this example. If that works for you it is likely related to something in your custom package. |
I reckon the oddity must come from catkin_find:
So I dug a bit further in the code and tried to understand why it'd return several times the same path. I found the actual search function, find_in_workspaces (line 90 in /opt/ros/indigo/lib/python2.7/site-packages/catkin/find_in_package.py), I added a few prints to debug and observed this :
Where 'lib' is searched through one more time for each consecutive workspace. So I found that this (line 120): for workspace in (_workspaces or []):
if 'libexec' in search_dirs:
search_dirs.insert(search_dirs.index('libexec'), 'lib') adds "lib" to the search_dirs list for every workspace iterated through, so when it reaches the third one it'll search in its subdirectory /lib three times. That seem very weird to me and very probably an error. Should I move this issue to the catkin repository? |
Can you please apply the changes from the references PR (just moving the two lines a few lines up) to your local Python code and try if that already solves the problem of the zsh completion for you? |
The completion also works for me for your turtlesim example without that patch. Can you please test the exact example I mentioned? May be something else is different on your system. Please also provide more information about your environment, e.g. ROS_PACKAGE_PATH, CMAKE_PREFIX_PATH. |
It's a tricky bug to reproduce. See I just reinstalled the packages to check if it was still happening before installing the latest revision, and it doesn't with my own packages anymore, but still with the others. That's because I migrated from catkin_make to catkin build, which apparently changed my variables. Here they are :
Maybe completion works for you because its workspace is the first in CMAKE_PREFIX_PATH ? (where catkin_find returns only one result) |
I have tried it with a single as well as two overlayed workspaces but was unable to reproduce your problem. Can you please try to provide a reproducible example. I am not convinced that the zsh completion does not need fixing. |
Well I don't really know what to provide I haven't already. Given the code, catkin_find should return several times the same path for any package it find in a part of the path that is not the first one. Are you trying catkin_find or directly autocomplete ? maybe there's a difference between our configs for zsh that makes yours handle the multiline variable better than mine ? That'd be surprising but at that point ... If you want to foolproof zsh completion against other bugs that'd produce a multiline variable, I think replacing --without-underlays with --first-only in roszsh, or even safer, adding |
You could e.g. share the rosinstall file(s) for your workspace(s) (you can create them using So simply the steps for someone else to reproduce your exact setup. Otherwise it is not clear to me that you problem is completely fixed. |
Ok so I reverted catkin to the unpatched version (0.6.14) and here's a complete transcript of what I did :
|
Thank you for the example. Based on that another fix would be to invoke
But with the option To be more defensive about it I have modified these too: |
Any chance of there being an indigo release soon to push this fix? |
Since the actual patch is in Until then you could apply the patch from ros/catkin#713 locally to have it working immediately. |
Argh, I just spent over an hour tracking this bug down before finding this issue. @dirk-thomas , perhaps it would be a good idea to sent a notification of this to ros-users to save others the hassle? After all, the last Indigo update broke rosrun + roslaunch for every ROS zsh user. BTW, here's some step-by-step instructions for applying the patch from ros/catkin#713 locally, as @dirk-thomas suggested:
|
Well, actually it wasn't the last update that broke this. If I read my apt logs correctly, it's already broken for a month now. So perhaps we don't need a ros-users announcement; everyone who cares already has fixed it or given up. |
I recently updated all my ROS packages to 1.11.8, I started having issues with command completion in zsh. Trying to rosrun a program (package = mipex_sensor, program = "mipex_node"), I type rosrun mip, which autocompletes the package to mipex_sensor as expected, then I type mip again and I get :
I can see the error comes from the completion script executing find with a would-be-multiline argument which ends up single-line because the \n is uninterpreted. After fiddling around I find the source of the issue : /opt/ros/indigo/share/rosbash/roszsh, _roscomplete_search_dir(), line 329 :
opts=`find $pkgdir $catkin_package_libexec_dir ${=1} -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1/g"`
with some debugging, I find that the problem comes from $catkin_package_libexec_dir. Strangely enough, echo'ing it shows a newline, but when passed as arg to find, the newline turns back into a \n. Or maybe it's correctly passed with a newline but still as a single string (as if quoted) ? I'm not sure. Regardless, I came up with this workaround :
opts=`find $pkgdir $( echo -en "$catkin_package_libexec_dir" ) ${=1} -print0 | tr '\000' '\n' | sed -e "s/.*\/\(.*\)/\1/g"`
Hope that helps :p. Keep up the awesome work
Distro: Arch Linux
Version: 1.11.8
The text was updated successfully, but these errors were encountered: