chruby icon indicating copy to clipboard operation
chruby copied to clipboard

Partial matches produce very surprising results

Open indirect opened this issue 11 years ago • 6 comments

I have many rubies, including 2.0.0 and 2.2.0-dev. Unexpectedly (to me), chruby 2.0 chooses 2.2.0-dev instead of 2.0.0. Is this expected or documented?

$ chruby
   1.8.7
   1.8.7-p358
   1.9.3
   1.9.3-p545
   2.0.0
   2.0.0-p481
   2.1.0
   2.1.1
   2.1.2
 * 2.2.0-dev
   jruby-1.7.9

$ chruby 2.0

$ ruby -v
ruby 2.2.0dev (2014-09-12 trunk 47552) [x86_64-darwin13]

indirect avatar Oct 23 '14 16:10 indirect

That is definitely not right. It appears the fuzzy matching is matching the 2.2.0 part.

postmodern avatar Oct 23 '14 19:10 postmodern

@indirect checkout the sequential_version_matching branch.

postmodern avatar Oct 24 '14 05:10 postmodern

👍

On Oct 23, 2014, at 10:46 PM, Postmodern [email protected] wrote:

@indirect checkout the sequential_version_matching branch.

— Reply to this email directly or view it on GitHub.

indirect avatar Oct 24 '14 05:10 indirect

I'm running into this as well:

➜ chruby 2.0 && ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin12.0]
➜ chruby 2.0.0 && ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.5.0]

myronmarston avatar Apr 01 '15 06:04 myronmarston

Hit this now in #500, with Ruby 3.0.6 and 3.3.0 installed. Similar to the OP, chruby 3.0 is picking 3.3.0 over 3.0.6.

Fryguy avatar Jan 31 '24 21:01 Fryguy

@postmodern Your branch there in https://github.com/postmodern/chruby/issues/291#issuecomment-60347106 seems like a great fix. Any reason it didn't become a pull request?

Fryguy avatar Jan 31 '24 21:01 Fryguy