[ros-users] [Discourse.ros.org] [Quality Assurance] sudo usage in rosdistro packages

Anders Fischer ros.discourse at gmail.com
Thu Dec 20 20:47:37 UTC 2018


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.

[Visit Topic](https://discourse.ros.org/t/sudo-usage-in-rosdistro-packages/7188/1) or reply to this email to respond.

More information about the ros-users mailing list