[ruby-core:82000] Re: [Ruby trunk Bug#13737] "can't modify frozen String" when installing bundled gems

From: Eric Wong <normalperson@...>
Date: 2017-07-11 07:50:28 UTC
List: ruby-core #82000
ko1@atdot.net wrote:
> Not sure why but r59310 will fix it (at least on my
> environment). To complete it i think we need to dig into
> rubygems deeply....

Thank you.  I think there may also be an old bug at early
initializtion when rb_cString == 0 causing unfrozen string keys
form hash_aset instead of hash_aset_str

Fwiw, following change should not segfault (but it does):

--- a/hash.c
+++ b/hash.c
@@ -1519,7 +1519,7 @@ hash_aset(st_data_t *key, st_data_t *val, struct update_arg *arg, int existing)
 static int
 hash_aset_str(st_data_t *key, st_data_t *val, struct update_arg *arg, int existing)
 {
-    if (!existing && !RB_OBJ_FROZEN(*key)) {
+    if (!existing && !RB_OBJ_FROZEN_RAW(*key)) {
 	st_data_t fstr;
 	st_table *tbl = rb_vm_fstring_table();


Anyways, I will investigate more deeply tomorrow.  I was about to
go to bed before noticing this ticket.

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread