On Nov 26, 2007, at 10:26 AM, Yusuke ENDOH wrote:

> Hi,
>
> I cannot invoke ruby-thunk because of gem_prelude.rb.
>
>
>
> $ ./ruby -v -e ''
> ruby 1.9.0 (2007-11-26 patchlevel 0) [i686-linux]
> gem_prelude.rb:134:in `block (2 levels) in
> push_all_highest_version_gems_on_load_path': bad value for range
> (ArgumentError)
>        from gem_prelude.rb:131:in `each'
>        from gem_prelude.rb:131:in `block in
> push_all_highest_version_gems_on_load_path'
>        from gem_prelude.rb:128:in `each'
>        from gem_prelude.rb:128:in  
> `push_all_highest_version_gems_on_load_path'
>        from gem_prelude.rb:178:in `<compiled>'
>
>
>
> In my environment, there is a directory named "1.8" in "$GEM_HOME/ 
> gem",
> which seems to cause the exception.
>
>
>
> $ echo $GEM_HOME
> /opt/rubygems
>
> $ ls $GEM_HOME/gems
> 1.8                 actionwebservice-1.2.3  rails-1.2.3     
> sqlite-2.0.1
> ...
>
>
>
> I don't know whether it should be removed or not because I'm not
> familiar with gem and I don't remember how to install gem ;)
> I think that the core interpreter should work even in slightly
> unusual environment.

I indeed added that check to skip unless dash and also wrapped the  
whole initialization code in begin/rescue block in case of failure (to  
allow to to still start up even with and error).  You should not have  
that directory (1.8) in the gems directory.  There should just be  
directories that contain unpacked gems.  What is in the 1.8 directory  
on your machine?

Best,

Rich

>
>
>
>
> Index: gem_prelude.rb
> ===================================================================
> --- gem_prelude.rb      (revision 14024)
> +++ gem_prelude.rb      (working copy)
> @@ -131,6 +131,7 @@
>           Dir.entries(gems_directory).each do |gem_directory_name|
>             next if gem_directory_name == "." || gem_directory_name  
> == ".."
>             dash = gem_directory_name.rindex("-")
> +            next unless dash
>             gem_name = gem_directory_name[0...dash]
>             current_version = GemVersions[gem_name]
>             new_version =
> calculate_integers_for_gem_version(gem_directory_name[dash+1..-1])
>
> -- 
> Yusuke ENDOH <mame / tsg.ne.jp>
>