I’m currently working on a dependency bug checker that runs on ROS packages and tries to detect missing dependencies.
I’ve detected a few bugs in bash scripts in packages where a dependency run in the script is not specified as exec/run_depends in package.xml files.
I verify every parsed command against a list of default commands available in a base ROS distribution, which leads me to my question regarding best practices in bash scripts in ROS:
On various internet sites (ie. https://askubuntu.com/a/425990) sudo should never be used inside scripts, but scripts should instead be run using sudo and commands in the script can then be assumed to run with elevated privileges. I detect a lot of sudo’ing which I have labelled as an error so far, mainly due to sudo not also not being available when running packages in the official docker ROS image, which makes every single package with sudo in shell scripts error out when running ROS in docker.
My question is then:
- What is the best practices regarding using sudo in bash scripts contained in a ROS package?
Thanks for any answers in advance.