]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
remove superfluous quotes in parameter expansion
authorNorbert Lange <norbert.lange@andritz.com>
Wed, 12 Dec 2018 16:21:12 +0000 (17:21 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Thu, 13 Dec 2018 14:13:03 +0000 (15:13 +0100)
as this breaks busybox hush shell.
offending functions can be found with
grep -r '${[^}]*"[^}]*}'

modules.d/40network/net-lib.sh
modules.d/95iscsi/mount-lun.sh
modules.d/95virtfs/mount-virtfs.sh
modules.d/99base/dracut-lib.sh

index 964ed3ab81576d5c70f4262c62ef64bc02da084f..8596cd816476a5f1750a835e65df7f814c09dd64 100755 (executable)
@@ -129,7 +129,7 @@ setup_net() {
     for _p in $(getargs rd.route); do
         route_to_var "$_p" || continue
         [ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
-        ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
+        ip route add "$route_mask" ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}
         if strstr "$route_mask" ":"; then
             printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
                 > /tmp/net.route6."$netif"
index 9df18ccca73cc5f733d9202cd6b7776dce5c30d8..1a47dea79c47539113c50d0ad0ee416c087c7840 100755 (executable)
@@ -2,7 +2,7 @@
 if [ -z $iscsi_lun ]; then
     iscsi_lun=0
 fi
-NEWROOT=${NEWROOT:-"/sysroot"}
+NEWROOT=${NEWROOT:-/sysroot}
 
 for disk in /dev/disk/by-path/*-iscsi-*-$iscsi_lun; do
     if mount -t ${fstype:-auto} -o "$rflags" $disk $NEWROOT; then
index d05ca9041e6a652b6fedb0c810c7aa3f47e36c2d..728110c02134b840f154bf90b2a28ae82cf4d9c3 100755 (executable)
@@ -57,7 +57,7 @@ mount_root() {
 
     # we want rootflags (rflags) to take precedence so prepend rootopts to
     # them; rflags is guaranteed to not be empty
-    rflags="${rootopts:+"${rootopts},"}${rflags}"
+    rflags="${rootopts:+${rootopts},}${rflags}"
 
     umount "$NEWROOT"
 
index 3eb255e67db8abc6ca74e38267c29dacd15b5fef..ed84d7440593a1691b926439fa3ba13e829c0978 100755 (executable)
@@ -24,7 +24,7 @@ debug_on() {
 
 # returns OK if $1 contains literal string $2 (and isn't empty)
 strstr() {
-    [ "${1##*"$2"*}" != "$1" ]
+    [ "${1##*$2*}" != "$1" ]
 }
 
 # returns OK if $1 matches (completely) glob pattern $2
@@ -43,18 +43,18 @@ strglobin() {
 
 # returns OK if $1 contains literal string $2 at the beginning, and isn't empty
 str_starts() {
-    [ "${1#"$2"*}" != "$1" ]
+    [ "${1#$2*}" != "$1" ]
 }
 
 # returns OK if $1 contains literal string $2 at the end, and isn't empty
 str_ends() {
-    [ "${1%*"$2"}" != "$1" ]
+    [ "${1%*$2}" != "$1" ]
 }
 
 trim() {
     local var="$*"
-    var="${var#"${var%%[![:space:]]*}"}"   # remove leading whitespace characters
-    var="${var%"${var##*[![:space:]]}"}"   # remove trailing whitespace characters
+    var="${var#${var%%[![:space:]]*}}"   # remove leading whitespace characters
+    var="${var%${var##*[![:space:]]}}"   # remove trailing whitespace characters
     printf "%s" "$var"
 }
 
@@ -108,9 +108,9 @@ str_replace() {
     local out=''
 
     while strstr "${in}" "$s"; do
-        chop="${in%%"$s"*}"
+        chop="${in%%$s*}"
         out="${out}${chop}$r"
-        in="${in#*"$s"}"
+        in="${in#*$s}"
     done
     echo "${out}${in}"
 }
@@ -396,7 +396,7 @@ splitsep() {
     while [ -n "$str" -a "$#" -gt 1 ]; do
         tmp="${str%%$sep*}"
         eval "$1='${tmp}'"
-        str="${str#"$tmp"}"
+        str="${str#$tmp}"
         str="${str#$sep}"
         shift
     done