summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/lex.c7
-rw-r--r--Test/A02alias.ztst6
3 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d352067e7..146f7b882 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-22  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 38746: Src/lex.c, Test/A02alias.ztst: Delay marking
+	a suffix alias as free until the last minute.
+
 2016-06-22  Oliver Kiddle  <opk@zsh.org>
 
 	* 38714: Src/Zle/complete.c, Doc/Zsh/compsys.yo,
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;
 	}
diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index 49e47567c..1e09cd3f1 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -104,3 +104,9 @@
 >0
 ?(eval):2: invalid alias 'x=y' encountered while printing aliases
 # Currently, 'alias -L' returns 0 in this case.  Perhaps it should return 1.
+
+  alias -s mysuff='print -r "You said it.";'
+  eval 'thingummy.mysuff'
+127:No endless loop with suffix alias in command position
+>You said it.
+?(eval):1: command not found: thingummy.mysuff