]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
guard ${arrays[@]} with ""
authorHarald Hoyer <harald@redhat.com>
Thu, 9 Jul 2015 13:27:44 +0000 (15:27 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 9 Jul 2015 13:36:25 +0000 (15:36 +0200)
dracut-functions.sh
dracut.sh
lsinitrd.sh
modules.d/90btrfs/module-setup.sh
modules.d/90kernel-modules/module-setup.sh
modules.d/95cifs/module-setup.sh
modules.d/95nfs/module-setup.sh
modules.d/95virtfs/module-setup.sh
modules.d/99base/module-setup.sh

index 639c5aee65f04eea841ec800e6224519c68e6c74..3a0a5a25aa46037e047e6dec4cc52b5050654da4 100755 (executable)
@@ -596,7 +596,7 @@ for_each_host_dev_fs()
     local _dev
     local _ret=1
 
-    [[ "${!host_fs_types[@]}" ]] || return 0
+    [[ "${#host_fs_types[@]}" ]] || return 0
 
     for _dev in "${!host_fs_types[@]}"; do
         $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
@@ -657,7 +657,7 @@ for_each_host_dev_and_slaves_all()
 
     [[ "${host_devs[@]}" ]] || return 0
 
-    for _dev in ${host_devs[@]}; do
+    for _dev in "${host_devs[@]}"; do
         [[ -b "$_dev" ]] || continue
         if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
             _ret=0
@@ -673,7 +673,7 @@ for_each_host_dev_and_slaves()
 
     [[ "${host_devs[@]}" ]] || return 0
 
-    for _dev in ${host_devs[@]}; do
+    for _dev in "${host_devs[@]}"; do
         [[ -b "$_dev" ]] || continue
         check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
     done
@@ -1276,7 +1276,7 @@ check_mount() {
     local _ret
     local _moddep
 
-    [ "${#host_fs_types[*]}" -le 0 ] && return 1
+    [ "${#host_fs_types[@]}" -le 0 ] && return 1
 
     # If we are already scheduled to be loaded, no need to check again.
     [[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
index 54358f30063bee727f141362c548e5c0d037d3b7..fc84a41906a5ec1f78da058deb645041406530be 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1220,7 +1220,7 @@ _get_fs_type() {
     return 1
 }
 
-for dev in ${host_devs[@]}; do
+for dev in "${host_devs[@]}"; do
     _get_fs_type "$dev"
     check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
 done
@@ -1455,8 +1455,8 @@ if [[ $no_kernel != yes ]]; then
 fi
 
 if [[ $kernel_only != yes ]]; then
-    (( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]}
-    (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o ${install_optional_items[@]}
+    (( ${#install_items[@]} > 0 )) && inst_multiple "${install_items[@]}"
+    (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o "${install_optional_items[@]}"
 
     [[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
 
index 94674af710bdaeb9006676e7ddaa0f5d0b92bbd1..d2ddd76a63e6bf0b7f205b76482f7fba8ca86122 100755 (executable)
@@ -117,7 +117,7 @@ dracutlibdirs() {
 extract_files()
 {
     (( ${#filenames[@]} == 1 )) && nofileinfo=1
-    for f in ${!filenames[@]}; do
+    for f in "${!filenames[@]}"; do
         [[ $nofileinfo ]] || echo "initramfs:/$f"
         [[ $nofileinfo ]] || echo "========================================================================"
         $CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
index 07711320a0af25d1df8f79b4bf4bdbe27ffe37e3..9303dbe25509e179d3f494c9348775eecbe29a15 100755 (executable)
@@ -8,7 +8,7 @@ check() {
     require_binaries btrfs || return 1
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for fs in ${host_fs_types[@]}; do
+        for fs in "${host_fs_types[@]}"; do
             [[ "$fs" == "btrfs" ]] && return 0
         done
         return 255
index 40803df8242543654acb9e6a392dec3b68e90e05..41bf37dfc2ec01dafc270a22fdf3123d15eb9b51 100755 (executable)
@@ -74,7 +74,7 @@ installkernel() {
                     instmods '=fs'
             fi
         else
-            for i in $(host_fs_all); do
+            for i in "${host_fs_types[@]}"; do
                 hostonly='' instmods $i
             done
         fi
index 0e6984575fde31b61300ddad9d34a4e81e1bd635..f711458f2969ac0b6873599da2795d168eea1add 100755 (executable)
@@ -6,7 +6,7 @@ check() {
     require_binaries mount.cifs || return 1
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for fs in ${host_fs_types[@]}; do
+        for fs in "${host_fs_types[@]}"; do
             [[ "$fs" == "cifs" ]] && return 0
         done
         return 255
index 8eb542c1e4cfe6301f495de2fbf9ba7f4d2981c3..9b5b8c8f022a6dfe62cc0a2ad525c754df1b06c9 100755 (executable)
@@ -7,7 +7,7 @@ check() {
     require_binaries rpc.statd mount.nfs mount.nfs4 umount || return 1
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for fs in ${host_fs_types[@]}; do
+        for fs in "${host_fs_types[@]}"; do
             [[ "$fs" == "nfs" ]] && return 0
             [[ "$fs" == "nfs3" ]] && return 0
             [[ "$fs" == "nfs4" ]] && return 0
index 97d39b9804d0fe28a7b2e4e245e294a5659fe893..96036ee342338d43f3cf3379bfadffe6a3eb72fb 100755 (executable)
@@ -3,7 +3,7 @@
 # called by dracut
 check() {
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for fs in ${host_fs_types[@]}; do
+        for fs in "${host_fs_types[@]}"; do
             [[ "$fs" == "9p" ]] && return 0
         done
         return 255
index 3fbdc410a22d0bd98d2d2b79eef72a3071eb1f97..cc94d00552a35059462107d0bf833d1bcfef6a46 100755 (executable)
@@ -101,15 +101,15 @@ install() {
 
                 . "$moddir/dracut-lib.sh"
 
-                for _dev in ${host_devs[@]}; do
-                    for _dev2 in ${root_devs[@]}; do
+                for _dev in "${host_devs[@]}"; do
+                    for _dev2 in "${root_devs[@]}"; do
                         [[ "$_dev" == "$_dev2" ]] && continue 2
                     done
 
                     # We only actually wait for real devs - swap is only needed
                     # for resume and udev rules generated when parsing resume=
                     # argument take care of the waiting for us
-                    for _dev2 in ${swap_devs[@]}; do
+                    for _dev2 in "${swap_devs[@]}"; do
                       [[ "$_dev" == "$_dev2" ]] && continue 2
                     done