zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: zsh 4.3.10 history-incremental-search-backward freezes in UTF-8
Date: Thu, 18 Mar 2010 07:55:23 -0700	[thread overview]
Message-ID: <100318075523.ZM11604@torch.brasslantern.com> (raw)
In-Reply-To: <20100318105005.GM1761@prunille.vinc17.org>

On Mar 18, 11:50am, Vincent Lefevre wrote:
} Subject: zsh 4.3.10 history-incremental-search-backward freezes in UTF-8
} 
} Is this a known problem? Has it been fixed?

I guess it's "known" since you reported it about 10 days ago. :-/

Looking back quickly at that report ... I ignored it because I have
no idea how to interpret output from "sample".  I'd never even heard
of "sample" until you referenced it there.

} I get a reproducible freeze of zsh 4.3.10 when searching the history
} backward (history-incremental-search-backward). I think the problem
} comes from the fact that the history contains command lines encoded
} in ISO-8859-1 while I'm currently under UTF-8 locales (the freeze is
} not reproducible under ISO-8859-1 locales).

Combining this information with what I see in the "sample" output, my
guess is that an attempt to iterate over a multibyte string using
the multibyte libraries is hitting a spot where interpreting ISO-8859
as UTF-8 results in some kind of failure to advance the character
index, which then causes the search to keep scanning the same history
entry repeatedly.

Probably here:

	    while (charpos < end_pos) {
		ret = mb_metacharlenconv_r(zlemetaline + charpos, &wc, &mbs);
		if (charpos <= pos && pos < charpos + ret)
		    isearch_startpos = charcount;
		charcount++;
		charpos += ret;
	    }

There needs to be some kind of sane behavior if ret == 0, or the
mb_metacharlenconv_r() function in utils.c must assure that it never
does return zero:

    if (ptr > s) {
	return 1 + (*s == Meta);	/* Treat as single byte character */
    } else
	return 0;		/* Probably shouldn't happen */

Possibly related to this thread back in November:

http://www.zsh.org/mla/workers/2009/msg01103.html

There doesn't seem to have been any resolution to that, but it's hard
to follow all the way to the end with the archive.


  parent reply	other threads:[~2010-03-18 14:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 10:50 Vincent Lefevre
2010-03-18 14:30 ` Peter Stephenson
2010-03-18 15:20   ` Vincent Lefevre
2010-03-18 15:44     ` Peter Stephenson
2010-03-20  0:29       ` PATCH: Displaying invalid characters Peter Stephenson
2010-03-25 16:43       ` zsh 4.3.10 history-incremental-search-backward freezes in UTF-8 Vincent Lefevre
2010-03-18 14:55 ` Bart Schaefer [this message]
2010-03-18 15:24   ` Vincent Lefevre

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=100318075523.ZM11604@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).