delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/04/24/20:09:23

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.0 required=5.0 tests=BAYES_40,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-Cloudmark-SP-Filtered: true
X-Cloudmark-SP-Result: v=1.0 c=1 a=eio3n6GRTAwA:10 a=VphdPIyG4kEA:10 a=kj9zAlcOel0A:10 a=jc5xxa63DtB0cTzSwkoA:9 a=jSjb1ZlURI8yTkOSBK16MQTWbnEA:4 a=CjuIK1q_8ugA:10
Date: Sat, 24 Apr 2010 18:09:06 -0600
From: ERIC HO <ericmho AT shaw DOT ca>
Subject: Re: bash/readline spinout in vi command mode (fix identified)
To: cygwin AT cygwin DOT com
Message-id: <d2b8dc751ef2d.4bd333c2@shaw.ca>
MIME-version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019