Ask Your Question
0

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

asked 2013-01-30 20:42:46 -0500

Martin.W gravatar image

Hi!

I have defined: alias rm='rm -i' to prevent myself from desasters.

Unfortunately ROS setup.sh uses rm in a way, that I get asked to remove the file /tmp/setup.sh.XXXXX while logging in or starting a new bash (both source setup.sh).

Well, here is a patch, that adds a check and some quotes, too:

$ diff /opt/ros/groovy/setup.sh.orig /opt/ros/groovy/setup.sh
37,41c37,45
< 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"
> else
>  $SETUP_UTIL $@ > "$SETUP_TMP"
>  . "$SETUP_TMP"
>  rm -f "$SETUP_TMP"
> fi

might be worth a patch, but unfortunately I was not able to create an account on the bugtracker.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-01-31 07:29:05 -0500

Martin.W gravatar image

Ticket created: github.com/ros/catkin/issues/343

edit flag offensive delete link more
0

answered 2013-01-30 22:31:31 -0500

dornhege gravatar image

rm -f would override everyone's rm -i alias if they want it or not.

Maybe it would be better to do something like:

if [ -z $RM ]; then
    RM=$(which rm)
fi
...
use $RM
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-01-30 20:42:46 -0500

Seen: 339 times

Last updated: Jan 31 '13