Skip to content
  • Yuta Saito's avatar
    7f2c5482
    Initialize Objective-C classes before fork() for macOS 13 · 7f2c5482
    Yuta Saito authored
    Since macOS 13, CFString family API used in
    `rb_str_append_normalized_ospath` may internally use Objective-C classes
    (`NSTaggedPointerString` and `NSPlaceholderMutableString`) for small strings.
    
    On the other hand, Objective-C classes should not be used for the first
    time in a `fork()`'ed but not `exec()`'ed process. Violations for this rule
    can result deadlock during class initialization, so Objective-C runtime
    conservatively crashes on such cases by default.
    
    Therefore, we need to use CFString API to initialize Objective-C classes
    used internally *before* `fork()`.
    
    For more details, see https://bugs.ruby-lang.org/issues/18912
    7f2c5482
    Initialize Objective-C classes before fork() for macOS 13
    Yuta Saito authored
    Since macOS 13, CFString family API used in
    `rb_str_append_normalized_ospath` may internally use Objective-C classes
    (`NSTaggedPointerString` and `NSPlaceholderMutableString`) for small strings.
    
    On the other hand, Objective-C classes should not be used for the first
    time in a `fork()`'ed but not `exec()`'ed process. Violations for this rule
    can result deadlock during class initialization, so Objective-C runtime
    conservatively crashes on such cases by default.
    
    Therefore, we need to use CFString API to initialize Objective-C classes
    used internally *before* `fork()`.
    
    For more details, see https://bugs.ruby-lang.org/issues/18912
Loading