Blame 0004-Make-splitsep-work-as-documented-with-less-vars-than.patch

Harald Hoyer ab65ae
From f7cadaa843498c4b986f8a030fab39002ad108b6 Mon Sep 17 00:00:00 2001
Harald Hoyer ab65ae
From: Will Woods <wwoods@redhat.com>
Harald Hoyer ab65ae
Date: Thu, 5 Apr 2012 13:01:38 -0400
Harald Hoyer ab65ae
Subject: [PATCH] Make splitsep work as documented with less vars than fields
Harald Hoyer ab65ae
Harald Hoyer ab65ae
According to its comment in dracut-lib.sh:
Harald Hoyer ab65ae
Harald Hoyer ab65ae
    splitsep ":" "one:all:the:rest" one two
Harald Hoyer ab65ae
Harald Hoyer ab65ae
should set two="all:the:rest". But there's no check to see if the
Harald Hoyer ab65ae
current field is the last field, so it just gets "all".
Harald Hoyer ab65ae
---
Harald Hoyer ab65ae
 modules.d/99base/dracut-lib.sh |    3 ++-
Harald Hoyer 0c26bf
 1 Datei geändert, 2 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
Harald Hoyer ab65ae
Harald Hoyer ab65ae
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
Harald Hoyer ab65ae
index 1ecd286..e10a34d 100755
Harald Hoyer ab65ae
--- a/modules.d/99base/dracut-lib.sh
Harald Hoyer ab65ae
+++ b/modules.d/99base/dracut-lib.sh
Harald Hoyer ab65ae
@@ -224,13 +224,14 @@ splitsep() {
Harald Hoyer ab65ae
     local sep="$1"; local str="$2"; shift 2
Harald Hoyer ab65ae
     local tmp
Harald Hoyer ab65ae
 
Harald Hoyer ab65ae
-    while [ -n "$str" -a -n "$*" ]; do
Harald Hoyer ab65ae
+    while [ -n "$str" -a "$#" -gt 1 ]; do
Harald Hoyer ab65ae
         tmp="${str%%$sep*}"
Harald Hoyer ab65ae
         eval "$1=${tmp}"
Harald Hoyer ab65ae
         str="${str#$tmp}"
Harald Hoyer ab65ae
         str="${str#$sep}"
Harald Hoyer ab65ae
         shift
Harald Hoyer ab65ae
     done
Harald Hoyer ab65ae
+    [ -n "$str" -a -n "$1" ] && eval "$1=$str"
Harald Hoyer ab65ae
 
Harald Hoyer ab65ae
     return 0
Harald Hoyer ab65ae
 }