about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-06-22 13:10:22 +0100
committerPeter Stephenson <pws@zsh.org>2016-06-22 13:10:22 +0100
commit954cdd77d77136e572fc4896f3c0ba16f5c933ec (patch)
tree43fcd3fdb0a8f94b4bad0d35d8b64a3571c0d3a7 /Src/lex.c
parente83489fc4ba168abeb5ea7e23e64383fed181ed3 (diff)
downloadzsh-954cdd77d77136e572fc4896f3c0ba16f5c933ec.tar.gz
zsh-954cdd77d77136e572fc4896f3c0ba16f5c933ec.tar.xz
zsh-954cdd77d77136e572fc4896f3c0ba16f5c933ec.zip
38746: Fix suffix alias expansion recursion.
This was problematic if the expansion landed you back in
command position.

Delay marking the alias as out of use until the text that
caused the expansion is finished.
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Src/lex.c b/Src/lex.c
index e36a01ec8..5ad3474fe 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1842,10 +1842,11 @@ checkalias(void)
 	if ((suf = strrchr(zshlextext, '.')) && suf[1] &&
 	    suf > zshlextext && suf[-1] != Meta &&
 	    (an = (Alias)sufaliastab->getnode(sufaliastab, suf+1)) &&
-	    !an->inuse && incmdpos) {
-	    inpush(dupstring(zshlextext), INP_ALIAS, NULL);
+	    !an->inuse && incmdpos &&
+	    !(inbufflags & INP_ALSUFF)) {
+	    inpush(dupstring(zshlextext), INP_ALIAS, an);
 	    inpush(" ", INP_ALIAS, NULL);
-	    inpush(an->text, INP_ALIAS, an);
+	    inpush(an->text, INP_ALIAS, NULL);
 	    lexstop = 0;
 	    return 1;
 	}