Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Ensure two RemoteSpecifications are comparable #3815

Merged
merged 3 commits into from
Jul 10, 2015
Merged

Ensure two RemoteSpecifications are comparable #3815

merged 3 commits into from
Jul 10, 2015

Conversation

timblair
Copy link
Contributor

@timblair timblair commented Jul 8, 2015

The RemoteSpecification#sort_obj method was added in e5d936e (which was cherry-picked from #3767) to fix #3762, but it still fails when comparing two instances of RemoteSpecification.

As #sort_obj is private, the check for other.respond_to?(:sort_obj) returns false, which means the <=> check falls back to the default (from Object) which returns nil if the objects being compared don't match. This then results in an ArgumentError when (e.g.) sorting an array containing multiple instances of RemoteSpecification.

The fix is simple: make RemoteSpecification#sort_obj public.

The RemoteSpecification#sort_obj method was added in e5d936e (which
was cherry-picked from #3767) to fix #3762, but it still fails when
comparing two instances of RemoteSpecification.

As #sort_obj is private, the check for other.respond_to?(:sort_obj)
returns false, which means the <=> check falls back to the default
(from Object) which returns nil if the objects being compared don't
match. This then results in an ArgumentError when (e.g.) sorting an
array containing multiple instances of RemoteSpecification.

The fix is simple: make RemoteSpecification#sort_obj public.
@timblair
Copy link
Contributor Author

timblair commented Jul 8, 2015

/cc @tony-spataro-rs as author of the original fix.

The original cases ("not zero") would still pass if the check resulted
in a nil response.
@ghost
Copy link

ghost commented Jul 8, 2015

Good catch; thanks! Fix LGTM.

@indirect
Copy link
Member

thanks. :)

indirect added a commit that referenced this pull request Jul 10, 2015
Ensure two RemoteSpecifications are comparable
@indirect indirect merged commit efcb5e2 into rubygems:master Jul 10, 2015
@indirect
Copy link
Member

Cherry-picked to 1-10-stable ending with 856ef24.

@timblair timblair deleted the compare-stub-specifications branch July 10, 2015 07:20
@sobrinho
Copy link

There is a estimated release date? It is holding me to upgrade bundler on a rails 2.3 application.

@ghost
Copy link

ghost commented Jul 21, 2015

Sorry, I don't know; I'm not closely related to the Bundler project.

While you're waiting, you could monkey-patch Tim Blair's fix into your app (just redefine the method in an initializer).

@segiddins
Copy link
Member

I plan to release 1.10.6 when I get home tonight

@sobrinho
Copy link

@segiddins nice, keep me updated <3

@coilysiren coilysiren modified the milestone: Release Archive Oct 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundler 1.10.1 breaks Rails 2.3.x plugin-loading
5 participants