Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport of commit 2026f81d70548a01404933f2fa869676b318f757 so that enco... #86

Closed

Conversation

VorontsovIE
Copy link

...ding for ruby 2.0 is set explicit

@rctay
Copy link
Contributor

rctay commented May 2, 2013

Looks ok, but I'm scratching my head on why you would be on cutting-edge Ruby, but be on old rb-readline. Not to mention that the last release of 0.4.x was a year back - which is to say, a new 0.4.x release may not be as forthcoming as a 0.5.x release.

@DHB
Copy link

DHB commented May 2, 2013

I suspect 0.4.x (let it be patched or not) might break pry.

See #83 and pry/pry#863

@VorontsovIE
Copy link
Author

Actually, I have an issue with rb-readline-0.5.0 #84 on my Windows system. So I wasn't able to run rails console before I patched encoding of 0.4.2 version and set version 0.4.2 in a Gemfile. This patch eliminates not all but some of problems.

@VorontsovIE
Copy link
Author

@DHB actually this patch prevents both IRB and Pry from breaking when using arrows

@DHB
Copy link

DHB commented May 2, 2013

@prijutme4ty - Yup, the poor not yet extinct windows users like us are always forced into yak shaving when it comes to Ruby& Rails. Encoding / Decoding seems to be extremely touchy on Windows.

In my case, one of the many issues, I forgot to delete the old history file - encoded in US-ASCII - and couldn't figure it out for hours.

rails c works fine on my system now with rb-readline 0.5.0 explicitely declared in the Gemfile.

But I admit, I did not do a lot of additionally testing with command history, replaying, etc.

One of the (many issues) I noticed however is the right cursor re-positioning when up-scrolling, etc.

@DHB
Copy link

DHB commented May 2, 2013

@prijutme4ty - 😄 I forgot to mention, all this is kind of weird to me anyway. I thought rb-readline is one of the libs that made it into the rubyinstaller 2.0.0 by default. (I believe it was version 0.5.0.pre1). So actually, there would not be any need to additionally define rb-readline in the gem, etc.

I am sure Luis will also look into this as soon as his time permits. (?)

@VorontsovIE
Copy link
Author

@DHB when I installed ruby 2.0 first time, I couldn't run irb until I installed rb-readline manually. So it looks that if any readline goes with rubyinstaller, it wasn't of the last version at the moment of installation.

@rctay
Copy link
Contributor

rctay commented May 2, 2013

@prijutme4ty I fired up irb from Start in Windows 7 from a Ruby 2.0 install, worked ok, without installing anything else (like rb-readline).

@VorontsovIE
Copy link
Author

@rctay Can't it be an issue of pik? Did you install ruby 2.0 on top of pik or without it?

@luislavena
Copy link
Collaborator

@prijutme4ty

when I installed ruby 2.0 first time, I couldn't run irb until I installed rb-readline manually. So it looks that if any readline goes with rubyinstaller, it wasn't of the last version at the moment of installation.

Are you talking RubyInstaller 2.0.0? because 0.5.0.pre.1 version was bundled with RubyInstaller.

That was properly tested prior the release of RubyInstaller:

oneclick/rubyinstaller@6878562

Now, is not clear to me if you attempted to use the gem all the time (or installed rb-readline from RubyGems and encountered issues) But believe me, RubyInstaller 2.0.0 ships with the above mentioned version.

You can download the 7zip package, extract it and check rb-readline.rb

As today, version 0.5.0 is the same as 0.5.0.pre.1, if something didn't work with pre.1 then is not going to work with 0.5.0.

IRB is a very tricky library. You need to include irb/completion in ~/.irbrc for it to attempt to load readline (or rb-readline in our case)

For the sake of my mental health I will ask you guys to keep the conversation on a single issue and stop opening additional issues or pull requests until we determine the real issue and a proposed solution together.

Thank you.

@rctay
Copy link
Contributor

rctay commented May 2, 2013

On Thu, May 2, 2013 at 11:34 PM, Ilya Vorontsov notifications@github.comwrote:

@rctay https://github.com/rctay Can't it be an issue of pik? Did you
installed ruby 2.0 on top of pik or without it?

Hmm I don't run pik.

@DHB
Copy link

DHB commented May 6, 2013

I really had no time to do this any earlier.

Gentlemen, here is what I did in order to reproduce with focus on single issues only - as per Luis request.
I chose to post it here, but it is related to #83 and #84 as well.

So let’s do it STEP by STEP ….

I set-up a clean, fresh VM with Windows7 Ultimate SP1, all updates installed as available per 05/06/2013.

No git (bash), no pik, no cmd.exe prompt customizing (except better readable font and colours),
NO (!) ‘’’.irbrc’’’.

First I installed ruby 1.9.3p392 with the rubyinstaller.exe as provided by rubyinstaller.org.

C:\Users\development\workspace>ruby -v && gem -v && irb -v
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]
1.8.24
irb 0.9.6(09/06/30)
C:\Users\development\workspace>irb
irb(main):001:0> RbReadline::RB_READLINE_VERSION
=> "0.4.2"
irb(main):002:0> require 'readline'
=> false
irb(main):003:0> require 'rb-readline'
=> true
irb(main):004:0> exit

The above looks as one would expect. So let’s switch to ruby2.0.0.

C:\Users\development\workspace>ruby -v && gem -v && irb -v
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]
2.0.0
DL is deprecated, please use Fiddle
irb 0.9.6(09/06/30)
C:\Ruby200\lib\ruby\site_ruby\2.0.0>ls -l
total 141
drwxr-xr-x    2 developm Administ        0 May  6 18:22 i386-msvcrt
-rw-r--r--    1 developm Administ      847 Feb 24 15:34 rb-readline.rb
-rw-r--r--    1 developm Administ   274188 Feb 24 15:34 rbreadline.rb
-rw-r--r--    1 developm Administ    13262 Feb 24 15:34 readline.rb

The three above ‘’’rb-readline’’’ files were installed here. No additional gems installed beyond the gems inherited from the installer.

C:\Users\development\workspace>gem list --local

*** LOCAL GEMS ***

bigdecimal (1.2.0)
io-console (0.4.2)
json (1.7.7)
minitest (4.3.2)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
test-unit (2.0.0.0)

Now:

C:\Users\development\workspace>irb
DL is deprecated, please use Fiddle
irb(main):001:0> RbReadline::RB_READLINE_VERSION
=> "0.5.0.pre.1"
irb(main):002:0> require 'readline'
=> false
irb(main):003:0> require 'rb-readline'
=> true
C:/Ruby200/lib/ruby/2.0.0/irb/input-method.rb:150:in `gets': uninitialized constant IRB::ReadlineInputMethod::Readline (NameError)
        from C:/Ruby200/lib/ruby/2.0.0/irb.rb:472:in `block (2 levels) in eval_input'
        from C:/Ruby200/lib/ruby/2.0.0/irb.rb:624:in `signal_status'
        from C:/Ruby200/lib/ruby/2.0.0/irb.rb:471:in `block in eval_input'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:190:in `call'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:190:in `buf_input'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:105:in `getc'
        from C:/Ruby200/lib/ruby/2.0.0/irb/slex.rb:206:in `match_io'
        from C:/Ruby200/lib/ruby/2.0.0/irb/slex.rb:76:in `match'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:290:in `token'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:266:in `lex'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:237:in `block (2 levels) in each_top_level_statement'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:233:in `loop'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:233:in `block in each_top_level_statement'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:232:in `catch'
        from C:/Ruby200/lib/ruby/2.0.0/irb/ruby-lex.rb:232:in `each_top_level_statement'
        from C:/Ruby200/lib/ruby/2.0.0/irb.rb:488:in `eval_input'
        from C:/Ruby200/lib/ruby/2.0.0/irb.rb:397:in `block in start'
        from C:/Ruby200/lib/ruby/2.0.0/irb.rb:396:in `catch'
        from C:/Ruby200/lib/ruby/2.0.0/irb.rb:396:in `start'
        from C:/Ruby200/bin/irb:12:in `<main>'

So my initial problem is not even touched (rails c and pry) …

Before I peg the yak in my journey to continue shaving it – all in order to be able starting at least some minimal productivity in a ruby rails2.0.0 – rails 4.0.0 combo - could a more knowledgeable person than I am please confirm that I am either totally stupid (likelihood is always high 😄), or alternatively confirm this is a feature, expected behaviour or maybe a bug ??

I by no means want to mix-up different issues, but as a site remark: Assuming one would have to install rb-readline additionally as a gem for whatever reason or people just installed it without knowing any better (they thought a newer version is available, they tried to fix other issues, e.g. in pry or they just had difficulties making their '''.irbrc''' to play ) .... by looking at the sources it seems to me, the new rb-readline - if installed as gem - would delete any older readline versions it discovers? (like the one in site_ruby that came with the rubyinstaller ... )

I am not sure why and I cannot fully confirm (yet), but I believe in my (other) development environment - after installung rb-readline as a gem, the original (older) rb-readline in site_ruby was wiped out.

I assume this is desired behaviour? Either way, if so, I suggest a warning or maybe mentioning in the new readme 5.0 to clarify it for a noobies like me.

@DHB
Copy link

DHB commented May 6, 2013

Just one addition, it should not make a difference whether rb-readline is installed as gem or lives in site_ruby, right?

@luislavena
Copy link
Collaborator

@DHB I believe the fix sent by @yui-knk that I've recently merged by #95 solve this issue:

C:\Users\Luis\Code\luislavena\rb-readline>git rev-parse HEAD
799dee9e2320614b692d94e7b89de7174a3f8c5e

C:\Users\Luis\Code\luislavena\rb-readline>irb -Ilib
DL is deprecated, please use Fiddle
irb(main):001:0> puts RbReadline::RB_READLINE_VERSION
0.5.0.pre.1
=> nil
irb(main):002:0> require "readline"
=> false
irb(main):003:0> require "rb-readline"
=> true
irb(main):004:0> puts RbReadline::RB_READLINE_VERSION
0.5.0.pre.1
=> nil

I've pushed changes that should allow you to use Bundler with the repository for testing.

I'm closing this now, really sorry for it took so long to get solved.

Please feel free to open again if this didn't work.

Thank you.

@luislavena luislavena closed this Jan 3, 2014
@luislavena
Copy link
Collaborator

@prijutme4ty I'm closing this as the issue with 0.5.0 should be solved now. Also not going to backport such change to 0.4.x branch.

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants