Irb completion

Hi,

In message “Re: [ruby-dev:29118] Re: irb completion”
on Mon, 24 Jul 2006 13:32:37 +0900, Tanaka A. [email protected]
writes:

|However the fix doesn’t solve the problem on current Darwin
|(and other platforms which have current libedit).
|
|So it is good to have a workaround in Ruby, such as:

Can you commit this patch please?

						matz.

In article [email protected],
Yukihiro M. [email protected] writes:

|% ./ruby -rreadline -e ‘Readline.completion_proc = lambda { raise }; p Readline.readline(“>>”)’
|>>-e:1: [BUG] Segmentation fault
|ruby 1.9.0 (2006-07-23) [i386-netbsdelf2.0.1]

Do you mean NetBSD uses libedit?

Yes. See the ldd result in [ruby-dev:29116].

In article [email protected],
Tanaka A. [email protected] writes:

% ldd .ext/i386-netbsdelf2.0.1/readline.so
.ext/i386-netbsdelf2.0.1/readline.so:
-ledit.2 => /usr/lib/libedit.so.2

Now NetBSD fixed the problem.

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/readline.c.diff?r1=1.67&r2=1.68

So I think the segv is fixed with very latest libedit in
very latest NetBSD.

However the fix doesn’t solve the problem on current Darwin
(and other platforms which have current libedit).

So it is good to have a workaround in Ruby, such as:

Index: ext/readline/readline.c

RCS file: /src/ruby/ext/readline/readline.c,v
retrieving revision 1.29
diff -u -p -r1.29 readline.c
— ext/readline/readline.c 9 Jun 2006 23:18:02 -0000 1.29
+++ ext/readline/readline.c 24 Jul 2006 04:27:04 -0000
@@ -77,7 +77,9 @@ readline_readline(int argc, VALUE argv,
rl_cleanup_after_signal();
#elif defined HAVE_RL_DEPREP_TERM_FUNCTION
/
restore terminal mode */

  •    (*rl_deprep_term_function)();
    
  • if (rl_deprep_term_function != NULL) /* NULL in libedit
    [ruby-dev:29116] */
  •   (*rl_deprep_term_function)();
    
  • else
    #else
    rl_deprep_terminal();
    #endif