Bugs: Browse | Submit New | Admin

[#27087] Rubygems 1.3.5 and Ruby 1.9 breaks hard after require 'rubygems/specification'

Date:
2009-09-10 16:34
Priority:
1
Submitted By:
Rob Sanheim (rsanheim)
Assigned To:
Eric Hodel (drbrain)
Category:
#gem and #require methods
State:
Closed
Summary:
Rubygems 1.3.5 and Ruby 1.9 breaks hard after require 'rubygems/specification'

Detailed description
Please see the repo:

http://github.com/rsanheim/ruby19_rubygems_bug/tree/master

The build is here:

http://runcoderun.com/rsanheim/ruby19_rubygems_bug

The failing build on Ruby 1.9.1 p243:

http://runcoderun.com/rsanheim/ruby19_rubygems_bug

http://runcoderun.com/rsanheim/ruby19_rubygems_bug/builds/09a9f683fe7848980e10ac7bd2291040ec11ea17/1/ruby_191

Here is the simplest code to illustrate:

  require 'hoe'
  gem 'hoe' # these should work

  puts "about to break 'gem'"  
  require 'rubygems/specification'
  gem 'hoe' # exception thrown here when it shouldn't be

Add A Comment: Notepad

Please login


Followup

Message
Date: 2010-11-12 17:46
Sender: Ryan Davis

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.
Date: 2010-05-09 04:23
Sender: Hedge Hog

OK, disregard last comment. Some other gems need to
be installed.

Recommended workaround is as mentioned before:
Remove require 'rubygems/specification'

So far I have not seen any adverse side effects.
Date: 2010-05-09 00:23
Sender: Hedge Hog

Why I'm not yet sure but it is called after rake/gempackagetask.
Specifically:

require 'rubygems'
require 'rake/gempackagetask'
require 'rubygems/specification'

If I comment out the 
require 'rubygems/specification'

I still get a failure:

http://www.pastie.org/952149

I'm yet to get my head around how/why Chef has to use this
sequence.... they may not be alone.

It is still a useful example of a reproducible case that
is minimal:

$ gem list --local

*** LOCAL GEMS ***

rake (0.8.7)
rdoc (2.5.8)

HTH?
Date: 2010-05-04 16:26
Sender: Eric Hodel

Why are you requiring rubygems/specification?

require 'rubygems' provides it for you.
Date: 2010-05-04 01:49
Sender: Hedge Hog

The following is a minimal rvm example, the `rake -T` command
triggers the issue here too:

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-i
nstall-head )

cat >~/.bash_profile <<EOT
source ~/.bashrc
export LC_ALL=en_US.utf8
export LANGUAGE=en_US.utf8
export LANG=en_US.utf8
if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm
; fi
EOT

source ~/.bash_profile
rvm install 1.9.1 

pushd ~/src
git clone git://github.com/opscode/mixlib-authentication.git
pushd mixlib-authentication
rake -T 2>&1|tee /tmp/rake-t-error.log
popd
popd


The rake log is here:
http://www.pastie.org/944745

HTH?


gem list --local

*** LOCAL GEMS ***

rake (0.8.7)
rdoc (2.5.8)

Date: 2010-05-04 00:39
Sender: Hedge Hog

Also affects:
    
    ruby 1.9.2dev (2009-07-18 trunk 24186) [x86_64-linux]
Date: 2010-04-21 23:54
Sender: Eric Hodel

I'm not entirely sure how this is breaking, but require 'rubygems'
provides Gem::Specification, so you don't need to require it.
The workaround is to not require 'rubygems/specification'.
Date: 2009-09-11 03:30
Sender: Ryan Davis

We've already tracked down the problem. The workaround as described
is to remove your manually installed rubygems from 1.9.x.
Date: 2009-09-11 02:33
Sender: Adam Salter

Ryan: Sorry about that. I (too) am working on several projects,
busy and wanted to throw in my helpful comments... I find problems
can get fixed quicker if the devs know how many people are
affected.

I misunderstood your initial comment: 

'0 failures out of 4' sounds like no failures, which could certainly
be assumed to be a good thing - except we are trying to track
down a problem.

+1 biting off a much ruder comment and looking to the future
with hope and optimism.
Date: 2009-09-11 02:08
Sender: Ryan Davis

Please don't +1. That shit is obnoxious.

We don't need to test this against jeweler if we have a much
cleaner smaller repro that is standalone.
Date: 2009-09-10 21:47
Sender: Adam Salter

+1 please fix... Not exactly 'urgent' but annoying.

I raised a bug on the 'jeweler' gem because of this:

http://github.com/technicalpickles/jeweler/issues#issue/34

I'm sure that the code i provide there:

Rakefile: require 'jeweler'

rake -T

will trigger issue.
Date: 2009-09-10 16:54
Sender: Ryan Davis

Huh!

% sudo gem uninstall rubygems-update
% multiruby -rubygems -rrubygems/specification -e 'gem
"hoe"'
...
TOTAL RESULT = 0 failures out of 4

Passed: 1.9.1-p129, 1.8.7-p72, 1.8.7-p160, 1.8.6-p368
Date: 2009-09-10 16:53
Sender: Ryan Davis

Easier repro of the warnings:

multiruby -rubygems -rrubygems/specification -e 0

and:

multiruby -rubygems -rrubygems/specification -e 'gem
"hoe"'

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
close_date2010-11-12 17:462010-11-12 17:46zenspider
status_idOpen2010-11-12 17:46zenspider
priority32010-04-21 23:54drbrain
assigned_tonone2009-09-10 16:53zenspider
category_idNone2009-09-10 16:53zenspider