All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] str_replace() fix
@ 2011-09-15  6:45 Michal Soltys
       [not found] ` <1316069157-3063-1-git-send-email-soltys-R61QfzASbfY@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Soltys @ 2011-09-15  6:45 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

Whitespace removal in:

	out="${out}${chop# }$r"

will damage certain strings, for example the following call:

	str_replace ' aax aaxaa' x y

would return 'aayaayaa' instead of ' aay aayaa'.

Signed-off-by: Michal Soltys <soltys-R61QfzASbfY@public.gmane.org>
---
 modules.d/99base/dracut-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 50b1ed2..62c3bf5 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -24,7 +24,7 @@ str_replace() {
 
     while strstr "${in}" "$s"; do
         chop="${in%%$s*}"
-        out="${out}${chop# }$r"
+        out="${out}${chop}$r"
         in="${in#*$s}"
     done
     echo "${out}${in}"
-- 
1.7.5.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-22 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-15  6:45 [PATCH] str_replace() fix Michal Soltys
     [not found] ` <1316069157-3063-1-git-send-email-soltys-R61QfzASbfY@public.gmane.org>
2011-09-22 13:46   ` Harald Hoyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.