# Ruby hangs when trying to install RubyGems

**URL:** <https://www.ruby-forum.com/t/ruby-hangs-when-trying-to-install-rubygems/84823>\
**Category:** Rails\
**Created:** [February 7, 2007, 11:46pm UTC](https://www.ruby-forum.com/t/ruby-hangs-when-trying-to-install-rubygems/84823 "2007-02-07T23:46:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [February 7, 2007, 11:46pm UTC](https://www.ruby-forum.com/t/ruby-hangs-when-trying-to-install-rubygems/84823/1 "2007-02-07T23:46:57Z")

</div>

I’ve just set up a minimal Gentoo install and emerged Ruby 1.8.5 from  
portage. I then went to emerge rubygems, and found that it hangs.  
Manually downloading the file and running ‘ruby setup.rb’ also hangs.  
The following are the last few lines I get before nothing happens, and  
my CPU sits at 100% (from Ruby):

Successfully built RubyGem  
Name: sources  
Version: 0.0.1  
File: sources-0.0.1.gem

Any help would be great.

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [February 8, 2007, 12:03am UTC](https://www.ruby-forum.com/t/ruby-hangs-when-trying-to-install-rubygems/84823/2 "2007-02-08T00:03:58Z")

</div>

A compilation from source makes no difference, either. Is this some  
sort of unique Gentoo issue?

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [February 18, 2007, 3:49am UTC](https://www.ruby-forum.com/t/ruby-hangs-when-trying-to-install-rubygems/84823/3 "2007-02-18T03:49:52Z")

</div>

I had the same problem both with emerging rubygems or directly running  
setup.rb from rubygems-0.9.2.tgz  
I fixed it by patching rubygems-0.9.2/lib/rubygems/packages.rb:

## 450,453c450,453 \< if @io.respond\_to? :seek \< # avoid reading… \< @io.seek(size - entry.bytes\_read, IO::SEEK\_CUR) \< else

> ```
> #if @io.respond_to? :seek
> # # avoid reading...
> # @io.seek(size - entry.bytes_read, IO::SEEK_CUR)
> #else
> 
> ```

## 460c460 \< end

> ```
> #end
> 
> ```

With that patch you force the TarReader to actually read the file  
rather than just seeking into it.  
The bug was that by seeking, the bytes\_read attribute of entry was  
never updated.

Philippe
