Skip to content

Commit 11836c0

Browse files
jnqnferhertzog
authored andcommitted
fix $@ parameter expansion issues
$@ when unquoted is subject to further word splitting. this fixes a bunch of instances where it was incorrectly being used unquoted. Gbp-Dch: Short
1 parent f6a50b6 commit 11836c0

12 files changed

+245
-252
lines changed

functions/aliases.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ In_list ()
2020
shift
2121

2222
local ITEM
23-
for ITEM in ${@}
24-
do
25-
if [ "${NEEDLE}" = "${ITEM}" ]
26-
then
23+
for ITEM in "${@}"; do
24+
if [ "${NEEDLE}" = "${ITEM}" ]; then
2725
return 0
2826
fi
2927
done
@@ -34,8 +32,7 @@ In_list ()
3432
Truncate ()
3533
{
3634
local FILE
37-
for FILE in ${@}
38-
do
35+
for FILE in "${@}"; do
3936
if [ ! -L ${FILE} ]
4037
then
4138
: > ${FILE}

functions/conffile.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ Get_conffiles ()
1717
FILES="${LB_CONFIG}"
1818
else
1919
local FILE
20-
for FILE in ${@}
21-
do
20+
for FILE in "${@}"; do
2221
FILES="${FILES} ${FILE} ${FILE}.${LB_ARCHITECTURES} ${FILE}.${DISTRIBUTION}"
2322
FILES="${FILES} config/$(echo ${PROGRAM} | sed -e 's|^lb_||')"
2423
FILES="${FILES} config/$(echo ${PROGRAM} | sed -e 's|^lb_||').${ARCHITECTURE}"

functions/packagelists.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ Expand_packagelist ()
2626
local _LB_NESTED=0
2727
local _LB_ENABLED=1
2828

29-
for _LB_SEARCH_PATH in ${@}
30-
do
29+
for _LB_SEARCH_PATH in "${@}"; do
3130
if [ -e "${_LB_SEARCH_PATH}/${_LB_LIST_NAME}" ]
3231
then
3332
_LB_LIST_LOCATION="${_LB_SEARCH_PATH}/${_LB_LIST_NAME}"

functions/stagefile.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Require_stagefiles ()
7474
local FILE
7575
local MISSING=""
7676
local MISSING_COUNT=0
77-
for FILE in ${@}; do
77+
for FILE in "${@}"; do
7878
if [ ! -f ".build/${FILE}" ]; then
7979
MISSING_COUNT=$(( $MISSING_COUNT + 1 ))
8080
MISSING="${MISSING:+$MISSING }${FILE}"

functions/wrapper.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ Apt ()
1616

1717
case "${LB_APT}" in
1818
apt|apt-get)
19-
Chroot ${CHROOT} apt-get ${APT_OPTIONS} ${@}
19+
Chroot ${CHROOT} apt-get ${APT_OPTIONS} "${@}"
2020
;;
2121

2222
aptitude)
23-
Chroot ${CHROOT} aptitude ${APTITUDE_OPTIONS} ${@}
23+
Chroot ${CHROOT} aptitude ${APTITUDE_OPTIONS} "${@}"
2424
;;
2525
esac
2626
}

scripts/build/binary

+49-49
Original file line numberDiff line numberDiff line change
@@ -28,78 +28,78 @@ Init_config_data "${@}"
2828
Setup_clean_exit
2929

3030
# Preparing root filesystem
31-
lb binary_chroot ${@}
31+
lb binary_chroot "${@}"
3232

3333
if [ "${LB_BUILD_WITH_CHROOT}" = "true" ]
3434
then
3535
# Configuring chroot
36-
lb chroot_devpts install ${@}
37-
lb chroot_proc install ${@}
38-
lb chroot_selinuxfs install ${@}
39-
lb chroot_sysfs install ${@}
40-
lb chroot_hosts install ${@}
41-
lb chroot_resolv install ${@}
42-
lb chroot_hostname install ${@}
43-
lb chroot_dpkg install ${@}
44-
lb chroot_sysv-rc install ${@}
45-
lb chroot_apt install-binary ${@}
46-
lb chroot_archives chroot install ${@}
36+
lb chroot_devpts install "${@}"
37+
lb chroot_proc install "${@}"
38+
lb chroot_selinuxfs install "${@}"
39+
lb chroot_sysfs install "${@}"
40+
lb chroot_hosts install "${@}"
41+
lb chroot_resolv install "${@}"
42+
lb chroot_hostname install "${@}"
43+
lb chroot_dpkg install "${@}"
44+
lb chroot_sysv-rc install "${@}"
45+
lb chroot_apt install-binary "${@}"
46+
lb chroot_archives chroot install "${@}"
4747
fi
4848

4949
# Building root filesystem
50-
lb binary_rootfs ${@}
51-
lb binary_manifest ${@}
50+
lb binary_rootfs "${@}"
51+
lb binary_manifest "${@}"
5252

5353
# Prepare images
54-
lb binary_package-lists ${@}
55-
lb binary_linux-image ${@}
56-
lb binary_memtest ${@}
57-
lb binary_grub-legacy ${@}
58-
lb binary_grub-pc ${@}
59-
lb binary_loopback_cfg ${@}
60-
lb binary_syslinux ${@}
61-
lb binary_disk ${@}
62-
lb binary_loadlin ${@}
63-
lb binary_win32-loader ${@}
64-
lb binary_includes ${@}
65-
lb binary_grub-efi ${@}
66-
lb binary_hooks ${@}
67-
lb binary_checksums ${@}
54+
lb binary_package-lists "${@}"
55+
lb binary_linux-image "${@}"
56+
lb binary_memtest "${@}"
57+
lb binary_grub-legacy "${@}"
58+
lb binary_grub-pc "${@}"
59+
lb binary_loopback_cfg "${@}"
60+
lb binary_syslinux "${@}"
61+
lb binary_disk "${@}"
62+
lb binary_loadlin "${@}"
63+
lb binary_win32-loader "${@}"
64+
lb binary_includes "${@}"
65+
lb binary_grub-efi "${@}"
66+
lb binary_hooks "${@}"
67+
lb binary_checksums "${@}"
6868

6969
if [ "${LB_BUILD_WITH_CHROOT}" != "true" ]
7070
then
71-
lb chroot_devpts install ${@}
72-
lb chroot_proc install ${@}
73-
lb chroot_selinuxfs install ${@}
74-
lb chroot_sysfs install ${@}
71+
lb chroot_devpts install "${@}"
72+
lb chroot_proc install "${@}"
73+
lb chroot_selinuxfs install "${@}"
74+
lb chroot_sysfs install "${@}"
7575
fi
7676

7777
# Building images
78-
lb binary_iso ${@}
79-
lb binary_onie ${@}
80-
lb binary_netboot ${@}
81-
lb binary_tar ${@}
82-
lb binary_hdd ${@}
78+
lb binary_iso "${@}"
79+
lb binary_onie "${@}"
80+
lb binary_netboot "${@}"
81+
lb binary_tar "${@}"
82+
lb binary_hdd "${@}"
8383

84-
lb binary_zsync ${@}
84+
lb binary_zsync "${@}"
8585

8686
if [ "${LB_BUILD_WITH_CHROOT}" = "true" ]
8787
then
8888
# Deconfiguring chroot
8989
Remove_stagefile chroot_archives
9090

91-
lb chroot_apt remove ${@}
92-
lb chroot_hostname remove ${@}
93-
lb chroot_resolv remove ${@}
94-
lb chroot_hosts remove ${@}
95-
lb chroot_sysv-rc remove ${@}
96-
lb chroot_dpkg remove ${@}
97-
lb chroot_debianchroot remove ${@}
91+
lb chroot_apt remove "${@}"
92+
lb chroot_hostname remove "${@}"
93+
lb chroot_resolv remove "${@}"
94+
lb chroot_hosts remove "${@}"
95+
lb chroot_sysv-rc remove "${@}"
96+
lb chroot_dpkg remove "${@}"
97+
lb chroot_debianchroot remove "${@}"
9898
fi
9999

100-
lb chroot_sysfs remove ${@}
101-
lb chroot_selinuxfs remove ${@}
102-
lb chroot_proc remove ${@}
103-
lb chroot_devpts remove ${@}
100+
lb chroot_sysfs remove "${@}"
101+
lb chroot_selinuxfs remove "${@}"
102+
lb chroot_proc remove "${@}"
103+
lb chroot_devpts remove "${@}"
104104

105105
Echo_message "Binary stage completed"

scripts/build/binary_rootfs

+72-72
Original file line numberDiff line numberDiff line change
@@ -135,34 +135,34 @@ case "${LB_CHROOT_FILESYSTEM}" in
135135
Remove_lockfile
136136
mv chroot/chroot chroot.tmp
137137

138-
lb chroot_archives binary remove ${@}
139-
lb chroot_apt remove ${@}
140-
lb chroot_hostname remove ${@}
141-
lb chroot_resolv remove ${@}
142-
lb chroot_hosts remove ${@}
143-
lb chroot_sysv-rc remove ${@}
144-
lb chroot_dpkg remove ${@}
145-
lb chroot_debianchroot remove ${@}
146-
lb chroot_sysfs remove ${@}
147-
lb chroot_selinuxfs remove ${@}
148-
lb chroot_proc remove ${@}
149-
lb chroot_devpts remove ${@}
138+
lb chroot_archives binary remove "${@}"
139+
lb chroot_apt remove "${@}"
140+
lb chroot_hostname remove "${@}"
141+
lb chroot_resolv remove "${@}"
142+
lb chroot_hosts remove "${@}"
143+
lb chroot_sysv-rc remove "${@}"
144+
lb chroot_dpkg remove "${@}"
145+
lb chroot_debianchroot remove "${@}"
146+
lb chroot_sysfs remove "${@}"
147+
lb chroot_selinuxfs remove "${@}"
148+
lb chroot_proc remove "${@}"
149+
lb chroot_devpts remove "${@}"
150150

151151
rm -rf chroot
152152
mv chroot.tmp chroot
153153

154-
lb chroot_devpts install ${@}
155-
lb chroot_proc install ${@}
156-
lb chroot_selinuxfs install ${@}
157-
lb chroot_sysfs install ${@}
158-
lb chroot_debianchroot install ${@}
159-
lb chroot_dpkg install ${@}
160-
lb chroot_sysv-rc install ${@}
161-
lb chroot_hosts install ${@}
162-
lb chroot_resolv install ${@}
163-
lb chroot_hostname install ${@}
164-
lb chroot_apt install ${@}
165-
lb chroot_archives binary install ${@}
154+
lb chroot_devpts install "${@}"
155+
lb chroot_proc install "${@}"
156+
lb chroot_selinuxfs install "${@}"
157+
lb chroot_sysfs install "${@}"
158+
lb chroot_debianchroot install "${@}"
159+
lb chroot_dpkg install "${@}"
160+
lb chroot_sysv-rc install "${@}"
161+
lb chroot_hosts install "${@}"
162+
lb chroot_resolv install "${@}"
163+
lb chroot_hostname install "${@}"
164+
lb chroot_apt install "${@}"
165+
lb chroot_archives binary install "${@}"
166166

167167
touch .lock
168168
else
@@ -223,34 +223,34 @@ case "${LB_CHROOT_FILESYSTEM}" in
223223
Remove_lockfile
224224
mv chroot/chroot chroot.tmp
225225

226-
lb chroot_archives binary remove ${@}
227-
lb chroot_apt remove ${@}
228-
lb chroot_hostname remove ${@}
229-
lb chroot_resolv remove ${@}
230-
lb chroot_hosts remove ${@}
231-
lb chroot_sysv-rc remove ${@}
232-
lb chroot_dpkg remove ${@}
233-
lb chroot_debianchroot remove ${@}
234-
lb chroot_sysfs remove ${@}
235-
lb chroot_selinuxfs remove ${@}
236-
lb chroot_proc remove ${@}
237-
lb chroot_devpts remove ${@}
226+
lb chroot_archives binary remove "${@}"
227+
lb chroot_apt remove "${@}"
228+
lb chroot_hostname remove "${@}"
229+
lb chroot_resolv remove "${@}"
230+
lb chroot_hosts remove "${@}"
231+
lb chroot_sysv-rc remove "${@}"
232+
lb chroot_dpkg remove "${@}"
233+
lb chroot_debianchroot remove "${@}"
234+
lb chroot_sysfs remove "${@}"
235+
lb chroot_selinuxfs remove "${@}"
236+
lb chroot_proc remove "${@}"
237+
lb chroot_devpts remove "${@}"
238238

239239
rm -rf chroot
240240
mv chroot.tmp chroot
241241

242-
lb chroot_devpts install ${@}
243-
lb chroot_proc install ${@}
244-
lb chroot_selinuxfs install ${@}
245-
lb chroot_sysfs install ${@}
246-
lb chroot_debianchroot install ${@}
247-
lb chroot_dpkg install ${@}
248-
lb chroot_sysv-rc install ${@}
249-
lb chroot_hosts install ${@}
250-
lb chroot_resolv install ${@}
251-
lb chroot_hostname install ${@}
252-
lb chroot_apt install ${@}
253-
lb chroot_archives binary install ${@}
242+
lb chroot_devpts install "${@}"
243+
lb chroot_proc install "${@}"
244+
lb chroot_selinuxfs install "${@}"
245+
lb chroot_sysfs install "${@}"
246+
lb chroot_debianchroot install "${@}"
247+
lb chroot_dpkg install "${@}"
248+
lb chroot_sysv-rc install "${@}"
249+
lb chroot_hosts install "${@}"
250+
lb chroot_resolv install "${@}"
251+
lb chroot_hostname install "${@}"
252+
lb chroot_apt install "${@}"
253+
lb chroot_archives binary install "${@}"
254254

255255
touch .lock
256256
else
@@ -358,34 +358,34 @@ case "${LB_CHROOT_FILESYSTEM}" in
358358
Remove_lockfile
359359
mv chroot/chroot chroot.tmp
360360

361-
lb chroot_archives binary remove ${@}
362-
lb chroot_apt remove ${@}
363-
lb chroot_hostname remove ${@}
364-
lb chroot_resolv remove ${@}
365-
lb chroot_hosts remove ${@}
366-
lb chroot_sysv-rc remove ${@}
367-
lb chroot_dpkg remove ${@}
368-
lb chroot_debianchroot remove ${@}
369-
lb chroot_sysfs remove ${@}
370-
lb chroot_selinuxfs remove ${@}
371-
lb chroot_proc remove ${@}
372-
lb chroot_devpts remove ${@}
361+
lb chroot_archives binary remove "${@}"
362+
lb chroot_apt remove "${@}"
363+
lb chroot_hostname remove "${@}"
364+
lb chroot_resolv remove "${@}"
365+
lb chroot_hosts remove "${@}"
366+
lb chroot_sysv-rc remove "${@}"
367+
lb chroot_dpkg remove "${@}"
368+
lb chroot_debianchroot remove "${@}"
369+
lb chroot_sysfs remove "${@}"
370+
lb chroot_selinuxfs remove "${@}"
371+
lb chroot_proc remove "${@}"
372+
lb chroot_devpts remove "${@}"
373373

374374
rm -rf chroot
375375
mv chroot.tmp chroot
376376

377-
lb chroot_devpts install ${@}
378-
lb chroot_proc install ${@}
379-
lb chroot_selinuxfs install ${@}
380-
lb chroot_sysfs install ${@}
381-
lb chroot_debianchroot install ${@}
382-
lb chroot_dpkg install ${@}
383-
lb chroot_sysv-rc install ${@}
384-
lb chroot_hosts install ${@}
385-
lb chroot_resolv install ${@}
386-
lb chroot_hostname install ${@}
387-
lb chroot_apt install ${@}
388-
lb chroot_archives binary install ${@}
377+
lb chroot_devpts install "${@}"
378+
lb chroot_proc install "${@}"
379+
lb chroot_selinuxfs install "${@}"
380+
lb chroot_sysfs install "${@}"
381+
lb chroot_debianchroot install "${@}"
382+
lb chroot_dpkg install "${@}"
383+
lb chroot_sysv-rc install "${@}"
384+
lb chroot_hosts install "${@}"
385+
lb chroot_resolv install "${@}"
386+
lb chroot_hostname install "${@}"
387+
lb chroot_apt install "${@}"
388+
lb chroot_archives binary install "${@}"
389389

390390
touch .lock
391391
else

0 commit comments

Comments
 (0)