Skip to content

Commit ac9d08c

Browse files
iavclaude
authored andcommitted
(#9400 P3c) armbian-bsp-cli-deb: safe array assignment from word splitting
Replace unquoted array assignment `arr=(${var})` with `IFS=' ' read -ra arr <<< "${var}"` to prevent glob expansion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cb3bedf commit ac9d08c

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

lib/functions/bsp/armbian-bsp-cli-deb.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,19 @@ function compile_armbian-bsp-cli() {
143143
# Using bootscript, copy it to /usr/share/armbian
144144

145145
case "${bootscript_info[bootscript_src]}" in
146-
*'.template')
147-
display_alert "Rendering boot script template" "${bootscript_info[bootscript_file_fullpath]} -> ${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}" "info"
148-
run_host_command_logged cat "${bootscript_info[bootscript_file_fullpath]}" |
149-
render_bootscript_template > "${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}"
150-
151-
if ! proof_rendered_bootscript_template "${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}" ; then
152-
exit_with_error "Render of bootscript template was not successful. Inspect '${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}' for unrendered variables."
153-
fi
154-
;;
155-
*)
156-
display_alert "Deploying boot script" "${bootscript_info[bootscript_file_fullpath]} -> ${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}" "info"
157-
run_host_command_logged cp -pv "${bootscript_info[bootscript_file_fullpath]}" "${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}"
158-
;;
146+
*'.template')
147+
display_alert "Rendering boot script template" "${bootscript_info[bootscript_file_fullpath]} -> ${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}" "info"
148+
run_host_command_logged cat "${bootscript_info[bootscript_file_fullpath]}" |
149+
render_bootscript_template > "${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}"
150+
151+
if ! proof_rendered_bootscript_template "${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}"; then
152+
exit_with_error "Render of bootscript template was not successful. Inspect '${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}' for unrendered variables."
153+
fi
154+
;;
155+
*)
156+
display_alert "Deploying boot script" "${bootscript_info[bootscript_file_fullpath]} -> ${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}" "info"
157+
run_host_command_logged cp -pv "${bootscript_info[bootscript_file_fullpath]}" "${destination}/usr/share/armbian/${bootscript_info[bootscript_dst]}"
158+
;;
159159
esac
160160

161161
if [[ "${bootscript_info[has_bootenv]}" == "yes" ]]; then
@@ -233,7 +233,7 @@ function compile_armbian-bsp-cli() {
233233
# if freeze variable is removed, upgrade becomes possible again
234234
if [[ "${BETA}" != "yes" ]]; then
235235
for pin_variants in $(echo $KERNEL_UPGRADE_FREEZE | sed "s/,/ /g"); do
236-
extracted_pins=(${pin_variants//@/ })
236+
IFS=' ' read -ra extracted_pins <<< "${pin_variants//@/ }"
237237
if [[ "${BRANCH}-${LINUXFAMILY}" == "${extracted_pins[0]}" ]]; then
238238
cat <<- EOF >> "${destination}"/etc/apt/preferences.d/frozen-armbian
239239
Package: linux-*-${extracted_pins[0]}

0 commit comments

Comments
 (0)