public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: ERIC HO <ericmho@shaw.ca>
To: cygwin@cygwin.com
Subject: Re: bash/readline spinout in vi command mode (fix identified)
Date: Sun, 25 Apr 2010 00:09:00 -0000	[thread overview]
Message-ID: <d2b8dc751ef2d.4bd333c2@shaw.ca> (raw)

I downloaded the readline source and reviewed the looping rountines identified. It seems that the loop heappens when it is a null command line. If the command line contains some characters, the loop does not happen. I'm not a  expert in C so I reported to the readline maintainer who responded with the following very quickly (thanks Chet!):

**
Thanks for the report.

I'm surprised it does anything at all, and I'm not surprised that it loops.
That should return immediately without doing anything, since there is no
previous search to repeat.

You end up searching in an undefined direction (dir == 0) for an empty
string, and basically stop if the empty string happens to match at the
end of the line (_rl_char_search_internal defaults, by chance, to searching
forward).  The bounds checks will fail, since they include checks for
`dir' which only test the defined range of values.  The contents of
_rl_vi_last_search_mbchar could also be random on cygwin, though the
_rl_vi_last_search_mblen should always be 0, so that should not matter.

Anyway, the right fix is to check to make sure `dir' is in the defined
range.  I suppose I could check for searching for NULL also.

**
I'm just about giving up resolving this issue.
Thanks for those who spent time helping on this issue.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

             reply	other threads:[~2010-04-25  0:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-25  0:09 ERIC HO [this message]
2010-04-25 16:01 ERIC HO
2010-04-25 17:55 ` Dave Korn
2010-04-25 18:10 ERIC HO

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=d2b8dc751ef2d.4bd333c2@shaw.ca \
    --to=ericmho@shaw.ca \
    --cc=cygwin@cygwin.com \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).