From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7677 invoked by alias); 22 May 2015 05:02:10 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35262 Received: (qmail 22091 invoked from network); 22 May 2015 05:02:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=eHXX0xdm2uksKWcysAREe6uKxgJfreWiO0JwGKpFTeg=; b=BDqQra+OCbmS7lO0wK13HkNi+CXQxNh35vHrYQ6c17qsbRHw9PHkCnOJmX9nlY5VhG zaNcL70eEAh3A+c1ajioHDk2ZDhx+FQf3wjoRh8leZXC7iv2oAZeTo+/GGazEwFB4NoK BdDCXWKlFTHbXD9AYHgMvoghyxWD4HCCuZf/N4EGIGRbijPCgKhC+96rYZSS1HxEb2Ny LFM4HzLeUtHTXyyFkGH3AsG2wbIPTDDKrWoEFxUHqZ9E58uPcO74npUyTLDabKcaJYxu M+sgzlz26alS4gFVfb8kRZOlIYhfT7aqaLetJBm9iPsgEBSRKDQW6eSv0FWk8E1lkCXd VKPQ== X-Gm-Message-State: ALoCoQn0cP2lf4jjlTPvSvSzGXQtBSR60Yw7dbcS1Zeug+jDLQUQybNZj7QFrYfHdzvkcyt7dLSH X-Received: by 10.202.197.9 with SMTP id v9mr1602312oif.17.1432270925091; Thu, 21 May 2015 22:02:05 -0700 (PDT) From: Bart Schaefer Message-Id: <150521220201.ZM23779@torch.brasslantern.com> Date: Thu, 21 May 2015 22:02:01 -0700 In-Reply-To: <20150520235158.GB2029@tarsus.local2> Comments: In reply to Daniel Shahaf "Re: [PATCH] compdescribe fix for unsorted groups (workers/34814) (was: Re: completion: git: --fixup: problem with _describe -2V and duplicate commit subjects)" (May 20, 11:51pm) References: <5510AAD4.8040807@thequod.de> <20150329054753.GA2766@tarsus.local2> <20150514143627.GE1932@tarsus.local2> <20150519204446.GC1837@tarsus.local2> <150519152300.ZM12361@torch.brasslantern.com> <20150520235158.GB2029@tarsus.local2> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "Zsh Hackers' List" Subject: Re: [PATCH] compdescribe fix for unsorted groups (workers/34814) (was: Re: completion: git: --fixup: problem with _describe -2V and duplicate commit subjects) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 20, 11:51pm, Daniel Shahaf wrote: } } While looking into this, I've also found a 100% CPU consumption bug; to } reproduce (in master): } } autoload compinit } compinit } _f() { d=(d1); a=(); compadd -XX -JJ -E1 -d d -a a; compadd -XX -JJ -E1 -d d -a a }; compdef _f f } f } } It's spinning in the outer of the two do-while loops in there, with } minfo.cur being a dummy match. It reaches the state where it has to try amatches, but the "default" group to which amatches points contains only a CMF_DUMMY, so it won't display it; thus it tries to go to the next match, but there are no more, so back to amatches we go again, and loop. So the obvious thing would seem to be to stop the loop if we arrive at the "examine amatches" state twice, which is easy enough to do; but then on a subsequent (fourth, if repeating the example above) attempt, *++(minfo.cur) runs off the end of memory and the shell crashes on the subsequent access through (*minfo.cur). Thus the less-obvious thing to do is, upon discovering the twice-amatches case, force everything back to the state it was in the second-to-last time do_menucmp() was called, so we just loop displaying the menu in a stable way. Trouble is, I'm not sure where that state can be found.