-
Notifications
You must be signed in to change notification settings - Fork 912
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
fix topic_tools environment hook #1486
Conversation
Without this commit, `source /opt/ros/$ROS_DISTRO/setup.bash` fails under the following conditions: 1. topic_tools is installed 2. rosbash is not installed 3. the bash shell has the following options set (which is the default in GitLab CI): set -o errexit set -o pipefail What happens is that since rosbash is not installed, `$(complete | grep -w rosrun)` finds no match, and grep exits with status 1. Since `pipefail` is enabled, this error code is propagated to the return value of the pipe. Since `errexit` is enabled, the script exits immediately. This commit catches grep exit status 1 (= "no match") and passes everything else through.
I've verified that the bug exists in melodic + kinetic, and that this PR fixes it: https://gitlab.com/mintar/ros_comm/-/jobs/89166959 https://gitlab.com/mintar/ros_comm/blob/ci/.gitlab-ci.yml This PR should also be backported to kinetic and lunar. |
BTW: I had a hell of a time figuring out what the problem exactly was and why I could reproduce it in GitLab CI, but not locally, before I thought of the shell options. Now I can reproduce it reliably both in GitLab CI and locally. |
Thank you for the patch. |
@dirk-thomas Thanks for merging! Could you please also backport this patch to kinetic + lunar? |
👍 After it has been released into Melodic it will be consider for backporting. |
Without this commit, `source /opt/ros/$ROS_DISTRO/setup.bash` fails under the following conditions: 1. topic_tools is installed 2. rosbash is not installed 3. the bash shell has the following options set (which is the default in GitLab CI): set -o errexit set -o pipefail What happens is that since rosbash is not installed, `$(complete | grep -w rosrun)` finds no match, and grep exits with status 1. Since `pipefail` is enabled, this error code is propagated to the return value of the pipe. Since `errexit` is enabled, the script exits immediately. This commit catches grep exit status 1 (= "no match") and passes everything else through.
Without this commit,
source /opt/ros/$ROS_DISTRO/setup.bash
fails under the following conditions:topic_tools is installed
rosbash is not installed
the bash shell has the following options set (which is the default in GitLab CI):
set -o errexit
set -o pipefail
What happens is that since rosbash is not installed,
$(complete | grep -w rosrun)
finds no match, and grep exits with status 1. Sincepipefail
is enabled, this error code is propagated to the return value of the pipe. Sinceerrexit
is enabled, the script exits immediately.This commit catches grep exit status 1 (= "no match") and passes everything else through.
Supersedes #1484.