While unlikely, it is not inconceivable that a bug could be introduced into the script whereby one or more of the shell variables evaluates to an empty string, thus causing rm to attempt to remove the wrong thing. The presence of the -f force flag adds additional jeopardy.
The ash script contains two calls to
rm
of directory entries that are prefixed by shell variables:While unlikely, it is not inconceivable that a bug could be introduced into the script whereby one or more of the shell variables evaluates to an empty string, thus causing
rm
to attempt to remove the wrong thing. The presence of the-f
force flag adds additional jeopardy.A famous variant of this problem was the Ran steam. It deleted everything on system owned by user bug where a Steam bash script ran
rm -rf "$STEAMROOT/"*
when$STEAMROOT
was inadvertently empty. More discussion here.Some suggestions for mitigating a mistake:
rm
command