#1334 PR merged
: Fixed REQUIRED_PROGS tests (related to issue1233)¶
Labels: cleanup
, fixed / solved / done
jsmeix opened issue at 2017-04-27 14:31:¶
In
https://github.com/rear/rear/commit/463a2651af982723f843beccdf33f71a0352fa53
the fix for
usr/share/rear/prep/default/95_check_missing_programs.sh
made the REQUIRED_PROGS test therein work again
but the same code in usr/sbin/rear was not fixed
(with this pull request it gets fixed at both places).
But 'declare -a MISSING_PROGS' contradicted the intent
that is explained in the comment above in the code.
An empty array does not work with 'set -u'
(here on my SLES11-SP4 system with GNU bash, version 3.2.57):
# declare -a arr # set -u # echo $arr -bash: arr: unbound variable # echo ${arr[*]} -bash: arr[*]: unbound variable # echo ${arr[@]} -bash: arr[@]: unbound variable # echo "${arr[@]}" -bash: arr[@]: unbound variable
'declare -a arr' is the same as 'arr=()'.
One must have an array with at least one (empty) member.
jsmeix commented at 2017-04-27 14:35:¶
@gdha @gozora
I set you as reviewers mainly FYI
so that you could also have a look here because I think
this is an interesting example how complicated things
could get if one likes to use bash arrays with 'set -u'
cf.
https://github.com/rear/rear/issues/700
jsmeix commented at 2017-04-28 09:43:¶
I like to merge it because in its current form
it works both with and without 'set -ue'
but now both code parts are in sync and
work as described in their comments
so that this pull request is at least a "cleanup".
But I removed the "enhancement" label because of
https://github.com/rear/rear/issues/700#issuecomment-297944196
[Export of Github issue for rear/rear.]