https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112023-01-31T19:44:48ZRuby Issue Tracking SystemRuby master - Bug #19394: cvars in instance of cloned class point to source class's cvars even after class_variable_set on clonehttps://bugs.ruby-lang.org/issues/19394?journal_id=1015842023-01-31T19:44:48Zbyroot (Jean Boussier)byroot@ruby-lang.org
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/17763">Feature #17763</a>: Implement cache for cvars</i> added</li></ul> Ruby master - Bug #19394: cvars in instance of cloned class point to source class's cvars even after class_variable_set on clonehttps://bugs.ruby-lang.org/issues/19394?journal_id=1015852023-01-31T19:45:29Zbyroot (Jean Boussier)byroot@ruby-lang.org
<ul></ul><p>Based on the timeline and description, this is likely a result of [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Implement cache for cvars (Closed)" href="https://bugs.ruby-lang.org/issues/17763">#17763</a>]. cc <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/9236">@eileencodes (Eileen Uchitelle)</a> & <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/73">@tenderlovemaking (Aaron Patterson)</a></p> Ruby master - Bug #19394: cvars in instance of cloned class point to source class's cvars even after class_variable_set on clonehttps://bugs.ruby-lang.org/issues/19394?journal_id=1015862023-01-31T19:52:34Zeileencodes (Eileen Uchitelle)
<ul></ul><p>I will take a look, thanks for the ping Jean.</p> Ruby master - Bug #19394: cvars in instance of cloned class point to source class's cvars even after class_variable_set on clonehttps://bugs.ruby-lang.org/issues/19394?journal_id=1017002023-02-07T20:53:41Zeileencodes (Eileen Uchitelle)
<ul></ul><p>I've pushed a fix up to github <a href="https://github.com/ruby/ruby/pull/7265" class="external">https://github.com/ruby/ruby/pull/7265</a>. We added a cref to the cvar cache that we can check if it's the same as the cref we have. If they are different we shouldn't read from the cache.</p> Ruby master - Bug #19394: cvars in instance of cloned class point to source class's cvars even after class_variable_set on clonehttps://bugs.ruby-lang.org/issues/19394?journal_id=1017182023-02-08T20:57:35Zeileencodes (Eileen Uchitelle)
<ul></ul><p>The fix ended up being a bit more involved. We needed two PRs.</p>
<p>One to copy the CVAR table on clone: <a href="https://github.com/ruby/ruby/pull/7275" class="external">https://github.com/ruby/ruby/pull/7275</a><br>
And one to check the cref and not read from the cache if they differ (ie is the cloned class): <a href="https://github.com/ruby/ruby/pull/7265" class="external">https://github.com/ruby/ruby/pull/7265</a></p>
<p>Both will need to be backported to 3.2.x and 3.1.x when merged.</p> Ruby master - Bug #19394: cvars in instance of cloned class point to source class's cvars even after class_variable_set on clonehttps://bugs.ruby-lang.org/issues/19394?journal_id=1037302023-07-01T04:49:57Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN</i> to <i>3.0: UNKNOWN, 3.1: REQUIRED, 3.2: REQUIRED</i></li></ul> Ruby master - Bug #19394: cvars in instance of cloned class point to source class's cvars even after class_variable_set on clonehttps://bugs.ruby-lang.org/issues/19394?journal_id=1037312023-07-01T04:55:46Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>This issue should be fixed at 40f090f4339820d19da8ecdf81a981489c22eb57 and 135a5eb716399443da58db342de6093c91b5ad62 in master branch.</p>
<p>Thank you for creating the PRs to backport them into stable branches.<br>
I will handle it (the one for ruby_3_2 branch) soon.</p>
<p>3.1: <a href="https://github.com/ruby/ruby/pull/7889" class="external">https://github.com/ruby/ruby/pull/7889</a><br>
3.2: <a href="https://github.com/ruby/ruby/pull/7888" class="external">https://github.com/ruby/ruby/pull/7888</a></p> Ruby master - Bug #19394: cvars in instance of cloned class point to source class's cvars even after class_variable_set on clonehttps://bugs.ruby-lang.org/issues/19394?journal_id=1037322023-07-01T05:19:16Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Backport</strong> changed from <i>3.0: UNKNOWN, 3.1: REQUIRED, 3.2: REQUIRED</i> to <i>3.0: UNKNOWN, 3.1: REQUIRED, 3.2: DONE</i></li></ul><p>Merged <a href="https://github.com/ruby/ruby/pull/7888" class="external">https://github.com/ruby/ruby/pull/7888</a></p> Ruby master - Bug #19394: cvars in instance of cloned class point to source class's cvars even after class_variable_set on clonehttps://bugs.ruby-lang.org/issues/19394?journal_id=1039792023-07-25T11:06:27Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>3.0: UNKNOWN, 3.1: REQUIRED, 3.2: DONE</i> to <i>3.0: UNKNOWN, 3.1: DONE, 3.2: DONE</i></li></ul><p>merged <a href="https://github.com/ruby/ruby/pull/7889" class="external">https://github.com/ruby/ruby/pull/7889</a><br>
thx!</p>