aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-03-25 22:00:15 +0900
committerNARUSE, Yui <naruse@airemix.jp>2020-03-27 14:51:35 +0900
commit5ccf57f23eb7a35ac699edc2fc598c47fa1844a0 (patch)
tree765bd283ae608af64b0a6de7bfdccf7b163e3700
parent7b5133801340cfa7e4e4e5dd61384cb90c3f6085 (diff)
downloadruby-5ccf57f23eb7a35ac699edc2fc598c47fa1844a0.tar.gz
Make RbConfig::CONFIG values mutable [Bug #16738]
As `RbConfig.expand` modifies the argument and involved `CONFIG` values, its values should be mutable. (cherry picked from commit 4adb2d655dcd54b28366b4d17e86b21e2b622cd1)
-rw-r--r--test/test_rbconfig.rb9
-rwxr-xr-xtool/mkconfig.rb2
2 files changed, 10 insertions, 1 deletions
diff --git a/test/test_rbconfig.rb b/test/test_rbconfig.rb
index 1bbf01b9a6..fcbbbd8500 100644
--- a/test/test_rbconfig.rb
+++ b/test/test_rbconfig.rb
@@ -51,4 +51,13 @@ class TestRbConfig < Test::Unit::TestCase
assert_match(/\$\(sitearch|\$\(rubysitearchprefix\)/, val, "#{key} #{bug7823}")
end
end
+
+ if /darwin/ =~ RUBY_PLATFORM
+ def test_sdkroot
+ assert_separately([{"SDKROOT" => "$(prefix)/SDKRoot"}], "#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
+ assert_equal RbConfig::CONFIG["prefix"]+"/SDKRoot", RbConfig::CONFIG["SDKROOT"]
+ end;
+ end
+ end
end
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb
index 038fbf6428..05ecb815ca 100755
--- a/tool/mkconfig.rb
+++ b/tool/mkconfig.rb
@@ -268,7 +268,7 @@ print <<EOS if $unicode_emoji_version
CONFIG["UNICODE_EMOJI_VERSION"] = #{$unicode_emoji_version.dump}
EOS
print <<EOS if /darwin/ =~ arch
- CONFIG["SDKROOT"] = ENV["SDKROOT"] || "" # don't run xcrun every time, usually useless.
+ CONFIG["SDKROOT"] = "\#{ENV['SDKROOT']}" # don't run xcrun every time, usually useless.
EOS
print <<EOS
CONFIG["archdir"] = "$(rubyarchdir)"