make splitsep preserve backslashes (RHBZ#851295)
splitsep() would drop escapes from its inputs. For example: splitsep ':' 'first:middle:\e\s\c\a\p\e\d' a b c gave a='first', b='middle', c='escaped'. Even worse: splitsep ':' '\e\s\c\a\p\e\d:middle:last' a b c gave a='escaped', b='escaped', c='escaped:middle:last'. This fixes the quoting so both calls return the values you'd expect (e.g. 'first', 'middle', '\e\s\c\a\p\e\d').master
parent
104727ad6e
commit
32b2fb8a27
|
@ -271,12 +271,12 @@ splitsep() {
|
||||||
|
|
||||||
while [ -n "$str" -a "$#" -gt 1 ]; do
|
while [ -n "$str" -a "$#" -gt 1 ]; do
|
||||||
tmp="${str%%$sep*}"
|
tmp="${str%%$sep*}"
|
||||||
eval "$1=${tmp}"
|
eval "$1='${tmp}'"
|
||||||
str="${str#$tmp}"
|
str="${str#"$tmp"}"
|
||||||
str="${str#$sep}"
|
str="${str#$sep}"
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
[ -n "$str" -a -n "$1" ] && eval "$1=$str"
|
[ -n "$str" -a -n "$1" ] && eval "$1='$str'"
|
||||||
debug_on
|
debug_on
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue