From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13254 invoked by alias); 31 Oct 2009 22:50:37 -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: 27325 Received: (qmail 25329 invoked from network); 31 Oct 2009 22:50:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.218.210 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=o1l0lchWbU0jFLJnyD/j+Yx/+FOBvhh95a1PX6oGDgU=; b=aEFgh09PErn8DYV8z6pNLKY0eEn99hfcic+ia/6+ldlHnSot4bRHafWr7QwYs01yjH OD2TQAIDVuCxiIptHrSM9cf+94TacZL+rJsGRjfIoIV6wcEERE5VIQAd82d0hp7RoRRS xgBqoq/kE5FkoAx6HkXw50bnsAl3VrtZ6zC+4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=OGPPUPdDM//uc63Ue2rP+mbGersZoeZiNwVFYHSqIKKsvtyBWjUeHNppKuytwI8HiB fZj0PiEsDO/pbBiI1c+YB/0vJikM676tqRWOQisgFRAmoZqDOuiRqqZ4SMeSWa4woYgH fimpJ1AQ29WGeGfzM9FR9LzyIAt9YwPuc2a9Y= MIME-Version: 1.0 In-Reply-To: <200910312000.n9VK0VXC003485@pws-pc.ntlworld.com> References: <237967ef0910301433v6b58a1cdo2b31306ba4adda8a@mail.gmail.com> <200910312000.n9VK0VXC003485@pws-pc.ntlworld.com> Date: Sat, 31 Oct 2009 23:43:33 +0100 Message-ID: <237967ef0910311543y648f6511q3bc5ad097175a80b@mail.gmail.com> Subject: Re: zsh eats 100% CPU with completion in / From: Mikael Magnusson To: Peter Stephenson Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 2009/10/31 Peter Stephenson : > Mikael Magnusson wrote: >> 2009/10/30 Mikael Magnusson : >> > 2009/10/30 Frank Terbeck : >> >> The subject is not entirely correct. >> >> >> >> Zsh eats 100% CPU on a colleague's laptop if you do this: >> >> % cd / >> >> % cd .. >> >> % ./ > > Thanks for the additional details. > > So it appears something's going on in this loop in get_comp_string() > around line 1439 of zle_tricky.c: > > for (tt = s; tt < s + zlemetacs_qsub - wb;) { > if (*tt == Inbrack) { > i++; > nb = nnb; > ne = tt; > tt++; > } else if (i && *tt == Outbrack) { > i--; > tt++; > } else { > int nclen = MB_METACHARLEN(tt); > if (itype_end(tt, IIDENT, 1) == tt) > nnb = tt + nclen; > tt += nclen; > } > } > > It would therefore probably help to know what the various quantities are > in this loop: tt, s, zlemetacs_qsub and wb in particular, and also what > nclen is being returned. (You might need a debugging build to get these > out.) It seems plausible nclen is zero, which obviously causes a > problem. If eveything's in range (and unless we're going backwards the > loop test suggests it should be) this presumably means we encountered a > character we didn't like somewhere, so possibly the LC_CTYPE locale is > useful (I would guess it's UTF-8). Yes, my LC_CTYPE is en_US.UTF-8, here's a bt full #0 0x6fae4a7b in get_comp_string () at zle_tricky.c:1439 nnb = 0x82d7248 "" nb = 0x0 ne = 0x0 t0 = 34 tt0 = 34 i = 0 j = 0 k = 0 cp = 1 rd = 0 sl = 1 ocs = 0 ins = 0 oins = 0 ia = 0 parct = 0 varq = 0 ona = 0 qsub = 0 zlemetacs_qsub = 2 redirpos = 0 s = 0x82d7248 "" tmp = 0x80ff770 "./" p = 0x0 tt = 0x82d7248 "" rdop = "\000\367\017\b\370\031\244wq\367\017\b\001\000\000\000h0\031\b" linptr = 0x6ffed840 "./x" u = 0x80ff772 "" #1 0x6fae22bc in docomplete (lst=4) at zle_tricky.c:659 s = 0x41b6cedb "\201\303\031\301\v" ol = 0x0 olst = 4 chl = 0 ne = 0 ocs = 2 ret = 0 dat = {1878464192, 2007243640} active = 1 #2 0x6fae175f in expandorcomplete (args=0x6faf7d40) at zle_tricky.c:315 ret = 2007244248 #3 0x6fae1302 in completecall (args=0x6faf7d40) at zle_tricky.c:208 No locals. and inside the last bit (gdb) print zlemetacs_qsub $3 = 2 get_comp_string () at zle_tricky.c:1450 1450 if (itype_end(tt, IIDENT, 1) == tt) (gdb) print nclen $7 = 0 (gdb) print tt $8 = 0x82d7248 "" As a curiousity, I couldn't reproduce the bug as my user now, but it "worked" as root, or if I did the cd .. twice. -- Mikael Magnusson