Summary
We have a workaround in internal/metadata/evaluator.go for a bug in mvdan.cc/sh where array slicing inside double quotes returns the full array instead of the slice.
The Bug
# Bash (correct)
$ bash -c 'a=(1 2 3 4 5); echo "${a[@]:2:2}"'
3 4
# mvdan.cc/sh (wrong)
$ gosh -c 'a=(1 2 3 4 5); echo "${a[@]:2:2}"'
1 2 3 4 5
Without quotes it works correctly:
$ gosh -c 'a=(1 2 3 4 5); echo ${a[@]:2:2}'
3 4
Upstream
Workaround
internal/metadata/evaluator.go — The ver_cut function uses indexed variables (comp_0, comp_1, ...) instead of array slicing to avoid the bug.
Action Items
Related
Summary
We have a workaround in
internal/metadata/evaluator.gofor a bug in mvdan.cc/sh where array slicing inside double quotes returns the full array instead of the slice.The Bug
Without quotes it works correctly:
$ gosh -c 'a=(1 2 3 4 5); echo ${a[@]:2:2}' 3 4Upstream
Workaround
internal/metadata/evaluator.go— Thever_cutfunction uses indexed variables (comp_0,comp_1, ...) instead of array slicing to avoid the bug.Action Items
Related