diff options
author | Mike Dalessio <mike.dalessio@gmail.com> | 2022-09-19 15:39:32 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-09-28 05:55:28 +0900 |
commit | 8f7f12ad64c2f01e1fc8a75402337ceeb6607657 (patch) | |
tree | 1e8558f8cf28b0f81aaf073f8cea468d370a8178 /lib/rubygems | |
parent | 5d4048e0bc84829ffcd6ff559515c198773476a2 (diff) | |
download | ruby-8f7f12ad64c2f01e1fc8a75402337ceeb6607657.tar.gz |
[rubygems/rubygems] fix: Gem::Platform.match handles String argument properly
Previously 9eead86 introduced non-commutativity of platforms, and
later commit 1b9f7f50 changed the behavior of `Gem::Platform.match` to
ensure the callee of `#=~` was the gem platform.
However, when the platform argument is a String, then the callee and
argument of `#=~` are flipped (see docs for `String#=~`), which works
against the fix from 1b9f7f50.
Closes #5938
https://github.com/rubygems/rubygems/commit/3b1fb562e8
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/platform.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb index 06de5ded8d..1dacc596c4 100644 --- a/lib/rubygems/platform.rb +++ b/lib/rubygems/platform.rb @@ -22,6 +22,7 @@ class Gem::Platform end def self.match_platforms?(platform, platforms) + platform = Gem::Platform.new(platform) unless platform.is_a?(Gem::Platform) platforms.any? do |local_platform| platform.nil? || local_platform == platform || |