bundler doesn't recognize spork-0.9.0.rc7 #1202

Closed
dchelimsky opened this Issue May 25, 2011 · 23 comments

Projects

None yet

8 participants

@dchelimsky

This is a bit odd:

$ cat Gemfile | grep spork
gem "spork", "0.9.0.rc7", :group => [:development, :test]

$ gem q -rn spork --pre --source http://rubygems.org

*** REMOTE GEMS ***

invo-sporknife (0.1.0.pre)
nimboids-spork (0.9.0.rc2)
spork (0.9.0.rc7, 0.9.0.rc6, 0.9.0.rc5, 0.9.0.rc4, 0.9.0.rc3, 0.9.0.rc2, 0.9.0.rc)

$ bundle package
Fetching source index for http://rubygems.org/
Could not find spork-0.9.0.rc7 in any of the sources

$ gem install spork -v 0.9.0.rc7 --source http://rubygems.org
Building native extensions.  This could take a while...
Successfully installed spork-0.9.0.rc7
1 gem installed
@sferik
Member
sferik commented May 25, 2011

Strange. What version of bundler are you using?

@dchelimsky

bundler-1.0.13

Here's some more info:

$ gem -v
1.3.7
$ bundle package
Using rake (0.9.0) 
# ...
Updating .gem files in vendor/cache
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc7.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache
  * spork-0.9.0.rc7.gem
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc7.gem

$ gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.8.3
# ...

$ bundle package
# ...
Updating .gem files in vendor/cache
  * spork-0.9.0.rc7.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache

So it's something about bundler-1.0.13 + rubygems-1.3.7 + spork-0.9.0.rc7. Gotta love it!

@indirect
Member

Yeah, that's pretty odd. I'll check it out as soon as I get the chance.

On May 25, 2011, at 11:49 AM, dchelimsky reply@reply.github.com wrote:

This is a bit odd:

$ cat Gemfile | grep spork
gem "spork", "0.9.0.rc7", :group => [:development, :test]

$ gem q -rn spork --pre --source http://rubygems.org

*** REMOTE GEMS ***

invo-sporknife (0.1.0.pre)
nimboids-spork (0.9.0.rc2)
spork (0.9.0.rc7, 0.9.0.rc6, 0.9.0.rc5, 0.9.0.rc4, 0.9.0.rc3, 0.9.0.rc2, 0.9.0.rc)

$ bundle package
Fetching source index for http://rubygems.org/
Could not find spork-0.9.0.rc7 in any of the sources

$ gem install spork -v 0.9.0.rc7 --source http://rubygems.org
Building native extensions.  This could take a while...
Successfully installed spork-0.9.0.rc7
1 gem installed

Reply to this email directly or view it on GitHub:
#1202

@dburt
dburt commented Jun 17, 2011

Might be the same as issue #1054
#1054 (comment)

@hone
Member
hone commented Jun 17, 2011

This is a bug in rubygems and is fixed in later versions of rubygems, I believe 1.4+

@indirect indirect closed this Jun 18, 2011
@dburt
dburt commented Jun 20, 2011

Can be worked around in Bundler for pre-1.4 compatibility, while RubyGems updates settle down a bit?

@indirect
Member

You can just upgrade to Rubygems 1.4 for the fix for this issue. You don't have to upgrade all the way to Rubygems 1.8.5. That said, if you feel like writing a workaround, I would happily apply it. :)

@dburt
dburt commented Jun 27, 2011

I'm not sure where best to put this monkeypatch, but it seems to do the job. (I put it at the top of runtime.rb.)

# fix bug in Rubygems < 1.4 by forcing calculation of @segments
if Gem::Version.new(Gem::VERSION) < Gem::Version.new("1.4.0")
  class Gem::Version
    def segments # :nodoc:
      unless @segments_generated
        @segments = @version.scan(/[0-9]+|[a-z]+/i).map do |s|
          /^\d+$/ =~ s ? s.to_i : s
        end
      end
      @segments_generated = true
      @segments
    end
  end
end

If you'd like me to fork, patch, and make a pull-request, I can, but as it's such a hack, I would prefer a Bundler person to decide where it goes.

@hone hone was assigned Jun 27, 2011
@hone hone reopened this Jun 27, 2011
@dwradcliffe
Member

I had the same problem and the patch works for me as well. Thanks @dburt.

@hone
Member
hone commented Aug 13, 2011

This should be fixed in 1.1.pre.7 and 1.0.17. Can someone verify this is the case?

@hone hone closed this Aug 13, 2011
@dburt
dburt commented Aug 15, 2011

They look good to me. This also fixes issue #1054, which should therefore also be closed. My test process and output is described below.

dave@dev:~/tmp$ cat Gemfile
source :rubygems
gem 'spork', '0.9.0.rc3'

dave@dev:~/tmp$ bundle --version
Bundler version 1.0.13
dave@dev:~/tmp$ bundle pack
Using spork (0.9.0.rc3)
Using bundler (1.0.13)
Updating .gem files in vendor/cache
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc3.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache
  * spork-0.9.0.rc3.gem
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc3.gem

dave@dev:~/tmp$ sudo gem install bundler --no-ri --no-rdoc
Successfully installed bundler-1.0.17
1 gem installed
dave@dev:~/tmp$ bundle --version
Bundler version 1.0.17
dave@dev:~/tmp$ bundle pack
Using spork (0.9.0.rc3)
Using bundler (1.0.17)
Updating .gem files in vendor/cache
  * spork-0.9.0.rc3.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache

dave@dev:~/tmp$ rm vendor/cache/*

dave@dev:~/tmp$ sudo gem install bundler -v1.1.pre.7 --no-rdoc --no-ri
Successfully installed bundler-1.1.pre.7
1 gem installed
dave@dev:~/tmp$ bundle --version
Bundler version 1.1.pre.7
dave@dev:~/tmp$ bundle pack
Using spork (0.9.0.rc3)
Using bundler (1.1.pre.7)
Updating .gem files in vendor/cache
  * spork-0.9.0.rc3.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache
@hone
Member
hone commented Aug 15, 2011

Thanks for looking into all this again @dburt.

@dburt
dburt commented Aug 15, 2011

Glad to help.

@hone hone reopened this Sep 2, 2011
@hone
Member
hone commented Sep 2, 2011

seems to be broken again due to bad23b5

@dburt
dburt commented Sep 12, 2011

Do you have a test for that, @hone?

Isn't that changeset included in 1.0.17 and 1.1.pre7, which don't exhibit the problem, and 1.0.18 which still works?

I recall adding the lines that are removed by bad23b5 deliberately to workaround a problem like this, but these releases don't include them and appear to me to work fine.

@hone
Member
hone commented Sep 16, 2011

i had to patch the exact patch iirc because it broke rake. I have a test for that. I couldn't come up with a test case for bundle cache on 1.3.7. This is fixed now.

@hone hone closed this Sep 16, 2011
@dburt
dburt commented Sep 20, 2011

So this issue seems to me to be broken again in 1.0.18, but you're saying it's fixed in 1.0.19rc or 1.0.20rc?

@cjbottaro

I'm seeing some weird behavior that might be related...

Updating .gem files in vendor/cache
  * spork-0.9.0.rc9.gem
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc9.gem

Why does bundler add it then immediately remove it?

Here's more info...

$ gem -v
1.3.7
$ bundle -v
Bundler version 1.0.21

Thanks for the help.

P.S. Still see same behavior with bundler-1.1.rc.

@hone hone reopened this Oct 9, 2011
@dburt
dburt commented Oct 10, 2011

Thanks for the report, @cjbottaro, that's definitely the same issue.

Why does bundler add it then immediately remove it?

Because it's in two minds about the version number part "rc9" and the version in the cache ["rc9"] is not equal to the latest bundled version ["rc", "9"] or something like that, due to a bug in Gem::Version#segments in old Rubygems (<1.4).

@hone hone added a commit that referenced this issue Oct 11, 2011
@hone hone test covering issue #1202 5ea0e3d
@dburt
dburt commented Oct 25, 2011

FWIW, running the same versions of Rubygems (1.3.7) and Bundler (1.0.21 and 1.1.rc) as @cjbottaro, I do not encounter the problem. I'm on Ruby 1.8.7 but I'm not sure what other platform differences might make the difference.

@david-harkness

Spork will not install with a bundle install

$ gem --version
1.8.11
$ bundle --version
Bundler version 1.1.rc

@indirect
Member

@david-harkness, please open a ticket with the information from ISSUES.

@indirect indirect closed this Jan 26, 2012
@david-harkness

This was the problem. #1259

I ran a bundle install --without development, earlier in the day.
For some strange reason the --without gets cached, and from then on bundle won't use development ever again.
I had to run a bundle install --without somefakegroupthatdoesntexist
and all was good.

@hone hone added a commit that referenced this issue Mar 14, 2012
@hone hone fix bundle cache edge case for #1202 a23240d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment