[Rubygems-developers] [ rubygems-Bugs-25816 ] misleading error message when one of many sources unreachable.

noreply at rubyforge.org noreply at rubyforge.org
Fri Nov 12 17:46:25 EST 2010


Bugs item #25816, was opened at 2009-05-06 19:42
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=25816&group_id=126

Category: `gem install` command
Group: None
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Larry Kyrala (coldnebo)
Assigned to: Nobody (None)
Summary: misleading error message when one of many sources unreachable.

Initial Comment:
I puzzled over the following for about half an hour:

$ sudo gem install hoe
ERROR:  While executing gem ... (Zlib::GzipFile::Error)
    not in gzip format

Until I finally figured out that one of my sources (aka 'gem sources') was a address only accessible on my company's VPN. (I wasn't on the VPN at the time.) e.g:

$ gem sources
*** CURRENT SOURCES ***

http://gems.rubyforge.org/
http://rubygems.xxx.xxx/    <-- vpn address

This error was confusing, because I was attempting to get 'hoe' which is clearly at gems.rubyforge.org, however apparently gem attempts to ping ALL the sources, even if one isn't available, it croaks with this obscure error.

At least this should be documented.

At most, gem should return a meaningful error if one of the gem sources is unreachable.

Ideally, if the install name is found in one of the gem sources that IS available, it shouldn't matter, and should simply install the gem from the available source.

Other info:

using Mac OSX 10.5

Macports:
$ port installed | grep ruby
  rb-rubygems @1.3.1_0 (active)
  ruby @1.8.7-p72_2+thread_hooks
  ruby @1.8.7-p160_1+thread_hooks (active)
  ruby186 @1.8.6-p287_0+darwin_9+thread_hooks


Hope this helps! 
-lk


----------------------------------------------------------------------

Comment By: Ryan Davis (zenspider)
Date: 2010-11-12 14:46

Message:
This ticket has been deemed stale and we're closing it in order to catch up 
with our ticket list. If you think it is still valid, please reopen.

----------------------------------------------------------------------

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2009-09-15 13:18

Message:
The same issue is described here: http://groups.google.com/group/cukes/browse_thread/thread/fc9809247b3369f5

If multiple --source arguments are passed, rubygems will start to download from tha last one first. (Not sure if that's deterministic or semi-random).

On the first failure, rubygems will bail, not even trying the remaining sources.

----------------------------------------------------------------------

Comment By: Larry Kyrala (coldnebo)
Date: 2009-08-27 13:51

Message:
Ah, I see your point.  I was focusing on the invalid host
first and foremost -- I'm not sure why in linux it reports a
problem with the domain, while under Mac it reports a
fictitious GZip error.. perhaps they are different code
paths on the different platforms?

The original reported problem on the Mac seemed to be due to
vpn disconnect, because removing the gem source
corresponding to the vpn also worked in that case. 

I think the expected behavior (IMHO) should be:

sources.each do |source|
  begin
    source.connect
    next unless source.connected?
    gem = source.search gem_name
    next if gem.nil?
    source.install gem
    break
  ensure
    source.disconnect
  end
end

In this way, rubygems iterates over all the sources
configured until it has searched all the active sources or
finds the gem, whichever comes first.


----------------------------------------------------------------------

Comment By: Nick Hildebrant (nihildeb)
Date: 2009-08-27 12:06

Message:
I thought you meant this:

> $ sudo gem install hoe
> ERROR:  While executing gem ... (Zlib::GzipFile::Error)
>     not in gzip format

was a misleading error message.
--------

If we consider:

ERROR:  could not find gem <gem> locally or in a repository

to be misleading, when there is only a dead host in the sources list, then we can look at that. So...

Gem::SpecFetcher#legacy_repos tries a couple rescues and then raises when _any_ source is not available, regardless if there are more to try, or there are already known good ones.

It is requested that rubygems continue if there is at least one good source in the list.


----------------------------------------------------------------------

Comment By: Nick Hildebrant (nihildeb)
Date: 2009-08-27 11:53

Message:
I thought you meant this:

> $ sudo gem install hoe
> ERROR:  While executing gem ... (Zlib::GzipFile::Error)
>     not in gzip format

was a misleading error message.
--------

If we consider:

ERROR:  could not find gem <gem> locally or in a repository

to be misleading, when there is only a dead host in the sources list, then we can look at that. So...

Gem::SpecFetcher#legacy_repos tries a couple rescues and then raises when _any_ source is not available, regardless if there are more to try, or there are already known good ones.

It is requested that rubygems continue if there is at least one good source in the list.


----------------------------------------------------------------------

Comment By: Larry Kyrala (coldnebo)
Date: 2009-08-27 04:49

Message:
I'm still getting that error. I think maybe you only tested
with one source or two bogus sources. The problem manifests
with one valid and one bogus. let me show you an example
under linux:

lkyrala at lkyrala-ibex-64:~$ gem -v
1.3.4
lkyrala at lkyrala-ibex-64:~$ ruby -v
ruby 1.8.6 (2009-06-08 patchlevel 369) [x86_64-linux]

# first, I edit sources...
lkyrala at lkyrala-ibex-64:~$ gem sources
*** CURRENT SOURCES ***

# notice the FIRST entry is valid and correct:
http://gems.rubyforge.org/
# it's the second entry that is bogus or unreachable:
http://rubygems.nodomain.com/
lkyrala at lkyrala-ibex-64:~$ gem install smoke
ERROR:  http://rubygems.nodomain.com/ does not appear to be
a repository
ERROR:  could not find gem smoke locally or in a repository

# notice how gem INCORRECTLY failed to find smoke on
rubyforge even though it was the FIRST source entry and
valid.  Instead, it INCORRECTLY goes to the second source
and reports an error even though rubyforge works fine.


# so, changing the SECOND source to a valid source...
lkyrala at lkyrala-ibex-64:~$ gem sources
*** CURRENT SOURCES ***

http://gems.rubyforge.org/
# note: I only changed the SECOND source:
http://rubygems.mathworks.com/
lkyrala at lkyrala-ibex-64:~$ gem install smoke
Successfully installed smoke-0.0.6
1 gem installed

# notice that the gem installs from the FIRST source ok now
even though it was the second source that had the problem.

# note: the second source does not have "smoke" in it's repo.


----------------------------------------------------------------------

Comment By: Nick Hildebrant (nihildeb)
Date: 2009-08-26 14:36

Message:
Proper error message is displayed on two linux boxes:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.1
  - RUBY VERSION: 1.8.5 (2006-08-25) [i386-linux]

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.3
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]


ERROR:  http://gems.nosuchdomain.com does not appear to be a repository
ERROR:  could not find gem utility_belt locally or in a repository

Larry suggests: simply install the gem from the available source

If this is accepted, this should be a feature. As a bug, i can not reproduce. 







----------------------------------------------------------------------

Comment By: Larry Kyrala (coldnebo)
Date: 2009-05-06 19:43

Message:
BTW, I forgot to mention the workaround:

Simply remove the source that is unreachable and gem works fine.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=25816&group_id=126


More information about the Rubygems-developers mailing list