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 about 13 years ago.
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
- Assignee set to drbrain (Eric Hodel)
=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
=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:
- Ubuntu Karmic (shouldn't make a difference)
- Installed ruby from ruby-1.9.1-p243.tar.gz
- Problems with gem versions in many packages
- Installed rubygems-1.3.5.tgz
- Problems still occur
- Installed rubygems from trunk (svn)
- 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
=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
=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
- Status changed from Open to Closed
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0