Project

General

Profile

Actions

Bug #16738

closed

RbConfig::CONFIG["SDKROOT"] not frozen on macOS

Added by bjfish (Brandon Fish) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
2.6.5, 2.7.0
[ruby-core:97585]

Description

The 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.

Spec Failure

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)>'

Example

% unset SDKROOT
% ruby -e 'p RbConfig::CONFIG["SDKROOT"].frozen?'
false
% export SDKROOT="test"
% ruby -e 'p RbConfig::CONFIG["SDKROOT"].frozen?'
true

Environment
macOS

Versions Tested
2.6.5
2.7.0

Updated by Eregon (Benoit Daloze) over 4 years 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).

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|4adb2d655dcd54b28366b4d17e86b21e2b622cd1.


Make RbConfig::CONFIG values mutable [Bug #16738]

As RbConfig.expand modifies the argument and involved CONFIG
values, its values should be mutable.

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED

Updated by naruse (Yui NARUSE) over 4 years ago

  • Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED to 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE

ruby_2_7 5ccf57f23eb7a35ac699edc2fc598c47fa1844a0.

Updated by nagachika (Tomoyuki Chikanaga) over 4 years ago

  • Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE to 2.5: REQUIRED, 2.6: DONE, 2.7: DONE

ruby_2_6 r67859 merged revision(s) 4adb2d655dcd54b28366b4d17e86b21e2b622cd1.

Actions #6

Updated by usa (Usaku NAKAMURA) over 4 years ago

  • Backport changed from 2.5: REQUIRED, 2.6: DONE, 2.7: DONE to 2.5: DONE, 2.6: DONE, 2.7: DONE

Updated by ihdadi.page@gmail.com (منصة شليله) over 4 years ago

  • File network-2402637_640.jpg added
Actions #8

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • File deleted (network-2402637_640.jpg)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0