From 851a3e772480308a3dd014fef9af901ef29eb9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 16 Jul 2025 18:29:13 +0200 Subject: [PATCH] [rubygems/rubygems] Restore treating "--" as an unknown platform Rather than crashing when parsing it. https://github.com/rubygems/rubygems/commit/aa0064e4c7 --- lib/rubygems/platform.rb | 2 +- test/rubygems/test_gem_platform.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb index 8b82292a46..e30c266fab 100644 --- a/lib/rubygems/platform.rb +++ b/lib/rubygems/platform.rb @@ -90,7 +90,7 @@ class Gem::Platform when String then cpu, os = arch.sub(/-+$/, "").split("-", 2) - @cpu = if cpu.match?(/i\d86/) + @cpu = if cpu&.match?(/i\d86/) "x86" else cpu diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb index a35332408a..a3ae919809 100644 --- a/test/rubygems/test_gem_platform.rb +++ b/test/rubygems/test_gem_platform.rb @@ -162,6 +162,8 @@ class TestGemPlatform < Gem::TestCase "x86_64-dotnetx86" => ["x86_64", "dotnet", nil], "x86_64-dalvik0" => ["x86_64", "dalvik", "0"], "x86_64-dotnet1." => ["x86_64", "dotnet", "1"], + + "--" => [nil, "unknown", nil], } test_cases.each do |arch, expected|