mirror of
https://github.com/zsh-users/zsh
synced 2024-09-16 06:30:26 +00:00
detect additional characters in parameter expansions and signal an error for them (11380)
This commit is contained in:
parent
1dc5677a41
commit
0e5666e2ad
|
@ -1,5 +1,8 @@
|
||||||
2000-05-15 Sven Wischnowsky <wischnow@zsh.org>
|
2000-05-15 Sven Wischnowsky <wischnow@zsh.org>
|
||||||
|
|
||||||
|
* 11380: Src/subst.c: detect additional characters in parameter
|
||||||
|
expansions and signal an error for them
|
||||||
|
|
||||||
* 11379: Completion/Base/.distfiles, Completion/Base/_in_vared,
|
* 11379: Completion/Base/.distfiles, Completion/Base/_in_vared,
|
||||||
Completion/Core/_compalso, Completion/Core/_complete,
|
Completion/Core/_compalso, Completion/Core/_complete,
|
||||||
Completion/Core/_main_complete, Doc/Zsh/compsys.yo: add _in_vared
|
Completion/Core/_main_complete, Doc/Zsh/compsys.yo: add _in_vared
|
||||||
|
|
19
Src/subst.c
19
Src/subst.c
|
@ -1230,6 +1230,15 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
||||||
if (!inbrace)
|
if (!inbrace)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (inbrace &&
|
||||||
|
(c = *s) != '-' && c != '+' && c != ':' && c != '%' && c != '/' &&
|
||||||
|
c != '=' && c != Equals &&
|
||||||
|
c != '#' && c != Pound &&
|
||||||
|
c != '?' && c != Quest &&
|
||||||
|
c != '}' && c != Outbrace) {
|
||||||
|
zerr("bad substitution", NULL, 0);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (isarr) {
|
if (isarr) {
|
||||||
if (nojoin)
|
if (nojoin)
|
||||||
isarr = -1;
|
isarr = -1;
|
||||||
|
@ -1463,9 +1472,6 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
char t = s[-1];
|
|
||||||
|
|
||||||
singsub(&s);
|
|
||||||
#if 0
|
#if 0
|
||||||
/*
|
/*
|
||||||
* This allows # and % to be at the start of
|
* This allows # and % to be at the start of
|
||||||
|
@ -1473,6 +1479,11 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
||||||
* a bit nasty, and can be done (although
|
* a bit nasty, and can be done (although
|
||||||
* less efficiently) with anchors.
|
* less efficiently) with anchors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
char t = s[-1];
|
||||||
|
|
||||||
|
singsub(&s);
|
||||||
|
|
||||||
if (t == '/' && (flags & SUB_SUBSTR)) {
|
if (t == '/' && (flags & SUB_SUBSTR)) {
|
||||||
if ((c = *s) == '#' || c == '%') {
|
if ((c = *s) == '#' || c == '%') {
|
||||||
flags &= ~SUB_SUBSTR;
|
flags &= ~SUB_SUBSTR;
|
||||||
|
@ -1483,6 +1494,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
singsub(&s);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue