Subject: Re: Infinite loop with "hash ="
From: Bart Schaefer <[email-masked]>
To: [email-masked]
Date: Tue, 7 Jun 2016 10:03:29 -0700
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Jun 7,  6:08pm, Christian Neukirchen wrote:
}
} Running "hash =" will trigger an infinite loop, even with the check
} currently implemented.  (Same for "hash =foo".)

Hrmph, that's pretty silly.

diff --git a/Src/builtin.c b/Src/builtin.c
index 6f07fc6..c2fb81e 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3748,6 +3748,7 @@ bin_hash(char *name, char **argv, Options ops, UNUSED(int func))
         if (!(asg = getasg(&argv, NULL))) {
 	    zwarnnam(name, "bad assignment");
 	    returnval = 1;
+	    break;
         } else if (ASG_VALUEP(asg)) {
 	    if(isset(RESTRICTED)) {
 		zwarnnam(name, "restricted: %s", asg->value.scalar);