Workaround for legacy Bash array expansion
Some older versions of Bash have a bug that treats '${array[@]}' as
an undefined variable access if the array is empty. Under normal
circumstances, it results in an empty string. However, this crashes
with 'set -u'. Since we do run with this setting for safety, and
Busytown seems to be using an affected version of Bash, replace uses
of this construct with '${array[@]+"${array[@]}"}'. Uses where the
array cannot be empty are left unchanged.
Analysis of the bug:
https://gist.github.com/dimo414/2fb052d230654cc0c25e9e41a9651ebe
Change-Id: I1bbfbee3ac0266db531d5d4d693def8292bf7358
3 files changed