RbConfig::CONFIG["SDKROOT"] not frozen on macOS
RbConfig::CONFIG["SDKROOT"] is not frozen on macOS when the
SDKROOT environment variable is set which causes the kernel spec (https://github.com/ruby/ruby/blob/1b3339528c0804aa0e673bd3f15be8b087d17bd8/spec/ruby/library/rbconfig/rbconfig_spec.rb#L27) to fail.
1) RbConfig::CONFIG contains no frozen strings even with --enable-frozen-string-literal FAILED Expected "SDKROOT Failure\n" + "Done\n" == "Done\n" to be truthy but was false /Users/bfish/Documents/projects/spec/library/rbconfig/rbconfig_spec.rb:28:in `block (2 levels) in <top (required)>' /Users/bfish/Documents/projects/spec/library/rbconfig/rbconfig_spec.rb:4:in `<top (required)>'
% unset SDKROOT % ruby -e 'p RbConfig::CONFIG["SDKROOT"].frozen?' false % export SDKROOT="test" % ruby -e 'p RbConfig::CONFIG["SDKROOT"].frozen?' true
Updated by Eregon (Benoit Daloze) 4 months ago
The reason RbConfig entries cannot be frozen currently is because RbConfig.expand which calls String#replace.
So I think this is a bug, and we should ensure all RbConfig entries are mutable, hence the spec.
Alternatively, one could try to rewrite
RbConfig.expand, but not sure that's possible in a compatible way
(I don't understand that code in details).
Updated by nobu (Nobuyoshi Nakada) 4 months ago
- Status changed from Open to Closed