mirror of https://github.com/mirror/busybox.git
ash: fix handling of single-quoted strings in pattern substitution
function old new delta subevalvar 1576 1588 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>master
parent
f873c63085
commit
c5a1be25ba
|
@ -7073,6 +7073,11 @@ subevalvar(char *start, char *str, int strloc,
|
|||
repl = NULL;
|
||||
break;
|
||||
}
|
||||
/* Skip over quoted 'str'. Example: ${var/'/'} - second / is not a separator */
|
||||
if ((unsigned char)*repl == CTLQUOTEMARK) {
|
||||
while ((unsigned char)*++repl != CTLQUOTEMARK)
|
||||
continue;
|
||||
}
|
||||
if (*repl == '/') {
|
||||
*repl = '\0';
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
axxb
|
||||
axxb
|
||||
axxb
|
||||
axxb
|
|
@ -0,0 +1,8 @@
|
|||
v="x/x"
|
||||
# The second / is quoted, should not be treated as separator
|
||||
echo a${v/'/'}b
|
||||
# The second / is escaped, should not be treated as separator
|
||||
echo a${v/\/}b
|
||||
|
||||
echo "a${v/'/'}b"
|
||||
echo "a${v/\/}b"
|
|
@ -0,0 +1,4 @@
|
|||
axxb
|
||||
axxb
|
||||
axxb
|
||||
axxb
|
|
@ -0,0 +1,8 @@
|
|||
v="x/x"
|
||||
# The second / is quoted, should not be treated as separator
|
||||
echo a${v/'/'}b
|
||||
# The second / is escaped, should not be treated as separator
|
||||
echo a${v/\/}b
|
||||
|
||||
echo "a${v/'/'}b"
|
||||
echo "a${v/\/}b"
|
Loading…
Reference in New Issue