fix: install-extras' preselect loop never ran more than once

for each in {1..${#_extras[@]}} doesn't expand as a range - bash does
brace expansion before parameter expansion, so the range endpoint
isn't resolved yet when brace expansion runs. The loop always ran
exactly once, leaving preselect at length 1 regardless of how many
extras exist. Invisible until now because there was only ever one
extra (model-cache-redirect); would have silently broken any
preselected-true default on a 2nd+ extra. Switched to a C-style loop.

This is almost certainly the multiselect misbehavior from years back -
tracked down while verifying multiselect() itself (functions/PRbL
submodule, fixed separately) didn't have a toggle-isolation bug.
This commit is contained in:
pyr0ball 2026-07-18 22:30:37 -07:00
parent bc9d1e564f
commit 95156f7ed2

View file

@ -318,7 +318,13 @@ install-extras(){
# done # done
boxborder "Which extras should be installed?" boxborder "Which extras should be installed?"
for each in {1..${#_extras[@]}} ; do # NOTE: {1..${#_extras[@]}} does NOT expand as a range - bash performs
# brace expansion before parameter expansion, so the range's endpoint
# isn't resolved yet when brace expansion runs. This always looped
# exactly once (leaving preselect at length 1 regardless of extras
# count), invisible only because there was ever just one extra. Use a
# C-style loop instead, which resolves ${#_extras[@]} correctly.
for ((each=0; each<${#_extras[@]}; each++)); do
preselect+=("false") preselect+=("false")
done done
multiselect result _extras preselect multiselect result _extras preselect