File 0078-Restore-original-IFS-value.patch of Package dracut.608

From 3ad963984b30a990c1ac94c81deb410322daafb6 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Mon, 23 Jun 2014 14:06:47 +0200
Subject: Restore original IFS value

Whenever the IFS setting is modified it needs to be restored to
its original value. Otherwise it'll lead to unexpected results.

References: bnc#883770

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 modules.d/81cio_ignore/parse-cio_accept.sh | 3 ++-
 modules.d/90kernel-modules/insmodpost.sh   | 2 +-
 modules.d/90kernel-modules/parse-kernel.sh | 4 ++++
 modules.d/95dasd/parse-dasd.sh             | 2 +-
 modules.d/95dasd_rules/parse-dasd.sh       | 8 +++++---
 modules.d/95iscsi/module-setup.sh          | 6 ++++--
 modules.d/95zfcp/parse-zfcp.sh             | 2 +-
 modules.d/95zfcp_rules/parse-zfcp.sh       | 4 +++-
 modules.d/98systemd/dracut-pre-udev.sh     | 4 ++--
 9 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/modules.d/81cio_ignore/parse-cio_accept.sh b/modules.d/81cio_ignore/parse-cio_accept.sh
index fec8a92..4f899d2 100644
--- a/modules.d/81cio_ignore/parse-cio_accept.sh
+++ b/modules.d/81cio_ignore/parse-cio_accept.sh
@@ -10,6 +10,7 @@ if [ -z $CIO_IGNORE ] ; then
     return
 fi
 if [ -n "$CIO_ACCEPT" ] ; then
+    OLDIFS="$IFS"
     IFS=,
     set -- $CIO_ACCEPT
     while (($# > 0)) ; do
@@ -17,5 +18,5 @@ if [ -n "$CIO_ACCEPT" ] ; then
         cio_ignore --remove $1
         shift
     done
-    unset IFS
+    IFS="$OLDIFS"
 fi
diff --git a/modules.d/90kernel-modules/insmodpost.sh b/modules.d/90kernel-modules/insmodpost.sh
index d2b8723..141f091 100755
--- a/modules.d/90kernel-modules/insmodpost.sh
+++ b/modules.d/90kernel-modules/insmodpost.sh
@@ -6,7 +6,7 @@
 
 for modlist in $(getargs rd.driver.post -d rdinsmodpost=); do
     (
-        IFS=,
+        local IFS=,
         for m in $modlist; do
             modprobe $m
         done
diff --git a/modules.d/90kernel-modules/parse-kernel.sh b/modules.d/90kernel-modules/parse-kernel.sh
index fa891bf..e012e52 100755
--- a/modules.d/90kernel-modules/parse-kernel.sh
+++ b/modules.d/90kernel-modules/parse-kernel.sh
@@ -13,10 +13,12 @@ fi
 
 for i in $(getargs rd.driver.pre -d rdloaddriver=); do
     (
+        OLDIFS="$IFS"
         IFS=,
         for p in $i; do
             modprobe $p 2>&1 | vinfo
         done
+        IFS="$OLDIFS"
     )
 done
 
@@ -25,10 +27,12 @@ done
 
 for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
     (
+        OLDIFS="$IFS"
         IFS=,
         for p in $i; do
             echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
         done
+        IFS="$OLDIFS"
     )
 done
 
diff --git a/modules.d/95dasd/parse-dasd.sh b/modules.d/95dasd/parse-dasd.sh
index 1aa1455..aba720b 100755
--- a/modules.d/95dasd/parse-dasd.sh
+++ b/modules.d/95dasd/parse-dasd.sh
@@ -3,7 +3,7 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do
     (
-        IFS=","
+        local IFS=","
         set -- $dasd_arg
         echo "$@" | normalize_dasd_arg >> /etc/dasd.conf
     )
diff --git a/modules.d/95dasd_rules/parse-dasd.sh b/modules.d/95dasd_rules/parse-dasd.sh
index 94a4b30..02b4aea 100755
--- a/modules.d/95dasd_rules/parse-dasd.sh
+++ b/modules.d/95dasd_rules/parse-dasd.sh
@@ -51,8 +51,10 @@ for dasd_arg in $(getargs root=) $(getargs resume=); do
                 break;
         esac
         if [ -n "$ccw_arg" ] ; then
+            OLDIFS="$IFS"
             IFS="-"
             set -- $ccw_arg
+            IFS="$OLDIFS"
             create_udev_rule $2
         fi
     )
@@ -60,9 +62,8 @@ done
 
 for dasd_arg in $(getargs rd.dasd=); do
     (
-        IFS=","
+        local IFS=","
         set -- $dasd_arg
-        unset IFS
         while (($# > 0)); do
             case $1 in
                 autodetect|probeonly)
@@ -70,13 +71,14 @@ for dasd_arg in $(getargs rd.dasd=); do
                     ;;
                 *-*)
                     range=$1
+                    OLDIFS="$IFS"
                     IFS="-"
                     set -- $range
                     start=${1#0.0.}
                     shift
                     end=${1#0.0.}
                     shift
-                    unset IFS
+                    IFS="$OLDIFS"
                     for dev in $(seq $(( 10#$start )) $(( 10#$end )) ) ; do
                         create_udev_rule $(printf "0.0.%04d" "$dev")
                     done
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index b90e298..cfa6f39 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -3,16 +3,18 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 get_ibft_mod() {
-    local ibft_mac=$1
+    local ibft_mac=$1 IFS
     # Return the iSCSI offload module for a given MAC address
     iscsiadm -m iface | while read iface_name iface_desc ; do
+        OLDIFS="$IFS"
         IFS=$','
         set -- $iface_desc
+        IFS="$OLDIFS"
         if [ "$ibft_mac" = "$2" ] ; then
             echo $1
             return 0
         fi
-        unset IFS
+        
     done
 }
 
diff --git a/modules.d/95zfcp/parse-zfcp.sh b/modules.d/95zfcp/parse-zfcp.sh
index 9b22d93..1d21472 100755
--- a/modules.d/95zfcp/parse-zfcp.sh
+++ b/modules.d/95zfcp/parse-zfcp.sh
@@ -6,7 +6,7 @@ getargbool 1 rd.zfcp.conf -d -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf
 
 for zfcp_arg in $(getargs rd.zfcp -d 'rd_ZFCP='); do
     (
-        IFS=","
+        local IFS=","
         set $zfcp_arg
         echo "$@" >> /etc/zfcp.conf
     )
diff --git a/modules.d/95zfcp_rules/parse-zfcp.sh b/modules.d/95zfcp_rules/parse-zfcp.sh
index 8538ae3..56152da 100755
--- a/modules.d/95zfcp_rules/parse-zfcp.sh
+++ b/modules.d/95zfcp_rules/parse-zfcp.sh
@@ -44,7 +44,7 @@ EOF
 
 for zfcp_arg in $(getargs rd.zfcp); do
     (
-        IFS=","
+        local IFS=","
         set $zfcp_arg
         create_udev_rule $1 $2 $3
     )
@@ -58,8 +58,10 @@ for zfcp_arg in $(getargs root=) $(getargs resume=); do
                 break;
         esac
         if [ -n "$ccw_arg" ] ; then
+            OLDIFS="$IFS"
             IFS="-"
             set -- $ccw_arg
+            IFS="$OLDIFS"
             wwpn=${4%:*}
             lun=${4#*:}
             create_udev_rule $2 $wwpn $lun
diff --git a/modules.d/98systemd/dracut-pre-udev.sh b/modules.d/98systemd/dracut-pre-udev.sh
index 638da40..77977d2 100755
--- a/modules.d/98systemd/dracut-pre-udev.sh
+++ b/modules.d/98systemd/dracut-pre-udev.sh
@@ -26,7 +26,7 @@ fi
 
 for i in $(getargs rd.driver.pre -d rdloaddriver=); do
     (
-        IFS=,
+        local IFS=,
         for p in $i; do
             modprobe $p 2>&1 | vinfo
         done
@@ -38,7 +38,7 @@ done
 
 for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
     (
-        IFS=,
+        local IFS=,
         for p in $i; do
             echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
         done
-- 
1.8.4.5

openSUSE Build Service is sponsored by