You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From a very quick look the error is because rb_str_locktmp() is called on a truly-immutable string (e.g. a frozen string literal or String#-@ or Symbol#name).
That means it shouldn't have state, which also means it shouldn't be possible to lock it.
Isn't string locking meant to avoid concurrent modifications to a string and so shouldn't be done if the string is frozen or indicates a bug in the caller (trying to mutate a frozen string)?
rb_str_locktmp() could be noop for immutable strings, but is that correct? If something queries whether it's locked then it wouldn't reflect it.
rb_str_locktmp() could be noop for immutable strings, but is that correct? If something queries whether it's locked then it wouldn't reflect it.
Yeah, not too sure. We probably should add some specs after that. IMO it would be OK for locktmp to noop on frozen strings, as long as it's speced. But yes, that could be surprising to some people.
I also wonder if as a side effect of rb_str_locktmp(frozen_string), trying to mutate that frozen string raises another error and not the correct FrozenError.
Ref: ruby/openssl#831
Whereas MRI doesn't care whether the string is frozen or not, it will lock it either way:
cc @eregon @nirvdrum
The text was updated successfully, but these errors were encountered: