Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Bond error with Readline (WindowsXP) #11

Closed
klauern opened this Issue · 6 comments

2 participants

@klauern

I installed both the rb-readline (0.4.0) and bond (0.4.0) gems, and here's my output when trying tab completion from require ':

PS C:\mydocs> irb
>> require 'readline'
=> false
>> require 'bond'
=> true
>> Bond.start
=> true
>> Bond.config[:debug] = true
=> true
>> require '
Bond Error: Failed internally with 'undefined method `line_buffer' for Readline:Module'.
Please report this issue with debug on: Bond.config[:debug] = true.
Stack Trace: ["C:/Ruby187/lib/ruby/gems/1.8/gems/bond-0.4.0/lib/bond/readline.rb:36:in `line_buffer'",
"C:/Ruby187/lib/ruby/gems/1.8/gems/bond-0.4.0/lib/bond/agent.rb:44:in `call'", "C:/Ruby187/lib/ruby/site_ruby/1.8/readline.rb:114:in
`readline_attempted_completion_function'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:6177:in `send'",
"C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:6177:in `gen_completion_matches'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:6662:in
`rl_complete_internal'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:6746:in `rl_complete'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4232:in
`send'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4232:in `_rl_dispatch_subseq'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4221:in
`_rl_dispatch'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4631:in `readline_internal_charloop'",
"C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4705:in `readline_internal'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4727:in `readline'",
"C:/Ruby187/lib/ruby/site_ruby/1.8/readline.rb:40:in `readline'", "C:/Ruby187/lib/ruby/1.8/irb/input-method.rb:97:in `gets'",
"C:/Ruby187/lib/ruby/1.8/irb.rb:140:in `eval_input'", "C:/Ruby187/lib/ruby/1.8/irb.rb:271:in `signal_status'", "C:/Ruby187/lib/ruby/1.8/irb.rb:139:in
`eval_input'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:189:in `call'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:189:in `buf_input'",
"C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:104:in `getc'", "C:/Ruby187/lib/ruby/1.8/irb/slex.rb:206:in `match_io'", "C:/Ruby187/lib/ruby/1.8/irb/slex.rb:76:in
`match'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:287:in `token'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:263:in `lex'",
"C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:234:in `each_top_level_statement'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop'",
"C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch'",
"C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement'", "C:/Ruby187/lib/ruby/1.8/irb.rb:154:in `eval_input'",
"C:/Ruby187/lib/ruby/1.8/irb.rb:71:in `start'", "C:/Ruby187/lib/ruby/1.8/irb.rb:70:in `catch'", "C:/Ruby187/lib/ruby/1.8/irb.rb:70:in `start'",
"C:/Ruby187/bin/irb:13"]

Installation details:

Ruby 1.8.7p330, Windows XP (SP3)

@cldwalker
Owner

Seeing this in your trace "C:/Ruby187/lib/ruby/site_ruby/1.8/readline.rb", it seems you have required ruby's native readline which may be interfering with rb-readline. Try starting irb with irb -f and don't require readline. Let me know what you get.

@klauern

So here's some of my experiments to trying to get a better handle on what is going on:

Does Readline come on by default?

PS C:\mydocs> irb -f
irb(main):001:0> require 'readline'
=> false
irb(main):002:0> exit

Trying the same steps assuming the -f flag will turn off readline:

PS C:\mydocs> irb -f
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'bond'
=> true
irb(main):003:0> Bond.config[:debug] = true
=> true
irb(main):004:0> Bond.start
=> true
irb(main):005:0> require '
Bond Error: Failed internally with 'undefined method `line_buffer' for Readline:Module'.
Please report this issue with debug on: Bond.config[:debug] = true.
Stack Trace: ["C:/Ruby187/lib/ruby/gems/1.8/gems/bond-0.4.0/lib/bond/readline.rb:36:in `line_buffer'", "C:/Ruby187/lib/ruby/gems/1.8/gems/bond-0.4.0/lib/bond/agent.rb:44:in `call'", "C:/Ruby187/lib/ruby/site_ruby/1.8/readline.rb:114:in `readline_attempted_completion_function'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:6177:in `send'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:6177:in `gen_completion_matches'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:6662:in `rl_complete_internal'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:6746:in `rl_complete'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4232:in `send'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4232:in `_rl_dispatch_subseq'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4221:in `_rl_dispatch'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4631:in `readline_internal_charloop'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4705:in `readline_internal'", "C:/Ruby187/lib/ruby/site_ruby/1.8/rbreadline.rb:4727:in `readline'", "C:/Ruby187/lib/ruby/site_ruby/1.8/readline.rb:40:in `readline'", "C:/Ruby187/lib/ruby/1.8/irb/input-method.rb:97:in `gets'", "C:/Ruby187/lib/ruby/1.8/irb.rb:140:in `eval_input'", "C:/Ruby187/lib/ruby/1.8/irb.rb:271:in `signal_status'", "C:/Ruby187/lib/ruby/1.8/irb.rb:139:in `eval_input'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:189:in `call'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:189:in `buf_input'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:104:in `getc'", "C:/Ruby187/lib/ruby/1.8/irb/slex.rb:206:in `match_io'", "C:/Ruby187/lib/ruby/1.8/irb/slex.rb:76:in `match'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:287:in `token'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:263:in `lex'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:234:in `each_top_level_statement'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch'", "C:/Ruby187/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement'", "C:/Ruby187/lib/ruby/1.8/irb.rb:154:in `eval_input'", "C:/Ruby187/lib/ruby/1.8/irb.rb:71:in `start'", "C:/Ruby187/lib/ruby/1.8/irb.rb:70:in `catch'", "C:/Ruby187/lib/ruby/1.8/irb.rb:70:in `start'", "C:/Ruby187/bin/irb:13"]
irb(main):005:0> exit

Trying the explicit option to turn off readline

PS C:\mydocs> irb -f --noreadline
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'rb-readline'
=> true
irb(main):003:0> require 'bond'
=> true
irb(main):004:0> Bond.start
=> true
irb(main):005:0> exit
PS C:\mydocs> irb -f --noreadline
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'rb-readline'
=> true
irb(main):003:0> require 'bond'
=> true
irb(main):004:0> Bond.config[:debug] = true
=> true
irb(main):005:0> Bond.start
=> true
irb(main):006:0> require '                                                                      cursor moves, nothing happens
irb(main):007:0' '
LoadError: no such file to load --                                                                      cursor moves, nothing happens

        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from (irb):7

While this looks like it doesn't throw an error, tabbing just moves the cursor forward with nothing actually being captured, so I'm not sure if I'm missing something or not.

I think I'm missing something. For instance, I tried to install the gems in Windows Ruby 1.8.7 like you suggest:

gem install bond rb-readline -- --without-readline

But I get an error:

PS C:\mydocs> gem install bond rb-readline -- --without-readline
ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --without-readline
@cldwalker
Owner

Hmmm. There are a number of things that could be going wrong here. Let's start with rb-readline. Start irb with:

$ irb -f
 >> require 'rubygems'
 => true
 >> require 'rb-readline'
 => true
 >> require 'irb/completion'
 => true
 >> Re[TAB]
 Readline     Regexp       RegexpError

Does the above autocompletion work for you? If it doesn't then you have an issue with rb-readline.

@klauern

I did get your above completion code to work on my machine as well, so readline seems to behave properly. Also, I kept trying combinations of things until I got this:
PS C:\mydocs\Ruby\bond> irb -f
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'rb-readline'
=> true
irb(main):003:0> require 'bond'
=> true
irb(main):004:0> require '
.gemspec .git/ CHANGELOG.rdoc LICENSE.txt README.rdoc Rakefile ext/ lib/ test/
irb(main):004:0> %w{ab bc cd de}.delete '
.gemspec .git/ CHANGELOG.rdoc LICENSE.txt README.rdoc Rakefile ext/ lib/ test/
So then I start Bond up to see if I can do anything more trivial:
irb(main):004:0> Bond.start
=> true
irb(main):005:0> %w{ab bc cd de}.delete '
Bond Error: Failed internally with 'undefined method `line_buffer' for Readline:Module'.
Please report this issue with debug on: Bond.config[:debug] = true.
irb(main):005:0> %w{ab bc cd de}.delete '

@klauern

Ok, so here's an update. the version of Readline that comes with Windows Ruby is older than the newest gem (0.2.0 on the install, 0.4.0 on rubygems). I posted to the RubyInstaller group about this issue and got a pretty good response.

https://groups.google.com/d/topic/rubyinstaller/HDpYMNg3LWI/discussion

I've updated my installed Readline version to 0.4.0 and things just work. So, I think we can close this ticket out, but I'm not sure if that means there's some disconnect between what RubyInstaller for Windows does and what Bond expects. I got confused on the bond documentation and I think that the rb-readline gem is completely unnecessary if the version of readline bundled with Ruby is current.

Sorry for pulling time away for you on something that seems related to RubyInstaller.

@cldwalker
Owner

Glad to see you got it working.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.