Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check_sast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
persist-credentials: false

- name: Run zizmor
uses: zizmorcore/zizmor-action@192e21d79ab29983730a13d1382995c2307fbcaa # v0.5.7
uses: zizmorcore/zizmor-action@6599ee8b7a49aef6a770f63d261d214911a7ce02 # v0.6.0
continue-on-error: true

analyze:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ jobs:
sudo sysctl -w kern.coredump=1
sudo chmod -R +rwx /cores/

- name: Disable ReportCrash
# We don't want this service running on every crash signal. When it's running, processes must wait for
# the service to gather process info before they can finish. We have tests that test our crash signal
# handling and this service can take a while to run which can time our tests out.
run: |
launchctl bootout gui/"$(id -u)"/com.apple.ReportCrash 2>/dev/null || true
launchctl disable gui/"$(id -u)"/com.apple.ReportCrash 2>/dev/null || true
sudo launchctl bootout system/com.apple.ReportCrash.Root 2>/dev/null || true
sudo launchctl disable system/com.apple.ReportCrash.Root 2>/dev/null || true
continue-on-error: true

- name: Delete unused SDKs
# To free up disk space to not run out during the run
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tarball-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:

- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: snapshot-*/.downloaded-cache
path: ${{ inputs.archname }}/.downloaded-cache
key: downloaded-cache

- name: setup env
Expand Down
7 changes: 7 additions & 0 deletions class.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,13 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
rb_class_update_superclasses(clone);
}

if (RB_TYPE_P(clone, T_CLASS)) {
VALUE super = RCLASS_SUPER(clone);
if (super && RB_TYPE_P(super, T_ICLASS)) {
class_switch_superclass(rb_class_superclass(clone), clone);
}
}

return clone;
}

Expand Down
15 changes: 12 additions & 3 deletions compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,10 +1003,10 @@ rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
VALUE *
rb_iseq_original_iseq(const rb_iseq_t *iseq) /* cold path */
{
VALUE *original_code;
VALUE *original_code = RUBY_ATOMIC_PTR_LOAD(ISEQ_BODY(iseq)->variable.original_iseq);

if (ISEQ_ORIGINAL_ISEQ(iseq)) return ISEQ_ORIGINAL_ISEQ(iseq);
original_code = ISEQ_ORIGINAL_ISEQ_ALLOC(iseq, ISEQ_BODY(iseq)->iseq_size);
if (original_code) return original_code;
original_code = ALLOC_N(VALUE, ISEQ_BODY(iseq)->iseq_size);
MEMCPY(original_code, ISEQ_BODY(iseq)->iseq_encoded, VALUE, ISEQ_BODY(iseq)->iseq_size);

#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
Expand All @@ -1022,6 +1022,15 @@ rb_iseq_original_iseq(const rb_iseq_t *iseq) /* cold path */
}
}
#endif

/* Concurrent callers can each build a copy; publish only fully
* translated code and keep the first one. */
VALUE *prev = ATOMIC_PTR_CAS(ISEQ_BODY(iseq)->variable.original_iseq,
NULL, original_code);
if (prev) {
SIZED_FREE_N(original_code, ISEQ_BODY(iseq)->iseq_size);
return prev;
}
return original_code;
}

Expand Down
6 changes: 0 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3149,7 +3149,6 @@ STATIC=
], [
AS_CASE(["$target_os"],
[solaris*|irix*], [CCDLFLAGS="$CCDLFLAGS -KPIC"],
[sunos*], [CCDLFLAGS="$CCDLFLAGS -PIC"],
[esix*|uxpds*], [CCDLFLAGS="$CCDLFLAGS -KPIC"],
[: ${CCDLFLAGS=""}])
])
Expand Down Expand Up @@ -3190,8 +3189,6 @@ AC_SUBST(EXTOBJS)
: ${PRELOADENV=LD_PRELOAD_32}
])
rb_cv_dlopen=yes],
[sunos*], [ : ${LDSHARED='$(LD) -assert nodefinitions'}
rb_cv_dlopen=yes],
[irix*], [ : ${LDSHARED='$(LD) -shared'}
rb_cv_dlopen=yes],
[sysv4*], [ : ${LDSHARED='$(LD) -G'}
Expand Down Expand Up @@ -3662,9 +3659,6 @@ AS_CASE("$enable_shared", [yes], [
relative_libprefix="/../${multiarch+../}${libdir_basename}"
AS_CASE(["$target_os"],
[sunos4*], [
LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)'
],
[linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | haiku*], [
RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ['-Wl,-soname,$(LIBRUBY_SONAME)' "$LDFLAGS_OPTDIR"])
LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)'
Expand Down
7 changes: 0 additions & 7 deletions iseq.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ ISEQ_ORIGINAL_ISEQ_CLEAR(const rb_iseq_t *iseq)
}
}

static inline VALUE *
ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)
{
return ISEQ_BODY(iseq)->variable.original_iseq =
ALLOC_N(VALUE, size);
}

#define ISEQ_TRACE_EVENTS (RUBY_EVENT_LINE | \
RUBY_EVENT_CLASS | \
RUBY_EVENT_END | \
Expand Down
14 changes: 14 additions & 0 deletions test/ruby/test_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,20 @@ def test_subclasses
end
end

def test_subclasses_includes_clone
c = Class.new
with_include = Class.new(c) { include Module.new }
with_prepend = Class.new(c) { prepend Module.new }
plain = Class.new(c)

bug22190 = '[ruby-core:126038] [Bug #22190]'
clones = [with_include, with_prepend, plain].flat_map {|k| [k.clone, k.dup]}
subclasses = c.subclasses
clones.each do |k|
assert_equal(1, subclasses.count(k), "#{bug22190} expected #{k.inspect} to appear in subclasses exactly once")
end
end

def test_attached_object
c = Class.new
sc = c.singleton_class
Expand Down