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

setup.sh uses rm without -f: errors on login/new shell #343

Closed
Marwe opened this issue Jan 31, 2013 · 0 comments
Closed

setup.sh uses rm without -f: errors on login/new shell #343

Marwe opened this issue Jan 31, 2013 · 0 comments
Assignees

Comments

@Marwe
Copy link

Marwe commented Jan 31, 2013

I have the issue described on answers.ros:
http://answers.ros.org/question/53777/setupsh-uses-rm-without-f-errors-on-loginnew-shell/
with a patch as below.
The other comment on answers might be worth to consider, although I do not see it being necessary to 'complicate' rm. $RM is not a default variable definition, and might also be dangerous, if you happen to have it set?

diff --git a/cmake/templates/setup.sh.in b/cmake/templates/setup.sh.in
index 4f5c662..1835215 100644
--- a/cmake/templates/setup.sh.in
+++ b/cmake/templates/setup.sh.in
@@ -34,11 +34,16 @@ export PKG_CONFIG_PATH
export PYTHONPATH

# invoke Python script to generate necessary exports of environment variables
-MKTEMP=`which mktemp`
-SETUP_TMP=`$MKTEMP /tmp/setup.sh.XXXXXXXXXX`
-$SETUP_UTIL $@ > $SETUP_TMP
-. $SETUP_TMP
-rm $SETUP_TMP
+MKTEMP="`which mktemp`"
+SETUP_TMP="`$MKTEMP /tmp/setup.sh.XXXXXXXXXX`"
+if [ $? -ne 0 ] ;  then
+  echo "ROS config error: creating tmp file for setup failed" >> "/dev/stderr"
+  return 3
+else
+ $SETUP_UTIL $@ > "$SETUP_TMP"
+ . "$SETUP_TMP"
+ rm -f "$SETUP_TMP"
+fi

# remember type of shell if not already set
if [ -z "$CATKIN_SHELL" ]; then
@ghost ghost assigned dirk-thomas Feb 4, 2013
cwecht pushed a commit to cwecht/catkin that referenced this issue Mar 20, 2018
cwecht pushed a commit to cwecht/catkin that referenced this issue Mar 20, 2018
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

No branches or pull requests

2 participants