Project

General

Profile

Actions

Bug #2119

closed

'gem' method has problem when gems are in ~/.gem and no version requirement is given

Added by Cezary (Cezary Baginski) over 14 years ago. Updated almost 13 years ago.

Status:
Closed
ruby -v:
1.9.1 (2009-07-16 patchlevel 243)
[ruby-core:25635]

Description

=begin
$ruby -e "gem 'pg'; require 'pg'"
internal:gem_prelude:234:in push_gem_version_on_load_path': Could not find RubyGem pg (>= 0) (Gem::LoadError) from <internal:gem_prelude>:14:in gem'
from -e:1:in `'
$ ruby -e "gem 'pg', '0.8.0'; require 'pg'"

Workaround: add version requirement or call Gem.activate(...)

Sorry for not testing trunk/HEAD - it took me a while to work out how gem_prelude is used in the build system.
I'll do so as soon as I can (+14 hours).

1.8.7 works, btw.
=end


Files

patch_gems_in_home.patch (1.06 KB) patch_gems_in_home.patch patches gem_prelude.rb - workaround for gems installed in ~/.home Cezary (Cezary Baginski), 10/02/2009 07:26 AM
Actions #1

Updated by zenspider (Ryan Davis) over 14 years ago

  • Assignee set to drbrain (Eric Hodel)

=begin

=end

Actions #2

Updated by Cezary (Cezary Baginski) over 14 years ago

=begin
Here is a patch for gem_prelude.rb:

  • if no requirement is given, '>=0' is assumed instead of raising an error (seems reasonable, since many gems do not provide version requirements)

  • patch created with 'git diff -b -w --patience gem_prelude.rb > patch_gems_in_home.patch' (for more clarity)

  • created against:
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25173 ( SHA1: eeb88c0af45ebb9404be6ea0d4ae3ac164df9e84 )

Issues:

  • doesn't break anything AFAIK - test/rubygems/test_*.rb are broken in a few places anyway, but nothing new is broken

  • i would normally write a test case or two, but I would prefer feedback first about what the old code was supposed to do
    =end

Actions #3

Updated by Cezary (Cezary Baginski) over 14 years ago

=begin
On Fri, Oct 02, 2009 at 10:14:37PM +0900, Roger Pack wrote:

  • doesn't break anything AFAIK - test/rubygems/test_*.rb are broken in a few places anyway, but nothing new is broken

Do you have a reproducible test case? Does this occur with rubygems trunk?

Reproducable on two different pc's.

The only strange thing on my setup is probably having every gem in
~/.gem. (There are none in /usr/local/...).

Steps I took to get this situation:

  1. Ubuntu Karmic (shouldn't make a difference)
  2. Installed ruby from ruby-1.9.1-p243.tar.gz
  3. Problems with gem versions in many packages
  4. Installed rubygems-1.3.5.tgz
  5. Problems still occur
  6. Installed rubygems from trunk (svn)
  7. Problems still occur

And I found out (step 7) that the gem_prelude is used from ruby in step 2.

After that I got ruby from git and created the patch.

I'll try to remove all ruby packages and reinstall (step 2) just to
make sure...

Let me know if there is anything else you wan't me to check.

--
Cezary Bagiński

=end

Actions #4

Updated by Cezary (Cezary Baginski) over 14 years ago

=begin
On Fri, Oct 02, 2009 at 10:14:37PM +0900, Roger Pack wrote:

  • doesn't break anything AFAIK - test/rubygems/test_*.rb are broken in a few places anyway, but nothing new is broken

Do you have a reproducible test case? Does this occur with rubygems trunk?

O, and sorry for not providing a test case. I didn't really know how
express something like:

$ruby -e "gem 'pg'; require 'pg'"

in a reasonable way as a test case for rubygems. I took a look
earlier, but gave up quick.

Does it suggest a problem with Requirement, Version, load_paths or
something else?

Thanks.

--
Cezary Bagiński

=end

Actions #5

Updated by Cezary (Cezary Baginski) over 14 years ago

=begin
After removing ruby and rubygems from the system (apt, /usr/local):

Works now on r25173 (surprise!), still fails on r24175. (Details below).

I'm still not sure what was causing the problem to persist in r25173.

Sorry for the noise. Consider this closed. Patch irrelevant.

$ ruby -e "gem 'pg'; require 'pg'"
internal:gem_prelude:234:in push_gem_version_on_load_path': Could not find RubyGem pg (>= 0) (Gem::LoadError) from <internal:gem_prelude>:14:in gem'
from -e:1:in `'
$ ruby --version
ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux]
$ gem env
RubyGems Environment:

  • RUBYGEMS VERSION: 1.3.1
  • RUBY VERSION: 1.9.1 (2009-07-16 patchlevel 243) [x86_64-linux]

$ ruby -e "gem 'pg'; require 'pg'"
$ ruby --version
ruby 1.9.2dev (2009-10-01 trunk 25173) [x86_64-linux]
$ gem env
RubyGems Environment:

  • RUBYGEMS VERSION: 1.3.4
  • RUBY VERSION: 1.9.2 (2009-10-01 patchlevel -1) [x86_64-linux]

=end

Actions #6

Updated by marcandre (Marc-Andre Lafortune) over 14 years ago

  • Status changed from Open to Closed

=begin

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0