zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Cc: 353863@bugs.debian.org
Subject: Re: Bugreport: completion hanging at ubo<Tab> - endless loop
Date: Wed, 23 Feb 2011 11:30:04 +0000	[thread overview]
Message-ID: <20110223113004.6e99ffa9@pws-pc.ntlworld.com> (raw)
In-Reply-To: <2011-02-23T11-33-06@devnull.michael-prokop.at>

On Wed, 23 Feb 2011 11:50:18 +0100
Michael Prokop <news@michael-prokop.at> wrote:
> in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=353863
> Sebastien Desreux reported a bug about zsh with its
> completion system in a specific situation.
> 
> To trigger the bug (at least 4.3.10 and 4.3.11 in Debian are
> known to be affected by this bug):
> 
>   zsh -f
>   autoload -Uz compinit; compinit; alias ubox=ls
>   ubo<tab>
> 
> Then the zsh process is hanging in an endless loop, eating CPU.

Tee hee.  This is what happens when your interface between the
completion system and the main shell is a complete hack.

If the option COMPLETE_ALIASES is off, the shell tries to expand
aliases, so it can do completion for aliased commands without the
completion system needing to understand the alias.

To analyse a command line to find the current context, completion adds
an "x" at the cursor position which it later removes.  In this case, the
"x" completes the word "ubox", which is then expanded to "ls".  The
completion system doesn't notice and assumes it still has the original
command line.  It removes the non-existent "x" to get "l" which it
thinks is three characters long.  It then loops for ever reading the
null byte at the end of the string waiting to get to the third
character.

I think the answer might be never to expand aliases when the "x" would
be added to the command word.  That might be easier said than done.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  reply	other threads:[~2011-02-23 11:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 10:50 Michael Prokop
2011-02-23 11:30 ` Peter Stephenson [this message]
2011-02-23 20:03   ` Bart Schaefer
2011-02-24 12:38   ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110223113004.6e99ffa9@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=353863@bugs.debian.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).