Harald Hoyer 55891e
From cb288154050ff5293bc9a0a72953cd2b93782abb Mon Sep 17 00:00:00 2001
Harald Hoyer 55891e
From: Michal Soltys <soltys@ziu.info>
Harald Hoyer 55891e
Date: Thu, 15 Sep 2011 08:45:57 +0200
Harald Hoyer 55891e
Subject: [PATCH] str_replace() fix
Harald Hoyer 55891e
Harald Hoyer 55891e
Whitespace removal in:
Harald Hoyer 55891e
Harald Hoyer 55891e
	out="${out}${chop# }$r"
Harald Hoyer 55891e
Harald Hoyer 55891e
will damage certain strings, for example the following call:
Harald Hoyer 55891e
Harald Hoyer 55891e
	str_replace ' aax aaxaa' x y
Harald Hoyer 55891e
Harald Hoyer 55891e
would return 'aayaayaa' instead of ' aay aayaa'.
Harald Hoyer 55891e
Harald Hoyer 55891e
Signed-off-by: Michal Soltys <soltys@ziu.info>
Harald Hoyer 55891e
---
Harald Hoyer 55891e
 modules.d/99base/dracut-lib.sh |    2 +-
Harald Hoyer 55891e
 1 files changed, 1 insertions(+), 1 deletions(-)
Harald Hoyer 55891e
Harald Hoyer 55891e
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
Harald Hoyer 55891e
index 50b1ed2..62c3bf5 100755
Harald Hoyer 55891e
--- a/modules.d/99base/dracut-lib.sh
Harald Hoyer 55891e
+++ b/modules.d/99base/dracut-lib.sh
Harald Hoyer 55891e
@@ -24,7 +24,7 @@ str_replace() {
Harald Hoyer 55891e
 
Harald Hoyer 55891e
     while strstr "${in}" "$s"; do
Harald Hoyer 55891e
         chop="${in%%$s*}"
Harald Hoyer 55891e
-        out="${out}${chop# }$r"
Harald Hoyer 55891e
+        out="${out}${chop}$r"
Harald Hoyer 55891e
         in="${in#*$s}"
Harald Hoyer 55891e
     done
Harald Hoyer 55891e
     echo "${out}${in}"