The change
cfe54b794b3814f288009b796e82668ba8846ca1 missed
handling unbound arrays with `set -u`.
Issue: RELENG-2013
Change-Id: Ic37ce0404f13bff04aa4122c9b1c91add78e2145
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
--- /dev/null
+---
+fixes:
+ - |
+ Fix error with handling unbound arrays for search extensions, when using
+ `set -u`. The correct way of using this.
+
+ .. code-block:: bash
+
+ set -u
+ arr=()
+ echo "output: '${arr[@]}'"
+ bash: arr[@]: unbound variable
+ echo "output: '${arr[@]:-}'"
+ foo: ''
# Handle multiple search extensions as separate values to '-p|--pattern'
set -f # Disable pathname expansion
+ search_exts=()
IFS=' ' read -r -a search_exts <<< "${ARCHIVE_ARTIFACTS:-}"
pattern_opts=()
- for search_ext in "${search_exts[@]}";
+ for search_ext in "${search_exts[@]:-}";
do
pattern_opts+=("-p" "$search_ext")
done