From cd481d5ef416a00d1be8750f8071c7e3752276dc Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <84116207+electron-roller[bot]@users.noreply.github.com> Date: Wed, 11 Jan 2023 11:33:48 +0100 Subject: [PATCH] chore: bump node to v18.13.0 (main) (#36818) * chore: bump node in DEPS to v18.13.0 * child_process: validate arguments for null bytes https://github.com/nodejs/node/pull/44782 * bootstrap: merge main thread and worker thread initializations https://github.com/nodejs/node/pull/44869 * module: ensure relative requires work from deleted directories https://github.com/nodejs/node/pull/42384 * src: add support for externally shared js builtins https://github.com/nodejs/node/issues/44000 * lib: disambiguate `native module` to `binding` https://github.com/nodejs/node/pull/45673 * test: convert test-debugger-pid to async/await https://github.com/nodejs/node/pull/45179 * deps: upgrade to libuv 1.44.2 https://github.com/nodejs/node/pull/42340 * src: fix cppgc incompatibility in v8 https://github.com/nodejs/node/pull/43521 * src: use qualified `std::move` call in node_http2 https://github.com/nodejs/node/pull/45555 * build: fix env.h for cpp20 https://github.com/nodejs/node/pull/45516 * test: remove experimental-wasm-threads flag https://github.com/nodejs/node/pull/45074 * src: iwyu in cleanup_queue.cc https://github.com/nodejs/node/pull/44983 * src: add missing include for `std::all_of` https://github.com/nodejs/node/pull/45541 * deps: update ICU to 72.1 https://github.com/nodejs/node/pull/45068 * chore: fixup patch indices * chore: remove errant semicolons - https://github.com/nodejs/node/pull/44179 - https://github.com/nodejs/node/pull/44193 * src: add support for externally shared js builtins https://github.com/nodejs/node/pull/44376 * chore: add missing GN filenames * deps: update nghttp2 to 1.51.0 https://github.com/nodejs/node/pull/45537 * chore: disable more Node.js snapshot tests The Snapshot feature is currently disabled * chore: disable ICU timezone tests Node.js uses a different version of ICU than Electron so they will often be out of sync. * chore: disable threadpool event tracing test Event tracing is not enabled in embedded Node.js * chore: fixup patch indices * chore: comments from review Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- DEPS | 2 +- patches/node/.patches | 21 +- ...ol_codegenerationfromstringscallback.patch | 8 +- ..._pass_oomdetails_to_oomerrorcallback.patch | 2 +- patches/node/be_compatible_with_cppgc.patch | 96 -- patches/node/build_add_gn_build_files.patch | 38 +- ...compilation_fails_if_not_using_a_new.patch | 10 +- ...pression_sandbox_is_enabled_on_64bit.patch | 8 +- ...f_original-fs_and_custom_embedder_js.patch | 12 +- ...t_to_context_aware_module_prevention.patch | 2 +- .../chore_add_missing_algorithm_include.patch | 20 - ...de_entrypoint_to_be_a_builtin_module.patch | 8 +- .../node/chore_remove_errant_semicolons.patch | 36 + .../node/chore_remove_unreached_return.patch | 22 + ...imum_supported_version_to_10_15_3406.patch | 25 - ...est_move_constructor_for_c_20_compat.patch | 37 - .../enable_-wunqualified-std-cast-call.patch | 21 - ...enable_crashpad_linux_node_processes.patch | 10 +- .../expose_get_builtin_module_function.patch | 2 +- ...nalhandler_to_environment_to_prevent.patch | 16 +- ...o_change_option_to_uv_loop_configure.patch | 223 ++--- .../node/feat_initialize_asar_support.patch | 35 +- ...nt_for_debugger_agent_race_condition.patch | 22 +- ..._values_for_variables_in_common_gypi.patch | 2 +- .../fix_crypto_tests_to_run_with_bssl.patch | 26 +- ...ose_lookupandcompile_with_parameters.patch | 8 +- ...n_electron_module_via_the_esm_loader.patch | 12 +- ...se_tracing_tracingcontroller_instead.patch | 8 +- ...ingssl_and_openssl_incompatibilities.patch | 32 +- ..._override_createjob_in_node_platform.patch | 4 +- ...g_functiontemplateinfo_after_publish.patch | 4 +- ...g_-wdeprecated-declarations_in_libuv.patch | 4 +- .../fix_tolocalstring_unicode_mismatch.patch | 27 - ...declaration_shadows_a_local_variable.patch | 2 +- ...acos_avoid_posix_spawnp_cwd_bug_3597.patch | 111 --- ..._don_t_use_thread-unsafe_strtok_3524.patch | 54 -- .../pass_all_globals_through_require.patch | 8 +- ...handle_kevent_note_exit_failure_3451.patch | 70 -- ...rocess_fix_hang_after_note_exit_3521.patch | 158 ---- ...or_for_exit_with_kqueue_on_bsds_3441.patch | 170 ---- ..._dupfd_cloexec_if_it_is_defined_3512.patch | 54 -- ...e_signal_mask_if_the_fork_fails_3537.patch | 36 - ...ess_simplify_uv_write_int_calls_3519.patch | 63 -- ...dder_overriding_of_internal_fs_calls.patch | 14 +- ...cess_fork_to_use_execute_script_with.patch | 6 +- ...use_posix_spawn_instead_of_fork_3257.patch | 889 ------------------ ...rash_when_sharedarraybuffer_disabled.patch | 4 +- .../node/src_iwyu_in_cleanup_queue_cc.patch | 17 - .../node/support_v8_sandboxed_pointers.patch | 20 +- ...emove_experimental-wasm-threads_flag.patch | 27 - .../unix_remove_uv_cloexec_ioctl_3515.patch | 91 -- .../unix_simplify_uv_cloexec_fcntl_3492.patch | 36 - .../node/v8_api_advance_api_deprecation.patch | 4 +- script/node-disabled-tests.json | 4 + 54 files changed, 330 insertions(+), 2311 deletions(-) delete mode 100644 patches/node/be_compatible_with_cppgc.patch delete mode 100644 patches/node/chore_add_missing_algorithm_include.patch create mode 100644 patches/node/chore_remove_errant_semicolons.patch create mode 100644 patches/node/chore_remove_unreached_return.patch delete mode 100644 patches/node/darwin_bump_minimum_supported_version_to_10_15_3406.patch delete mode 100644 patches/node/drop_deserializerequest_move_constructor_for_c_20_compat.patch delete mode 100644 patches/node/enable_-wunqualified-std-cast-call.patch delete mode 100644 patches/node/fix_tolocalstring_unicode_mismatch.patch delete mode 100644 patches/node/macos_avoid_posix_spawnp_cwd_bug_3597.patch delete mode 100644 patches/node/macos_don_t_use_thread-unsafe_strtok_3524.patch delete mode 100644 patches/node/process_bsd_handle_kevent_note_exit_failure_3451.patch delete mode 100644 patches/node/process_fix_hang_after_note_exit_3521.patch delete mode 100644 patches/node/process_monitor_for_exit_with_kqueue_on_bsds_3441.patch delete mode 100644 patches/node/process_only_use_f_dupfd_cloexec_if_it_is_defined_3512.patch delete mode 100644 patches/node/process_reset_the_signal_mask_if_the_fork_fails_3537.patch delete mode 100644 patches/node/process_simplify_uv_write_int_calls_3519.patch delete mode 100644 patches/node/reland_macos_use_posix_spawn_instead_of_fork_3257.patch delete mode 100644 patches/node/src_iwyu_in_cleanup_queue_cc.patch delete mode 100644 patches/node/test_remove_experimental-wasm-threads_flag.patch delete mode 100644 patches/node/unix_remove_uv_cloexec_ioctl_3515.patch delete mode 100644 patches/node/unix_simplify_uv_cloexec_fcntl_3492.patch diff --git a/DEPS b/DEPS index db0aece8182d6..b2d5def1b9350 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '111.0.5518.0', 'node_version': - 'v18.12.1', + 'v18.13.0', 'nan_version': '16fa32231e2ccd89d2804b3f765319128b20c4ac', 'squirrel.mac_version': diff --git a/patches/node/.patches b/patches/node/.patches index b435ebacc05d0..551258b7a27b2 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -16,40 +16,23 @@ repl_fix_crash_when_sharedarraybuffer_disabled.patch fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch fix_serdes_test.patch -darwin_bump_minimum_supported_version_to_10_15_3406.patch -be_compatible_with_cppgc.patch feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch -process_monitor_for_exit_with_kqueue_on_bsds_3441.patch -process_bsd_handle_kevent_note_exit_failure_3451.patch -reland_macos_use_posix_spawn_instead_of_fork_3257.patch -process_reset_the_signal_mask_if_the_fork_fails_3537.patch -process_only_use_f_dupfd_cloexec_if_it_is_defined_3512.patch -unix_simplify_uv_cloexec_fcntl_3492.patch -unix_remove_uv_cloexec_ioctl_3515.patch -process_simplify_uv_write_int_calls_3519.patch -macos_don_t_use_thread-unsafe_strtok_3524.patch -process_fix_hang_after_note_exit_3521.patch feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch -macos_avoid_posix_spawnp_cwd_bug_3597.patch json_parse_errors_made_user-friendly.patch support_v8_sandboxed_pointers.patch build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch build_ensure_native_module_compilation_fails_if_not_using_a_new.patch fix_override_createjob_in_node_platform.patch v8_api_advance_api_deprecation.patch -enable_-wunqualified-std-cast-call.patch fixup_for_error_declaration_shadows_a_local_variable.patch fixup_for_wc_98-compat-extra-semi.patch -drop_deserializerequest_move_constructor_for_c_20_compat.patch fix_parallel_test-v8-stats.patch fix_expose_the_built-in_electron_module_via_the_esm_loader.patch heap_remove_allocationspace_map_space_enum_constant.patch -test_remove_experimental-wasm-threads_flag.patch api_pass_oomdetails_to_oomerrorcallback.patch -src_iwyu_in_cleanup_queue_cc.patch fix_expose_lookupandcompile_with_parameters.patch fix_prevent_changing_functiontemplateinfo_after_publish.patch -chore_add_missing_algorithm_include.patch -fix_tolocalstring_unicode_mismatch.patch enable_crashpad_linux_node_processes.patch allow_embedder_to_control_codegenerationfromstringscallback.patch +chore_remove_errant_semicolons.patch +chore_remove_unreached_return.patch diff --git a/patches/node/allow_embedder_to_control_codegenerationfromstringscallback.patch b/patches/node/allow_embedder_to_control_codegenerationfromstringscallback.patch index 6e3bc16f5cfb6..298304ebdd758 100644 --- a/patches/node/allow_embedder_to_control_codegenerationfromstringscallback.patch +++ b/patches/node/allow_embedder_to_control_codegenerationfromstringscallback.patch @@ -8,10 +8,10 @@ This is needed to blend Blink and Node's code generation policy. This should be upstreamed. diff --git a/src/api/environment.cc b/src/api/environment.cc -index b6981c37d5b286e22f24d11751eb05f72ca27619..c4a3a54753767e7686a0e32996bcda0c90f659a7 100644 +index c0c422e969543dcd570dabfd8ff0755abe37face..4f14b308d14f3653c8646345a5b375014a51851f 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -259,11 +259,15 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) { +@@ -267,11 +267,15 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) { void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) { isolate->SetMicrotasksPolicy(s.policy); @@ -30,10 +30,10 @@ index b6981c37d5b286e22f24d11751eb05f72ca27619..c4a3a54753767e7686a0e32996bcda0c Mutex::ScopedLock lock(node::per_process::cli_options_mutex); if (per_process::cli_options->get_per_isolate_options() diff --git a/src/node.h b/src/node.h -index bee494f9da8470530ee9ec58958f8f2c7ce6a302..387ce8e5edf6524db170e2d46ef501a1cd956d98 100644 +index 6ff7527d4fe4d126bda80615ffed75f77f700b86..5a849f047feca5d4d101c21c125e1c0500150077 100644 --- a/src/node.h +++ b/src/node.h -@@ -461,6 +461,8 @@ struct IsolateSettings { +@@ -463,6 +463,8 @@ struct IsolateSettings { v8::PromiseRejectCallback promise_reject_callback = nullptr; v8::AllowWasmCodeGenerationCallback allow_wasm_code_generation_callback = nullptr; diff --git a/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch b/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch index 32823a778655a..2100edb836db7 100644 --- a/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch +++ b/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch @@ -25,7 +25,7 @@ index 323fc7d4ff635ca287ee241cee234da0600340a2..36ab78f739f3faecab47eead99f9aa3c if (location) { FPrintF(stderr, "FATAL ERROR: %s %s\n", location, message); diff --git a/src/node_errors.h b/src/node_errors.h -index 5587c2348626102febe33a20ff45748a6eec61ad..6dbba32858dc82bc04171da7ee2a33a0b4dee791 100644 +index 926f54286ec72fda98a9a477ac8e22feef522291..f926cc1c70dd6f883c0729c46f09e10972ce6385 100644 --- a/src/node_errors.h +++ b/src/node_errors.h @@ -21,7 +21,7 @@ void AppendExceptionLine(Environment* env, diff --git a/patches/node/be_compatible_with_cppgc.patch b/patches/node/be_compatible_with_cppgc.patch deleted file mode 100644 index 41865ab290ea5..0000000000000 --- a/patches/node/be_compatible_with_cppgc.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jeremy Rose -Date: Fri, 11 Mar 2022 11:17:29 -0800 -Subject: be compatible with cppgc - -This fixes a crash that happens sporadically when Node is used in the same V8 -Isolate as Blink. For example: - -# -# Fatal error in ../../v8/src/objects/js-objects-inl.h, line 306 -# Debug check failed: static_cast(index) < static_cast(GetEmbedderFieldCount()) (1 vs. 1). -# -# -# -#FailureMessage Object: 0x7ffee46fd1c0 -0 Electron Framework 0x00000001181c78d9 base::debug::CollectStackTrace(void**, unsigned long) + 9 -1 Electron Framework 0x00000001180ea633 base::debug::StackTrace::StackTrace() + 19 -2 Electron Framework 0x000000011a04decd gin::(anonymous namespace)::PrintStackTrace() + 45 -3 Electron Framework 0x0000000119a9b416 V8_Fatal(char const*, int, char const*, ...) + 326 -4 Electron Framework 0x0000000119a9aeb5 v8::base::(anonymous namespace)::DefaultDcheckHandler(char const*, int, char const*) + 21 -5 Electron Framework 0x000000011530763f v8::internal::JSObject::GetEmbedderFieldOffset(int) + 207 -6 Electron Framework 0x00000001155f68e6 v8::internal::LocalEmbedderHeapTracer::EmbedderWriteBarrier(v8::internal::Heap*, v8::internal::JSObject) + 150 -7 Electron Framework 0x00000001152cd34f v8::Object::SetAlignedPointerInInternalField(int, void*) + 639 -8 Electron Framework 0x000000011d18df35 node::BaseObject::BaseObject(node::Environment*, v8::Local) + 101 -9 Electron Framework 0x000000011d347b6e node::crypto::DiffieHellman::DiffieHellman(node::Environment*, v8::Local) + 14 -10 Electron Framework 0x000000011d348413 node::crypto::DiffieHellman::New(v8::FunctionCallbackInfo const&) + 147 -[...] - -This crash happens because this V8 isolate has cppgc enabled. When cppgc is -enabled, V8 assumes that the first embedder field is a "type" pointer, the -first 16 bits of which are the embedder ID. Node did not adhere to this -requirement. Sometimes--mostly, even--this worked _by accident_. If the first -field in the BaseObject was a pointer to a bit of memory that happened to -contain the two-byte little-endian value 0x0001, however, V8 would take that to -mean that the object was a Blink object[1], and attempt to read the pointer in -the second embedder slot, which would result in a CHECK. - -This change adds an "embedder id" pointer as the first embedder field in all -Node-managed objects. This ensures that cppgc will always skip over Node -objects. - -This patch should be upstreamed to Node. - -[1]: https://source.chromium.org/chromium/chromium/src/+/main:gin/public/gin_embedders.h;l=20;drc=5a758a97032f0b656c3c36a3497560762495501a - -See also: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/v8-cppgc.h;l=70-76;drc=5a758a97032f0b656c3c36a3497560762495501a - -diff --git a/src/base_object.h b/src/base_object.h -index 74af3c952748661c2106be9082dd8cf0f9d3b09a..3a48235fc310d7487fd8f371a4bb791d00872d39 100644 ---- a/src/base_object.h -+++ b/src/base_object.h -@@ -40,7 +40,7 @@ class TransferData; - - class BaseObject : public MemoryRetainer { - public: -- enum InternalFields { kSlot, kInternalFieldCount }; -+ enum InternalFields { kWrapperType, kSlot, kInternalFieldCount }; - - // Associates this object with `object`. It uses the 0th internal field for - // that, and in particular aborts if there is no such field. -diff --git a/src/env.cc b/src/env.cc -index 24aeb329c593bfd5a35877d6f4e2b7afa9848306..de41e5b7f6ff9f818c661484a93b74db7569e31f 100644 ---- a/src/env.cc -+++ b/src/env.cc -@@ -2013,11 +2013,20 @@ void Environment::RunWeakRefCleanup() { - isolate()->ClearKeptObjects(); - } - -+// This just has to be different from the Chromium ones: -+// https://source.chromium.org/chromium/chromium/src/+/main:gin/public/gin_embedders.h;l=18-23;drc=5a758a97032f0b656c3c36a3497560762495501a -+// Otherwise, when Node is loaded in an isolate which uses cppgc, cppgc will -+// misinterpret the data stored in the embedder fields and try to garbage -+// collect them. -+uint16_t kNodeEmbedderId = 0x90de; -+ - // Not really any better place than env.cc at this moment. - BaseObject::BaseObject(Environment* env, Local object) - : persistent_handle_(env->isolate(), object), env_(env) { - CHECK_EQ(false, object.IsEmpty()); -- CHECK_GT(object->InternalFieldCount(), 0); -+ CHECK_GT(object->InternalFieldCount(), BaseObject::kSlot); -+ object->SetAlignedPointerInInternalField(BaseObject::kWrapperType, -+ &kNodeEmbedderId); - object->SetAlignedPointerInInternalField(BaseObject::kSlot, - static_cast(this)); - env->AddCleanupHook(DeleteMe, static_cast(this)); -@@ -2071,7 +2080,8 @@ void BaseObject::MakeWeak() { - void BaseObject::LazilyInitializedJSTemplateConstructor( - const FunctionCallbackInfo& args) { - DCHECK(args.IsConstructCall()); -- DCHECK_GT(args.This()->InternalFieldCount(), 0); -+ DCHECK_GT(args.This()->InternalFieldCount(), BaseObject::kSlot); -+ args.This()->SetAlignedPointerInInternalField(BaseObject::kWrapperType, &kNodeEmbedderId); - args.This()->SetAlignedPointerInInternalField(BaseObject::kSlot, nullptr); - } - diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index ac7432b31ab80..4090765acd893 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -893,10 +893,10 @@ index 0000000000000000000000000000000000000000..fb000f8ee7647c375bc190d1729d67bb +} diff --git a/deps/nghttp2/BUILD.gn b/deps/nghttp2/BUILD.gn new file mode 100644 -index 0000000000000000000000000000000000000000..9abde472d88923db835b12982b7f2ccb1f260196 +index 0000000000000000000000000000000000000000..23eed033d31eced6a85c794eee550655af7a9a1d --- /dev/null +++ b/deps/nghttp2/BUILD.gn -@@ -0,0 +1,47 @@ +@@ -0,0 +1,48 @@ +config("nghttp2_config") { + defines = [ "NGHTTP2_STATICLIB" ] + include_dirs = [ "lib/includes" ] @@ -923,6 +923,7 @@ index 0000000000000000000000000000000000000000..9abde472d88923db835b12982b7f2ccb + "lib/nghttp2_buf.c", + "lib/nghttp2_callbacks.c", + "lib/nghttp2_debug.c", ++ "lib/nghttp2_extpri.c", + "lib/nghttp2_frame.c", + "lib/nghttp2_hd.c", + "lib/nghttp2_hd_huffman.c", @@ -1192,10 +1193,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636 +} diff --git a/filenames.json b/filenames.json new file mode 100644 -index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9b477239e +index 0000000000000000000000000000000000000000..a991bef2b98766a1cfb248d2af97101af305de82 --- /dev/null +++ b/filenames.json -@@ -0,0 +1,638 @@ +@@ -0,0 +1,653 @@ +// This file is automatically generated by generate_gn_filenames_json.py +// DO NOT EDIT +{ @@ -1301,7 +1302,6 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "dest_dir": "include/node//uv/", + "files": [ + "deps/uv/include/uv/aix.h", -+ "deps/uv/include/uv/android-ifaddrs.h", + "deps/uv/include/uv/bsd.h", + "deps/uv/include/uv/darwin.h", + "deps/uv/include/uv/errno.h", @@ -1414,6 +1414,7 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "lib/internal/error_serdes.js", + "lib/internal/errors.js", + "lib/internal/event_target.js", ++ "lib/internal/file.js", + "lib/internal/fixed_queue.js", + "lib/internal/freelist.js", + "lib/internal/freeze_intrinsics.js", @@ -1422,6 +1423,7 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "lib/internal/fs/dir.js", + "lib/internal/fs/promises.js", + "lib/internal/fs/read_file_context.js", ++ "lib/internal/fs/recursive_watch.js", + "lib/internal/fs/rimraf.js", + "lib/internal/fs/streams.js", + "lib/internal/fs/sync_write_stream.js", @@ -1451,6 +1453,7 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "lib/internal/main/test_runner.js", + "lib/internal/main/watch_mode.js", + "lib/internal/main/worker_thread.js", ++ "lib/internal/mime.js", + "lib/internal/modules/cjs/helpers.js", + "lib/internal/modules/cjs/loader.js", + "lib/internal/modules/esm/assert.js", @@ -1537,7 +1540,11 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "lib/internal/test/binding.js", + "lib/internal/test/transfer.js", + "lib/internal/test_runner/harness.js", ++ "lib/internal/test_runner/mock.js", + "lib/internal/test_runner/runner.js", ++ "lib/internal/test_runner/tap_checker.js", ++ "lib/internal/test_runner/tap_lexer.js", ++ "lib/internal/test_runner/tap_parser.js", + "lib/internal/test_runner/tap_stream.js", + "lib/internal/test_runner/test.js", + "lib/internal/test_runner/utils.js", @@ -1561,6 +1568,7 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "lib/internal/v8_prof_polyfill.js", + "lib/internal/v8_prof_processor.js", + "lib/internal/validators.js", ++ "lib/internal/vm.js", + "lib/internal/vm/module.js", + "lib/internal/wasm_web_api.js", + "lib/internal/watch_mode/files_watcher.js", @@ -1637,6 +1645,7 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "src/api/hooks.cc", + "src/api/utils.cc", + "src/async_wrap.cc", ++ "src/base_object.cc", + "src/cares_wrap.cc", + "src/cleanup_queue.cc", + "src/connect_wrap.cc", @@ -1685,10 +1694,12 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "src/node_process_events.cc", + "src/node_process_methods.cc", + "src/node_process_object.cc", ++ "src/node_realm.cc", + "src/node_report.cc", + "src/node_report_module.cc", + "src/node_report_utils.cc", + "src/node_serdes.cc", ++ "src/node_shadow_realm.cc", + "src/node_snapshotable.cc", + "src/node_sockaddr.cc", + "src/node_stat_watcher.cc", @@ -1743,6 +1754,7 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "src/connection_wrap.h", + "src/debug_utils.h", + "src/debug_utils-inl.h", ++ "src/env_properties.h", + "src/env.h", + "src/env-inl.h", + "src/handle_wrap.h", @@ -1790,9 +1802,12 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "src/node_platform.h", + "src/node_process.h", + "src/node_process-inl.h", ++ "src/node_realm.h", ++ "src/node_realm-inl.h", + "src/node_report.h", + "src/node_revert.h", + "src/node_root_certs.h", ++ "src/node_shadow_realm.h", + "src/node_snapshotable.h", + "src/node_snapshot_builder.h", + "src/node_sockaddr.h", @@ -1800,6 +1815,7 @@ index 0000000000000000000000000000000000000000..b445ccdd7ba2f0b5661d4761f995a4c9 + "src/node_stat_watcher.h", + "src/node_union_bytes.h", + "src/node_url.h", ++ "src/node_util.h", + "src/node_version.h", + "src/node_v8.h", + "src/node_v8_platform-inl.h", @@ -2075,7 +2091,7 @@ index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb30483 + args = rebase_path(inputs + outputs, root_build_dir) +} diff --git a/src/node_version.h b/src/node_version.h -index 68c7df653ebb84d9e0c5d34a1cfa4fa3bd4ce690..2762b9f8ae782518ecc9c21f09880c10025155aa 100644 +index d6b2f18cf8599ed7994954c808379565b740ac83..cd73f646bb3e9dbc4d9f4a3f24ef5970ec33b3a5 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -89,7 +89,10 @@ @@ -2091,10 +2107,10 @@ index 68c7df653ebb84d9e0c5d34a1cfa4fa3bd4ce690..2762b9f8ae782518ecc9c21f09880c10 // which the Node binary being built supports. diff --git a/tools/generate_gn_filenames_json.py b/tools/generate_gn_filenames_json.py new file mode 100755 -index 0000000000000000000000000000000000000000..87621ba1d7f1c80aadb81461824b0c2edab1de22 +index 0000000000000000000000000000000000000000..616dc0c61ed4ea1bf2fb9e4768ba2ec566a83e42 --- /dev/null +++ b/tools/generate_gn_filenames_json.py -@@ -0,0 +1,75 @@ +@@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +import json +import os @@ -2143,6 +2159,12 @@ index 0000000000000000000000000000000000000000..87621ba1d7f1c80aadb81461824b0c2e + def filter_v8_files(files): + if any(f.startswith('deps/v8/') for f in files): + files = [f.replace('deps/v8/', '//v8/', 1) for f in files] ++ ++ if any(f == '<@(node_builtin_shareable_builtins)' for f in files): ++ files.remove('<@(node_builtin_shareable_builtins)') ++ shared_builtins = ['deps/cjs-module-lexer/lexer.js', 'deps/cjs-module-lexer/dist/lexer.js', 'deps/undici/undici.js'] ++ files.extend(shared_builtins) ++ + return files + + lib_files = SearchFiles('lib', 'js') diff --git a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch index 9329a6428538e..81bdaa64dc71f 100644 --- a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch +++ b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch @@ -7,7 +7,7 @@ Subject: build: ensure native module compilation fails if not using a new This should not be upstreamed, it is a quality-of-life patch for downstream module builders. diff --git a/common.gypi b/common.gypi -index 3e73073fb3f0e3bed74ff00521fc1b98997d9540..ca089eee5eafef6e08960d2a96ef27d8cfa95180 100644 +index 6704d96142f806be9c0605f0b41206e77f492b96..f1404d27e14ce7143d3b2dbccde7af8269369cbf 100644 --- a/common.gypi +++ b/common.gypi @@ -79,6 +79,8 @@ @@ -27,7 +27,7 @@ index 3e73073fb3f0e3bed74ff00521fc1b98997d9540..ca089eee5eafef6e08960d2a96ef27d8 ], # Forcibly disable -Werror. We support a wide range of compilers, it's -@@ -392,6 +395,11 @@ +@@ -388,6 +391,11 @@ }], ], }], @@ -40,10 +40,10 @@ index 3e73073fb3f0e3bed74ff00521fc1b98997d9540..ca089eee5eafef6e08960d2a96ef27d8 'defines': [ 'V8_COMPRESS_POINTERS', diff --git a/configure.py b/configure.py -index 1b7a721585764aecfd855ee47c47a3bd235d2ef3..c152ea9f29478729ec3752132140e3ec44dbd366 100755 +index bae674fd264ff0bfbe025c286279182358872b23..1f3c398c034d2c0bf0eca51b892ca87c3fcf7ce1 100755 --- a/configure.py +++ b/configure.py -@@ -1464,6 +1464,7 @@ def configure_library(lib, output, pkgname=None): +@@ -1511,6 +1511,7 @@ def configure_library(lib, output, pkgname=None): def configure_v8(o): @@ -52,7 +52,7 @@ index 1b7a721585764aecfd855ee47c47a3bd235d2ef3..c152ea9f29478729ec3752132140e3ec o['variables']['v8_enable_javascript_promise_hooks'] = 1 o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0 diff --git a/src/node.h b/src/node.h -index 10061d4298368bc0ad53c0c8c3a3c964c13d4c3c..bee494f9da8470530ee9ec58958f8f2c7ce6a302 100644 +index 173e0bc669a2fd90e764da72e09003f4c7311fd7..6ff7527d4fe4d126bda80615ffed75f77f700b86 100644 --- a/src/node.h +++ b/src/node.h @@ -22,6 +22,12 @@ diff --git a/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch b/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch index b108f9a447e62..79f0898ef3970 100644 --- a/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch +++ b/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch @@ -8,7 +8,7 @@ Aligns common.gypi with the current build flag state of //v8. Specifically enables `V8_ENABLE_SANDBOX`, `V8_SANDBOXED_POINTERS`, `V8_COMPRESS_POINTERS` and `V8_COMPRESS_POINTERS_IN_SHARED_CAGE`. diff --git a/common.gypi b/common.gypi -index e58cc4b4fb4ba28f23133530dc3d908c4cb68426..3e73073fb3f0e3bed74ff00521fc1b98997d9540 100644 +index cbbc7264c6ad097c5da4902ac1bdbdcebfdd36af..6704d96142f806be9c0605f0b41206e77f492b96 100644 --- a/common.gypi +++ b/common.gypi @@ -65,6 +65,7 @@ @@ -27,7 +27,7 @@ index e58cc4b4fb4ba28f23133530dc3d908c4cb68426..3e73073fb3f0e3bed74ff00521fc1b98 }], ['target_arch in "ppc64 s390x"', { 'v8_enable_backtrace': 1, -@@ -393,9 +395,12 @@ +@@ -389,9 +391,12 @@ ['v8_enable_pointer_compression == 1', { 'defines': [ 'V8_COMPRESS_POINTERS', @@ -42,10 +42,10 @@ index e58cc4b4fb4ba28f23133530dc3d908c4cb68426..3e73073fb3f0e3bed74ff00521fc1b98 'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'], }], diff --git a/configure.py b/configure.py -index a4e5723067f286d4a836f329d0049b6bbaac9419..1b7a721585764aecfd855ee47c47a3bd235d2ef3 100755 +index 81d54a14b7af51b77b6340a4f7bf605d6f1656bc..bae674fd264ff0bfbe025c286279182358872b23 100755 --- a/configure.py +++ b/configure.py -@@ -1477,6 +1477,7 @@ def configure_v8(o): +@@ -1524,6 +1524,7 @@ def configure_v8(o): o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1 o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0 o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0 diff --git a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch index 74350012467b1..a18c4168ba715 100644 --- a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch +++ b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch @@ -37,7 +37,7 @@ index 7b820e70df1613a9f5565d6221b71354ff059560..405bda5d83c3312909439082ef69e8f2 async function* watch(filename, options = {}) { const path = toNamespacedPath(getValidatedPath(filename)); diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 4a8e5f2d23ecb50b127a20a3d0f6216ae60455fe..3bc9d113b6b818dcda332966f09f17248b421263 100644 +index 9d82a06adcefe386ea230c7cfbdccffb67d0b8c1..6e1a55adbd0b01383f3e54e924864dfeb6a57f0b 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -32,6 +32,7 @@ BuiltinLoader BuiltinLoader::instance_; @@ -45,14 +45,14 @@ index 4a8e5f2d23ecb50b127a20a3d0f6216ae60455fe..3bc9d113b6b818dcda332966f09f1724 BuiltinLoader::BuiltinLoader() : config_(GetConfig()), has_code_cache_(false) { LoadJavaScriptSource(); + LoadEmbedderJavaScriptSource(); - } - - BuiltinLoader* BuiltinLoader::GetInstance() { + #if defined(NODE_HAVE_I18N_SUPPORT) + #ifdef NODE_SHARED_BUILTIN_CJS_MODULE_LEXER_LEXER_PATH + AddExternalizedBuiltin( diff --git a/src/node_builtins.h b/src/node_builtins.h -index fa87a2042c043bb20fedbb83e60cc160c3f9b7e5..7f0a25af306ffefbc51ac43689ed208d4cd94f0b 100644 +index a6fbff98ccb0a7f5fd33cf3b084cfdf47aaa995e..8228e57d27b2f883d87ec12274f2745628caa6e1 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h -@@ -69,6 +69,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { +@@ -73,6 +73,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { // Generated by tools/js2c.py as node_javascript.cc void LoadJavaScriptSource(); // Loads data into source_ diff --git a/patches/node/chore_add_context_to_context_aware_module_prevention.patch b/patches/node/chore_add_context_to_context_aware_module_prevention.patch index d9ea79fee3234..890b3c070670d 100644 --- a/patches/node/chore_add_context_to_context_aware_module_prevention.patch +++ b/patches/node/chore_add_context_to_context_aware_module_prevention.patch @@ -8,7 +8,7 @@ modules from being used in the renderer process. This should be upstreamed as a customizable error message. diff --git a/src/node_binding.cc b/src/node_binding.cc -index 14b447c2245a2154399b89f15aa33288c194d4fc..c52fbc6a72d1842f56f1e37f3725b7ba2284bf29 100644 +index c4e6347f6f302b46fe4569f543335e426cd4ded5..f772e71521c71edd7d40b0489c5fc875357e3790 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -4,6 +4,7 @@ diff --git a/patches/node/chore_add_missing_algorithm_include.patch b/patches/node/chore_add_missing_algorithm_include.patch deleted file mode 100644 index 737ebff808e45..0000000000000 --- a/patches/node/chore_add_missing_algorithm_include.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: John Kleinschmidt -Date: Wed, 16 Nov 2022 16:58:45 -0500 -Subject: chore: add missing include - -https://github.com/nodejs/node/commit/4124b037743abb8f80a9d4b78a3b3f6aa64a18f9 added a call -to std::all_of, but did not add the needed header include. - -diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc -index 8001d893e1fdcc339d8c766c3dd2c5155b36e8cc..c7331567581be1ef884982cd4a166113f9d2fd09 100644 ---- a/src/inspector_socket.cc -+++ b/src/inspector_socket.cc -@@ -6,6 +6,7 @@ - - #include "openssl/sha.h" // Sha-1 hash - -+#include - #include - #include - diff --git a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch index 3dfac5ae7e178..400c681b140e8 100644 --- a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch +++ b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch @@ -8,10 +8,10 @@ they use themselves as the entry point. We should try to upstream some form of this. diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 5ea58cdbf5b1caa41ff3d1c7f4569d112974425f..e1ac301e6af0d185964e277195b7ff207b950bc4 100644 +index 44e4c22ebf39fc9c52f789173a2cc50300bcd181..035de64bf1f0ab46de2b803edeaf0596c8bf68a0 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -1133,6 +1133,13 @@ Module.prototype._compile = function(content, filename) { +@@ -1192,6 +1192,13 @@ Module.prototype._compile = function(content, filename) { if (getOptionValue('--inspect-brk') && process._eval == null) { if (!resolvedArgv) { // We enter the repl if we're not given a filename argument. @@ -26,10 +26,10 @@ index 5ea58cdbf5b1caa41ff3d1c7f4569d112974425f..e1ac301e6af0d185964e277195b7ff20 try { resolvedArgv = Module._resolveFilename(process.argv[1], null, false); diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js -index db8bf724af5f113c7c86350a210d5eee82879d13..6659f03e9aa45c35d355399597f533ad20232575 100644 +index 1c529f062cd3ec79643ae8c946e2ed0faac336fb..c4fe744be1c26c2306e843031192d88f977cd46c 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js -@@ -135,11 +135,13 @@ function patchProcessObject(expandArgv1) { +@@ -157,11 +157,13 @@ function patchProcessObject(expandArgv1) { if (expandArgv1 && process.argv[1] && !StringPrototypeStartsWith(process.argv[1], '-')) { // Expand process.argv[1] into a full path. diff --git a/patches/node/chore_remove_errant_semicolons.patch b/patches/node/chore_remove_errant_semicolons.patch new file mode 100644 index 0000000000000..d7fb2a3f8368c --- /dev/null +++ b/patches/node/chore_remove_errant_semicolons.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Mon, 9 Jan 2023 13:53:36 +0100 +Subject: chore: remove errant semicolons + +- https://github.com/nodejs/node/pull/44179 +- https://github.com/nodejs/node/pull/44193 + +This should be upstreamed. + +diff --git a/src/node_realm.h b/src/node_realm.h +index 9ece8cb38958c364c6177118a5e7443c3a6bdf1a..0d3259a149e94b7d9657959c0ccac25a146978b4 100644 +--- a/src/node_realm.h ++++ b/src/node_realm.h +@@ -55,7 +55,7 @@ class Realm : public MemoryRetainer { + Realm& operator=(Realm&&) = delete; + + SET_MEMORY_INFO_NAME(Realm) +- SET_SELF_SIZE(Realm); ++ SET_SELF_SIZE(Realm) + void MemoryInfo(MemoryTracker* tracker) const override; + + void CreateProperties(); +diff --git a/src/node_util.h b/src/node_util.h +index 616b8c003b2d0dd80e01297ca3fe7e4926220ad7..9590842ae4764dd3363a4d74038d3351f0061177 100644 +--- a/src/node_util.h ++++ b/src/node_util.h +@@ -12,7 +12,7 @@ namespace util { + + class WeakReference : public SnapshotableObject { + public: +- SERIALIZABLE_OBJECT_METHODS(); ++ SERIALIZABLE_OBJECT_METHODS() + + static constexpr FastStringKey type_name{"node::util::WeakReference"}; + static constexpr EmbedderObjectType type_int = diff --git a/patches/node/chore_remove_unreached_return.patch b/patches/node/chore_remove_unreached_return.patch new file mode 100644 index 0000000000000..5cd700e5f8ac2 --- /dev/null +++ b/patches/node/chore_remove_unreached_return.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Mon, 9 Jan 2023 14:34:01 +0100 +Subject: chore: remove unreached return + +https://github.com/nodejs/node/pull/44376 added a return after a call to +ABORT(), triggering an unreachable code error. + +This should be upstreamed. + +diff --git a/src/node_builtins.cc b/src/node_builtins.cc +index 25b02f9904127780c68db9b451a7dfcf02a6fc5e..1be20aea500fd9d606c5a38a86b4aef66b49d133 100644 +--- a/src/node_builtins.cc ++++ b/src/node_builtins.cc +@@ -247,7 +247,6 @@ void BuiltinLoader::AddExternalizedBuiltin(const char* id, + fprintf( + stderr, "Cannot load externalized builtin: \"%s:%s\".\n", id, filename); + ABORT(); +- return; + } + + icu::UnicodeString utf16 = icu::UnicodeString::fromUTF8( diff --git a/patches/node/darwin_bump_minimum_supported_version_to_10_15_3406.patch b/patches/node/darwin_bump_minimum_supported_version_to_10_15_3406.patch deleted file mode 100644 index 555ee607137d1..0000000000000 --- a/patches/node/darwin_bump_minimum_supported_version_to_10_15_3406.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ben Noordhuis -Date: Tue, 8 Feb 2022 14:18:29 +0100 -Subject: darwin: bump minimum supported version to 10.15 (#3406) - -We can't realistically claim to support 10.7 or any version that Apple -no longer supports so let's bump the baseline to something more -realistic. - -Refs: https://github.com/libuv/libuv/pull/482 -Refs: https://github.com/libuv/libuv/pull/3405 - -diff --git a/deps/uv/SUPPORTED_PLATFORMS.md b/deps/uv/SUPPORTED_PLATFORMS.md -index 87e23823ad6424526fdbc2457e535875124b31cb..79509db5b17bb9e7fe245d8a0fd7fa25f8665426 100644 ---- a/deps/uv/SUPPORTED_PLATFORMS.md -+++ b/deps/uv/SUPPORTED_PLATFORMS.md -@@ -3,7 +3,7 @@ - | System | Support type | Supported versions | Notes | - |---|---|---|---| - | GNU/Linux | Tier 1 | Linux >= 2.6.32 with glibc >= 2.12 | | --| macOS | Tier 1 | macOS >= 10.7 | | -+| macOS | Tier 1 | macOS >= 10.15 | Current and previous macOS release | - | Windows | Tier 1 | >= Windows 8 | VS 2015 and later are supported | - | FreeBSD | Tier 1 | >= 10 | | - | AIX | Tier 2 | >= 6 | Maintainers: @libuv/aix | diff --git a/patches/node/drop_deserializerequest_move_constructor_for_c_20_compat.patch b/patches/node/drop_deserializerequest_move_constructor_for_c_20_compat.patch deleted file mode 100644 index 4625280502499..0000000000000 --- a/patches/node/drop_deserializerequest_move_constructor_for_c_20_compat.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jeremy Rose -Date: Mon, 26 Sep 2022 14:44:57 -0700 -Subject: drop DeserializeRequest move constructor for c++20 compat - -C++20 was enabled on mac in -https://chromium-review.googlesource.com/c/chromium/src/+/3914624, which caused -initialization of DeserializeRequest to fail: - -../../third_party/electron_node/src/env.cc:1835:22: error: no matching constructor for initialization of 'DeserializeRequest' - DeserializeRequest request{cb, {isolate(), holder}, index}; - ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -../../third_party/electron_node/src/env.h:944:3: note: candidate constructor not viable: requires single argument 'other', but 3 arguments were provided - DeserializeRequest(DeserializeRequest&& other) = default; - ^ -../../third_party/electron_node/src/env.h:937:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 3 were provided -struct DeserializeRequest { - ^ - -I think (though not 100% sure) that this is because the one explicitly -specified move constructor "shadows" the implicit initializer-list constructor. -This patch seems to fix things, in any case. - -diff --git a/src/env.h b/src/env.h -index 417f0b3657cb068e7708cbeb787f8cb116501876..34c88c1addc5f64bd46332451e5b4ba8343c8818 100644 ---- a/src/env.h -+++ b/src/env.h -@@ -932,9 +932,6 @@ struct DeserializeRequest { - v8::Global holder; - int index; - InternalFieldInfo* info = nullptr; // Owned by the request -- -- // Move constructor -- DeserializeRequest(DeserializeRequest&& other) = default; - }; - - struct EnvSerializeInfo { diff --git a/patches/node/enable_-wunqualified-std-cast-call.patch b/patches/node/enable_-wunqualified-std-cast-call.patch deleted file mode 100644 index 45b3e5daf82b5..0000000000000 --- a/patches/node/enable_-wunqualified-std-cast-call.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: deepak1556 -Date: Fri, 26 Aug 2022 00:10:16 +0900 -Subject: Enable -Wunqualified-std-cast-call - -Refs https://chromium-review.googlesource.com/c/chromium/src/+/3825237 -Should be upstreamed. - -diff --git a/src/node_http2.cc b/src/node_http2.cc -index cb44e3aec2e8e2a0abbf8ce5d7e536787a9e2fb8..61009d8001920454fcc5f3cca080826f6175a092 100644 ---- a/src/node_http2.cc -+++ b/src/node_http2.cc -@@ -644,7 +644,7 @@ void Http2Stream::EmitStatistics() { - duration, - statistics_); - -- env()->SetImmediate([entry = move(entry)](Environment* env) { -+ env()->SetImmediate([entry = std::move(entry)](Environment* env) { - if (HasHttp2Observer(env)) - entry->Notify(env); - }); diff --git a/patches/node/enable_crashpad_linux_node_processes.patch b/patches/node/enable_crashpad_linux_node_processes.patch index 72b77ed517f53..0a5b57bcc91c5 100644 --- a/patches/node/enable_crashpad_linux_node_processes.patch +++ b/patches/node/enable_crashpad_linux_node_processes.patch @@ -8,10 +8,10 @@ to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used by the crashpad client to connect with the handler process. diff --git a/lib/child_process.js b/lib/child_process.js -index 73c1dc769542865bdf7a2a03c16cef141d3f4b05..76151c75ef7ad420d2642c1cd11c8624b7d7e2a0 100644 +index 1bc5f92181a48e1ee37e59220ad11a755b20c9f4..d9d6a39f113151a489a3521ca8512f8ea5b1843c 100644 --- a/lib/child_process.js +++ b/lib/child_process.js -@@ -59,6 +59,7 @@ let debug = require('internal/util/debuglog').debuglog( +@@ -60,6 +60,7 @@ let debug = require('internal/util/debuglog').debuglog( ); const { Buffer } = require('buffer'); const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap'); @@ -19,7 +19,7 @@ index 73c1dc769542865bdf7a2a03c16cef141d3f4b05..76151c75ef7ad420d2642c1cd11c8624 const { AbortError, -@@ -159,7 +160,6 @@ function fork(modulePath, args = [], options) { +@@ -163,7 +164,6 @@ function fork(modulePath, args = [], options) { ArrayPrototypeSplice(execArgv, index - 1, 2); } } @@ -27,7 +27,7 @@ index 73c1dc769542865bdf7a2a03c16cef141d3f4b05..76151c75ef7ad420d2642c1cd11c8624 args = [...execArgv, modulePath, ...args]; if (typeof options.stdio === 'string') { -@@ -613,6 +613,21 @@ function normalizeSpawnArguments(file, args, options) { +@@ -625,6 +625,21 @@ function normalizeSpawnArguments(file, args, options) { 'options.windowsVerbatimArguments'); } @@ -47,5 +47,5 @@ index 73c1dc769542865bdf7a2a03c16cef141d3f4b05..76151c75ef7ad420d2642c1cd11c8624 + } + if (options.shell) { + validateArgumentNullCheck(options.shell, 'options.shell'); const command = ArrayPrototypeJoin([file, ...args], ' '); - // Set the shell, switches, and commands. diff --git a/patches/node/expose_get_builtin_module_function.patch b/patches/node/expose_get_builtin_module_function.patch index 568481ce1b4b3..7ab2e38065d4f 100644 --- a/patches/node/expose_get_builtin_module_function.patch +++ b/patches/node/expose_get_builtin_module_function.patch @@ -9,7 +9,7 @@ modules to sandboxed renderers. TODO(codebytere): remove and replace with a public facing API. diff --git a/src/node_binding.cc b/src/node_binding.cc -index 06af1841eb3d102a6883ae1a8ab69fee4791be6b..14b447c2245a2154399b89f15aa33288c194d4fc 100644 +index a7a325e591eba3daf80bebb11fc3cd83891b627d..c4e6347f6f302b46fe4569f543335e426cd4ded5 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -608,6 +608,10 @@ void GetInternalBinding(const FunctionCallbackInfo& args) { diff --git a/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch b/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch index 8ba8177c148ef..89b71c2a257c9 100644 --- a/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch +++ b/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch @@ -7,10 +7,10 @@ Subject: feat: add kNoStartDebugSignalHandler to Environment to prevent This patch should be upstreamed, it allows embedders to prevent the call to StartDebugSignalHandler which handles SIGUSR1 and starts the inspector agent. Apps that have --inspect disabled also don't want SIGUSR1 to have this affect. diff --git a/src/env-inl.h b/src/env-inl.h -index e38531800e741b40e829d9c14f77557d43fd98f7..5e3d42c53d0e531cdbf947e02f655a844925b6bb 100644 +index fbc4fbb27b065d6a9e3ce7492a21b1eee2f334eb..59bab65f4cd6f0f977a0edc8d33b96d7fc4cdb16 100644 --- a/src/env-inl.h +++ b/src/env-inl.h -@@ -672,6 +672,10 @@ inline bool Environment::no_global_search_paths() const { +@@ -665,6 +665,10 @@ inline bool Environment::no_global_search_paths() const { !options_->global_search_paths; } @@ -22,10 +22,10 @@ index e38531800e741b40e829d9c14f77557d43fd98f7..5e3d42c53d0e531cdbf947e02f655a84 // configure --no-browser-globals #ifdef NODE_NO_BROWSER_GLOBALS diff --git a/src/env.h b/src/env.h -index 59dd7c8d9e172493d79be21079598a08629be128..417f0b3657cb068e7708cbeb787f8cb116501876 100644 +index 4d5e72f9f44762fda4698f0bf62166d1222d1028..0cc91123f4b14439ea4f55814570c323b028ceb3 100644 --- a/src/env.h +++ b/src/env.h -@@ -1233,6 +1233,7 @@ class Environment : public MemoryRetainer { +@@ -765,6 +765,7 @@ class Environment : public MemoryRetainer { inline bool tracks_unmanaged_fds() const; inline bool hide_console_windows() const; inline bool no_global_search_paths() const; @@ -34,10 +34,10 @@ index 59dd7c8d9e172493d79be21079598a08629be128..417f0b3657cb068e7708cbeb787f8cb1 inline uint64_t thread_id() const; inline worker::Worker* worker_context() const; diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc -index 9ee779fb597b423573aa0d932c151289721087c4..14311237384c023ce6759d31c1db7c09eb521ab7 100644 +index 91e7beeaa0976059e6dac239e489d10ada558db4..1abf6801e0544b14dd26f0b96536bd78c5b01679 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc -@@ -693,8 +693,10 @@ bool Agent::Start(const std::string& path, +@@ -692,8 +692,10 @@ bool Agent::Start(const std::string& path, StartIoThreadAsyncCallback)); uv_unref(reinterpret_cast(&start_io_thread_async)); start_io_thread_async.data = this; @@ -51,10 +51,10 @@ index 9ee779fb597b423573aa0d932c151289721087c4..14311237384c023ce6759d31c1db7c09 parent_env_->AddCleanupHook([](void* data) { Environment* env = static_cast(data); diff --git a/src/node.h b/src/node.h -index c3da0c8be37fb0983bd389fc7466ab85a21afbda..10061d4298368bc0ad53c0c8c3a3c964c13d4c3c 100644 +index 9579b04472350fca5b5dbce354d373b50f873972..173e0bc669a2fd90e764da72e09003f4c7311fd7 100644 --- a/src/node.h +++ b/src/node.h -@@ -544,7 +544,11 @@ enum Flags : uint64_t { +@@ -546,7 +546,11 @@ enum Flags : uint64_t { // This control is needed by embedders who may not want to initialize the V8 // inspector in situations where one has already been created, // e.g. Blink's in Chromium. diff --git a/patches/node/feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch b/patches/node/feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch index a568f9f86ab4a..4e4138a150fac 100644 --- a/patches/node/feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch +++ b/patches/node/feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch @@ -26,7 +26,7 @@ index 0f5ddfb3ca21b7e5b38d0a4ce4b9e77387597199..ba815202fb157aa82859ec0518523cf6 .. c:function:: int uv_loop_close(uv_loop_t* loop) diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h -index 606083c87de5790d7e66fc34aeaae9a58acb8ef4..824b0b77cf5f0a46dcb3855c44ac73faaba2055f 100644 +index ee1c94ccd389915ea7572cce044256a7788025ad..d31abf714d5d1433ec8473ccb1aae3b6615c477a 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -252,7 +252,8 @@ typedef struct uv_statfs_s uv_statfs_t; @@ -102,10 +102,10 @@ index e1805c323795e5b0c465d80100eebeb7bf838caa..dd4358c0cdaa97ba8fadf4d975599380 int pipefd[2]; int err; diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c -index 7cd3a2a954ff7d70e6ba7a6f7538648841bc54b2..f89b7158218be60ac10e61484a2d5e5e28a3182f 100644 +index 54c769f37f2331136c87a37c13fb4e3f9a8f22f9..ac52ab79a5fc3050effd2b1f2f605cee9b1ab336 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c -@@ -887,6 +887,9 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) { +@@ -900,6 +900,9 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) { loop->watchers[w->fd] = w; loop->nfds++; } @@ -115,7 +115,7 @@ index 7cd3a2a954ff7d70e6ba7a6f7538648841bc54b2..f89b7158218be60ac10e61484a2d5e5e } -@@ -918,6 +921,9 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) { +@@ -931,6 +934,9 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) { } else if (QUEUE_EMPTY(&w->watcher_queue)) QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue); @@ -125,7 +125,7 @@ index 7cd3a2a954ff7d70e6ba7a6f7538648841bc54b2..f89b7158218be60ac10e61484a2d5e5e } -@@ -934,6 +940,9 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) { +@@ -947,6 +953,9 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) { void uv__io_feed(uv_loop_t* loop, uv__io_t* w) { if (QUEUE_EMPTY(&w->pending_queue)) QUEUE_INSERT_TAIL(&loop->pending_queue, &w->pending_queue); @@ -217,10 +217,10 @@ index 6001b0cf68d0b0268b578218b664a737f43c9521..5d2212571f4bcb648ab332f0c5650d0f while (0) diff --git a/deps/uv/src/win/core.c b/deps/uv/src/win/core.c -index e53a0f8e28637a58ceec7852d1a79874fc1a9548..dd4065c1cc68763bfe258492e3119669311394dc 100644 +index 67af93e6571ed4324d80b6dfb2ff93db7b9cd9b1..e88008b6a288d1508c5c117d814000d63cab81c3 100644 --- a/deps/uv/src/win/core.c +++ b/deps/uv/src/win/core.c -@@ -381,10 +381,20 @@ int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) { +@@ -384,10 +384,20 @@ int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) { return 0; } @@ -242,61 +242,51 @@ index e53a0f8e28637a58ceec7852d1a79874fc1a9548..dd4065c1cc68763bfe258492e3119669 return -1; } diff --git a/deps/uv/test/test-embed.c b/deps/uv/test/test-embed.c -index c6ddceb149d9c1d68b0dd17b6dac0d4c3c3e9dbc..f6572c5dc2b6ef39bd11889ad1f7873007a6437d 100644 +index 1d3355fdc67310feb63738c9e30724f0e77f7895..77a63dbb4d188b2ad571c814dbc6cbc6fe5fa205 100644 --- a/deps/uv/test/test-embed.c +++ b/deps/uv/test/test-embed.c -@@ -25,115 +25,179 @@ +@@ -25,54 +25,184 @@ #include #include --#ifndef HAVE_KQUEUE --# if defined(__APPLE__) || \ -- defined(__DragonFly__) || \ -- defined(__FreeBSD__) || \ -- defined(__FreeBSD_kernel__) || \ -- defined(__OpenBSD__) || \ -- defined(__NetBSD__) --# define HAVE_KQUEUE 1 --# endif --#endif -- - #ifndef HAVE_EPOLL - # if defined(__linux__) - # define HAVE_EPOLL 1 - # endif +-#if !defined(_WIN32) && !defined(_AIX) +-#include ++#ifndef HAVE_EPOLL ++# if defined(__linux__) ++# define HAVE_EPOLL 1 ++# endif #endif --#if defined(HAVE_KQUEUE) || defined(HAVE_EPOLL) +-static uv_async_t async; +-static uv_barrier_t barrier; +#if defined(HAVE_EPOLL) +# include +#endif - --#if defined(HAVE_KQUEUE) ++ +#if !defined(_WIN32) - # include --# include - # include - #endif ++# include ++# include ++#endif --#if defined(HAVE_EPOLL) --# include --#endif -- +static uv_loop_t main_loop; +static uv_loop_t external_loop; - static uv_thread_t embed_thread; - static uv_sem_t embed_sem; --static uv_timer_t embed_timer; - static uv_async_t embed_async; ++static uv_thread_t embed_thread; ++static uv_sem_t embed_sem; ++static uv_async_t embed_async; +static uv_async_t main_async; - static volatile int embed_closed; ++static volatile int embed_closed; --static int embed_timer_called; +-static void thread_main(void* arg) { +- ASSERT_LE(0, uv_barrier_wait(&barrier)); +- uv_sleep(250); +- ASSERT_EQ(0, uv_async_send(&async)); +-} +static uv_timer_t main_timer; +static int main_timer_called; --static void embed_thread_runner(void* arg) { +-static void async_cb(uv_async_t* handle) { +- uv_close((uv_handle_t*) handle, NULL); +#if defined(_WIN32) +static void embed_thread_poll_win(HANDLE iocp, int timeout) { + DWORD bytes; @@ -318,8 +308,7 @@ index c6ddceb149d9c1d68b0dd17b6dac0d4c3c3e9dbc..f6572c5dc2b6ef39bd11889ad1f78730 +} +#else +static void embed_thread_poll_unix(int fd, int timeout) { - int r; -- int fd; ++ int r; + do { +#if defined(HAVE_EPOLL) + struct epoll_event ev; @@ -336,113 +325,103 @@ index c6ddceb149d9c1d68b0dd17b6dac0d4c3c3e9dbc..f6572c5dc2b6ef39bd11889ad1f78730 + r = select(fd + 1, &readset, NULL, NULL, timeout >= 0 ? &tv : NULL); +#endif + } while (r == -1 && errno == EINTR); -+} + } +#endif /* !_WIN32 */ -+ -+ -+static void embed_thread_runner(void* arg) { - int timeout; -- while (!embed_closed) { -- fd = uv_backend_fd(uv_default_loop()); -- timeout = uv_backend_timeout(uv_default_loop()); + +-TEST_IMPL(embed) { +- uv_thread_t thread; +- uv_loop_t* loop; - -- do { --#if defined(HAVE_KQUEUE) -- struct timespec ts; -- ts.tv_sec = timeout / 1000; -- ts.tv_nsec = (timeout % 1000) * 1000000; -- r = kevent(fd, NULL, 0, NULL, 0, &ts); --#elif defined(HAVE_EPOLL) -- { -- struct epoll_event ev; -- r = epoll_wait(fd, &ev, 1, timeout); -- } -+ do { +- loop = uv_default_loop(); +- ASSERT_EQ(0, uv_async_init(loop, &async, async_cb)); +- ASSERT_EQ(0, uv_barrier_init(&barrier, 2)); +- ASSERT_EQ(0, uv_thread_create(&thread, thread_main, NULL)); +- ASSERT_LE(0, uv_barrier_wait(&barrier)); +- +- while (uv_loop_alive(loop)) { +-#if defined(_WIN32) || defined(_AIX) +- ASSERT_LE(0, uv_run(loop, UV_RUN_ONCE)); ++static void embed_thread_runner(void* arg) { ++ int timeout; ++ ++ while (1) { ++ uv_sem_wait(&embed_sem); ++ if (embed_closed) ++ break; ++ + timeout = uv_backend_timeout(&main_loop); + +#if defined(_WIN32) + embed_thread_poll_win(main_loop.iocp, timeout); -+#else + #else +- int rc; +- do { +- struct pollfd p; +- p.fd = uv_backend_fd(loop); +- p.events = POLLIN; +- p.revents = 0; +- rc = poll(&p, 1, uv_backend_timeout(loop)); +- } while (rc == -1 && errno == EINTR); +- ASSERT_LE(0, uv_run(loop, UV_RUN_NOWAIT)); + embed_thread_poll_unix(uv_backend_fd(&main_loop), timeout); #endif -- } while (r == -1 && errno == EINTR); + - uv_async_send(&embed_async); ++ uv_async_send(&embed_async); + } ++} ++ + - uv_sem_wait(&embed_sem); -- } -+ } while (!embed_closed); - } - - - static void embed_cb(uv_async_t* async) { -- uv_run(uv_default_loop(), UV_RUN_ONCE); ++static void embed_cb(uv_async_t* async) { + /* Run tasks in main loop */ + uv_run(&main_loop, UV_RUN_NOWAIT); - ++ + /* Tell embed thread to continue polling */ - uv_sem_post(&embed_sem); - } - - --static void embed_timer_cb(uv_timer_t* timer) { -- embed_timer_called++; ++ uv_sem_post(&embed_sem); ++} ++ ++ +static void main_timer_cb(uv_timer_t* timer) { + main_timer_called++; - embed_closed = 1; - - uv_close((uv_handle_t*) &embed_async, NULL); ++ embed_closed = 1; ++ ++ uv_close((uv_handle_t*) &embed_async, NULL); + uv_close((uv_handle_t*) &main_async, NULL); - } --#endif - - --TEST_IMPL(embed) { --#if defined(HAVE_KQUEUE) || defined(HAVE_EPOLL) -- uv_loop_t external; -- -- ASSERT(0 == uv_loop_init(&external)); ++} ++ ++ +static void init_loops(void) { + ASSERT_EQ(0, uv_loop_init(&main_loop)); + ASSERT_EQ(0, uv_loop_init(&external_loop)); - -- embed_timer_called = 0; ++ + main_timer_called = 0; - embed_closed = 0; - -- uv_async_init(&external, &embed_async, embed_cb); ++ embed_closed = 0; ++ + uv_async_init(&external_loop, &embed_async, embed_cb); - -- /* Start timer in default loop */ -- uv_timer_init(uv_default_loop(), &embed_timer); -- uv_timer_start(&embed_timer, embed_timer_cb, 250, 0); ++ + /* Create a dummy async for main loop otherwise backend timeout will + always be 0 */ + uv_async_init(&main_loop, &main_async, embed_cb); - -- /* Start worker that will interrupt external loop */ ++ + /* Start worker that will poll main loop and interrupt external loop */ - uv_sem_init(&embed_sem, 0); - uv_thread_create(&embed_thread, embed_thread_runner, NULL); ++ uv_sem_init(&embed_sem, 0); ++ uv_thread_create(&embed_thread, embed_thread_runner, NULL); +} - -- /* But run external loop */ -- uv_run(&external, UV_RUN_DEFAULT); ++ + +static void run_loop(void) { ++ /* Run main loop for once to give things a chance to initialize */ ++ embed_cb(&embed_async); ++ + /* Run external loop */ + uv_run(&external_loop, UV_RUN_DEFAULT); - - uv_thread_join(&embed_thread); -- uv_loop_close(&external); ++ ++ uv_thread_join(&embed_thread); + uv_sem_destroy(&embed_sem); + uv_loop_close(&external_loop); + uv_loop_close(&main_loop); +} - -- ASSERT(embed_timer_called == 1); --#endif ++ + +TEST_IMPL(embed) { + init_loops(); @@ -478,17 +457,19 @@ index c6ddceb149d9c1d68b0dd17b6dac0d4c3c3e9dbc..f6572c5dc2b6ef39bd11889ad1f78730 + polling in embed thread */ + uv_timer_init(&external_loop, &external_timer); + uv_timer_start(&external_timer, external_timer_cb, 100, 0); -+ + +- ASSERT_EQ(0, uv_thread_join(&thread)); +- uv_barrier_destroy(&barrier); + run_loop(); + ASSERT_EQ(main_timer_called, 1); + MAKE_VALGRIND_HAPPY(); return 0; - } diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h -index a43edf1a4a9b0932ec73b8edaca0f676ecf3ccfa..199402e31406cf8ba360d54769461bb5285011ee 100644 +index b19c10c7e40c77061337416fd623c53d0863d276..1f54ac21c36902bccb35c64cefa8bb14dd675bb0 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h -@@ -263,6 +263,7 @@ TEST_DECLARE (process_priority) +@@ -265,6 +265,7 @@ TEST_DECLARE (process_priority) TEST_DECLARE (has_ref) TEST_DECLARE (active) TEST_DECLARE (embed) @@ -496,7 +477,7 @@ index a43edf1a4a9b0932ec73b8edaca0f676ecf3ccfa..199402e31406cf8ba360d54769461bb5 TEST_DECLARE (async) TEST_DECLARE (async_null_cb) TEST_DECLARE (eintr_handling) -@@ -860,6 +861,7 @@ TASK_LIST_START +@@ -867,6 +868,7 @@ TASK_LIST_START TEST_ENTRY (active) TEST_ENTRY (embed) diff --git a/patches/node/feat_initialize_asar_support.patch b/patches/node/feat_initialize_asar_support.patch index 5c2da28fa7ebf..d97625b011ed6 100644 --- a/patches/node/feat_initialize_asar_support.patch +++ b/patches/node/feat_initialize_asar_support.patch @@ -5,34 +5,13 @@ Subject: feat: initialize asar support This patch initializes asar support in Node.js. -diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js -index f7ead4084ed4ed6a682bc62e7ad6fc350381d3b9..cd9ca227b9cac4ff021ce1643000ea4b45163df6 100644 ---- a/lib/internal/main/worker_thread.js -+++ b/lib/internal/main/worker_thread.js -@@ -31,6 +31,7 @@ const { - initializeReport, - initializeSourceMapsHandlers, - loadPreloadModules, -+ setupAsarSupport, - setupTraceCategoryState, - markBootstrapComplete - } = require('internal/process/pre_execution'); -@@ -164,6 +165,8 @@ port.on('message', (message) => { - }; - workerIo.sharedCwdCounter = cwdCounter; - -+ setupAsarSupport(); -+ - const CJSLoader = require('internal/modules/cjs/loader'); - assert(!CJSLoader.hasLoadedAnyUserCJSModule); - loadPreloadModules(); diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js -index 23d4dbcf6cd8e1e3e4a509672e203323d81e736c..db8bf724af5f113c7c86350a210d5eee82879d13 100644 +index 73ccca1c6c9d4da7600e216fd53eec82426d892d..1c529f062cd3ec79643ae8c946e2ed0faac336fb 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js -@@ -103,12 +103,17 @@ function prepareMainThreadExecution(expandArgv1 = false, - assert(!CJSLoader.hasLoadedAnyUserCJSModule); +@@ -125,12 +125,17 @@ function setupUserModules() { loadPreloadModules(); + // Need to be done after --require setup. initializeFrozenIntrinsics(); + setupAsarSupport(); } @@ -48,11 +27,3 @@ index 23d4dbcf6cd8e1e3e4a509672e203323d81e736c..db8bf724af5f113c7c86350a210d5eee function patchProcessObject(expandArgv1) { const binding = internalBinding('process_methods'); binding.patchProcessObject(process); -@@ -620,6 +625,7 @@ module.exports = { - loadPreloadModules, - setupTraceCategoryState, - setupInspectorHooks, -+ setupAsarSupport, - initializeReport, - initializeCJSLoader, - initializeWASI, diff --git a/patches/node/fix_account_for_debugger_agent_race_condition.patch b/patches/node/fix_account_for_debugger_agent_race_condition.patch index b5e644ed688a6..460cca2735f27 100644 --- a/patches/node/fix_account_for_debugger_agent_race_condition.patch +++ b/patches/node/fix_account_for_debugger_agent_race_condition.patch @@ -10,26 +10,26 @@ errors. This is remedied by adding a small timeout to the test. We'll either upstream this or figure out a better solution. diff --git a/test/parallel/test-debugger-address.mjs b/test/parallel/test-debugger-address.mjs -index eab99c9b0e2fb387ef9a716396e41c7fc93e93bc..f33e85415e3a8d5df073acbf03aed5271e88a1a7 100644 +index eab99c9b0e2fb387ef9a716396e41c7fc93e93bc..ef8b20a60df88a0a412c309f597e1b1f652fef07 100644 --- a/test/parallel/test-debugger-address.mjs +++ b/test/parallel/test-debugger-address.mjs @@ -56,6 +56,7 @@ function launchTarget(...args) { const { childProc, host, port } = await launchTarget('--inspect=0', script); target = childProc; cli = startCLI([`${host || '127.0.0.1'}:${port}`]); -+ await new Promise(resolve => setTimeout(resolve, 1000)) ++ await new Promise(resolve => setTimeout(resolve, 1000)); await cli.waitForPrompt(); await cli.command('sb("alive.js", 3)'); await cli.waitFor(/break/); diff --git a/test/sequential/test-debugger-pid.js b/test/sequential/test-debugger-pid.js -index 0056113ecaecd3a176ee9539b7fda0132ef59963..3228d0ecc220b5c8c8034fea0dce20f8c38ac68c 100644 +index 99062149dfe3374b86439850e0655383e2bad662..78c173f5073818fae7d46413842cb7790130c3f5 100644 --- a/test/sequential/test-debugger-pid.js +++ b/test/sequential/test-debugger-pid.js -@@ -41,6 +41,7 @@ function launchTarget(...args) { - .then(() => cli.command('sb("alive.js", 3)')) - .then(() => cli.waitFor(/break/)) - .then(() => cli.waitForPrompt()) -+ .then(() => new Promise(resolve => setTimeout(resolve, 1000))) - .then(() => { - assert.match( - cli.output, +@@ -20,6 +20,7 @@ const runTest = async () => { + await cli.command('sb("alive.js", 3)'); + await cli.waitFor(/break/); + await cli.waitForPrompt(); ++ await new Promise(resolve => setTimeout(resolve, 1000)); + assert.match( + cli.output, + /> 3 {3}\+\+x;/, diff --git a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch index e41109231dabc..8682c04a2a75c 100644 --- a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch +++ b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch @@ -7,7 +7,7 @@ common.gypi is a file that's included in the node header bundle, despite the fact that we do not build node with gyp. diff --git a/common.gypi b/common.gypi -index 3f708d89b1ef384e01726101263728367b6f4355..e58cc4b4fb4ba28f23133530dc3d908c4cb68426 100644 +index f3e479096776395c6465efc2597bc51918e90322..cbbc7264c6ad097c5da4902ac1bdbdcebfdd36af 100644 --- a/common.gypi +++ b/common.gypi @@ -80,6 +80,23 @@ diff --git a/patches/node/fix_crypto_tests_to_run_with_bssl.patch b/patches/node/fix_crypto_tests_to_run_with_bssl.patch index 377c8b5fa0472..0fbbd47c085a4 100644 --- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch +++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch @@ -390,7 +390,7 @@ index 35514afbea92562a81c163b1e4d918b4ab609f71..13098e1acf12c309f2ed6f6143a2c2ee txt += decipher.final('utf-16le'); assert.strictEqual(txt, plaintext); diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js -index 87f3641fb188bd322e7c256e9548c6af85dc9a14..1e803bc33ba4642065bf1897c56f65fc92bd2a50 100644 +index 3e3632203af72c54f2795d8de0cf345862a043bb..a066bbb803d41d9d1f26a02e41115b71233988d6 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -60,6 +60,10 @@ function testCipher2(key, iv) { @@ -715,10 +715,10 @@ index 008ab129f0e019c659eecf5a76b7eb412c947fe3..6688f5d916f50e1e4fcfff1619c8634a cipher.end('Papaya!'); // Should not cause an unhandled exception. diff --git a/test/parallel/test-crypto-x509.js b/test/parallel/test-crypto-x509.js -index 510e3183cf3ce367aa6e9cf21ee653feb106a9ba..afb2e07d9e8d60cb37dd07714c810fb8b83df8c3 100644 +index 6d92e97115fd537b0469f69132e591d8b1c6a43f..cdeed19099c351e3c3ec3c2d78e12b64098ddc6a 100644 --- a/test/parallel/test-crypto-x509.js +++ b/test/parallel/test-crypto-x509.js -@@ -109,7 +109,7 @@ const der = Buffer.from( +@@ -110,7 +110,7 @@ const der = Buffer.from( '5A:42:63:E0:21:2F:D6:70:63:07:96:6F:27:A7:78:12:08:02:7A:8B' ); assert.strictEqual(x509.keyUsage, undefined); @@ -727,7 +727,7 @@ index 510e3183cf3ce367aa6e9cf21ee653feb106a9ba..afb2e07d9e8d60cb37dd07714c810fb8 assert.deepStrictEqual(x509.raw, der); -@@ -195,6 +195,16 @@ const der = Buffer.from( +@@ -209,6 +209,16 @@ const der = Buffer.from( }); mc.port2.postMessage(x509); @@ -744,7 +744,7 @@ index 510e3183cf3ce367aa6e9cf21ee653feb106a9ba..afb2e07d9e8d60cb37dd07714c810fb8 // Verify that legacy encoding works const legacyObjectCheck = { subject: Object.assign(Object.create(null), { -@@ -219,16 +229,8 @@ const der = Buffer.from( +@@ -233,16 +243,8 @@ const der = Buffer.from( 'OCSP - URI': ['http://ocsp.nodejs.org/'], 'CA Issuers - URI': ['http://ca.nodejs.org/ca.cert'] }), @@ -762,7 +762,7 @@ index 510e3183cf3ce367aa6e9cf21ee653feb106a9ba..afb2e07d9e8d60cb37dd07714c810fb8 exponent: '0x10001', valid_from: 'Sep 3 21:40:37 2022 GMT', valid_to: 'Jun 17 21:40:37 2296 GMT', -@@ -240,7 +242,7 @@ const der = Buffer.from( +@@ -254,7 +256,7 @@ const der = Buffer.from( '51:62:18:39:E2:E2:77:F5:86:11:E8:C0:CA:54:43:7C:76:83:19:05:D0:03:' + '24:21:B8:EB:14:61:FB:24:16:EB:BD:51:1A:17:91:04:30:03:EB:68:5F:DC:' + '86:E1:D1:7C:FB:AF:78:ED:63:5F:29:9C:32:AF:A1:8E:22:96:D1:02', @@ -771,7 +771,7 @@ index 510e3183cf3ce367aa6e9cf21ee653feb106a9ba..afb2e07d9e8d60cb37dd07714c810fb8 }; const legacyObject = x509.toLegacyObject(); -@@ -249,7 +251,7 @@ const der = Buffer.from( +@@ -263,7 +265,7 @@ const der = Buffer.from( assert.deepStrictEqual(legacyObject.subject, legacyObjectCheck.subject); assert.deepStrictEqual(legacyObject.issuer, legacyObjectCheck.issuer); assert.deepStrictEqual(legacyObject.infoAccess, legacyObjectCheck.infoAccess); @@ -780,7 +780,7 @@ index 510e3183cf3ce367aa6e9cf21ee653feb106a9ba..afb2e07d9e8d60cb37dd07714c810fb8 assert.strictEqual(legacyObject.bits, legacyObjectCheck.bits); assert.strictEqual(legacyObject.exponent, legacyObjectCheck.exponent); assert.strictEqual(legacyObject.valid_from, legacyObjectCheck.valid_from); -@@ -258,7 +260,7 @@ const der = Buffer.from( +@@ -272,7 +274,7 @@ const der = Buffer.from( assert.strictEqual( legacyObject.fingerprint256, legacyObjectCheck.fingerprint256); @@ -932,7 +932,7 @@ index aa685ca9e09cf0d17ff4d5480089e9977dd51f72..ccafa427433922155c1afd5d95ba69d8 })); socket.end('Hello'); diff --git a/test/parallel/test-tls-getprotocol.js b/test/parallel/test-tls-getprotocol.js -index 02c683c71c8775e84d5d125a4f05560b8206677d..4c6dd20ca0a8d0acdf9f8d1b7153087de9305196 100644 +index d45287d671d8afb1be391d391efc4d098d0b77c9..86f1a12528b535eefeb8c263581f1240f3df5771 100644 --- a/test/parallel/test-tls-getprotocol.js +++ b/test/parallel/test-tls-getprotocol.js @@ -18,7 +18,7 @@ const clientConfigs = [ @@ -991,7 +991,7 @@ index 442423954b10b2ee1696eb7db56eaa4c88492122..c65610245e7e328d5e844afc48f8f685 } +*/ diff --git a/test/parallel/test-webcrypto-derivekey.js b/test/parallel/test-webcrypto-derivekey.js -index f8eb996000ec899abafbfd558f4f49bad2c69c9a..0bf5c7811eeccff6194d8df41887df0a86a53823 100644 +index b819b998d217e0c71e9b41f175de6802d3ac7d90..2afaa9918d7ebd156061094a055dbf076f9965f5 100644 --- a/test/parallel/test-webcrypto-derivekey.js +++ b/test/parallel/test-webcrypto-derivekey.js @@ -46,6 +46,7 @@ const { webcrypto: { subtle }, KeyObject } = require('crypto'); @@ -1010,7 +1010,7 @@ index f8eb996000ec899abafbfd558f4f49bad2c69c9a..0bf5c7811eeccff6194d8df41887df0a // Test PBKDF2 key derivation { -@@ -151,6 +153,7 @@ const { webcrypto: { subtle }, KeyObject } = require('crypto'); +@@ -174,6 +176,7 @@ const { webcrypto: { subtle }, KeyObject } = require('crypto'); })().then(common.mustCall()); } @@ -1018,7 +1018,7 @@ index f8eb996000ec899abafbfd558f4f49bad2c69c9a..0bf5c7811eeccff6194d8df41887df0a // Test X25519 and X448 key derivation { async function test(name) { -@@ -185,3 +188,4 @@ const { webcrypto: { subtle }, KeyObject } = require('crypto'); +@@ -208,3 +211,4 @@ const { webcrypto: { subtle }, KeyObject } = require('crypto'); test('X25519').then(common.mustCall()); test('X448').then(common.mustCall()); } @@ -1073,7 +1073,7 @@ index 1094845c73e14313860ad476fb7baba2a11b5af4..51972b4b34b191ac59145889dbf2da5c function generateWrappingKeys() { diff --git a/test/parallel/test-x509-escaping.js b/test/parallel/test-x509-escaping.js -index c31a6d21351dc97054daf6276454e2cd98263e26..e339fcc3f9af9c55a9000bb1b836b553ef1bf795 100644 +index 170103fd9c973d64a30ee319a45c7e11c72a19d4..c19118146269651e4fe7d5591360876ce66bb1f6 100644 --- a/test/parallel/test-x509-escaping.js +++ b/test/parallel/test-x509-escaping.js @@ -447,7 +447,7 @@ const { hasOpenSSL3 } = common; diff --git a/patches/node/fix_expose_lookupandcompile_with_parameters.patch b/patches/node/fix_expose_lookupandcompile_with_parameters.patch index af6074e1edac9..48a8e3be999f1 100644 --- a/patches/node/fix_expose_lookupandcompile_with_parameters.patch +++ b/patches/node/fix_expose_lookupandcompile_with_parameters.patch @@ -10,10 +10,10 @@ parameters. This should be upstreamed. diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 3bc9d113b6b818dcda332966f09f17248b421263..549339b5b677fa242a7b60ae716789c2a11ab18d 100644 +index 6e1a55adbd0b01383f3e54e924864dfeb6a57f0b..25b02f9904127780c68db9b451a7dfcf02a6fc5e 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -397,6 +397,22 @@ MaybeLocal BuiltinLoader::LookupAndCompile( +@@ -438,6 +438,22 @@ MaybeLocal BuiltinLoader::LookupAndCompile( return maybe; } @@ -37,10 +37,10 @@ index 3bc9d113b6b818dcda332966f09f17248b421263..549339b5b677fa242a7b60ae716789c2 BuiltinLoader* loader = GetInstance(); std::vector ids = loader->GetBuiltinIds(); diff --git a/src/node_builtins.h b/src/node_builtins.h -index 7f0a25af306ffefbc51ac43689ed208d4cd94f0b..a32a7a990082ea3dad73511f91a9c70c72f6fe31 100644 +index 8228e57d27b2f883d87ec12274f2745628caa6e1..b07c34a6d247a050f4f307940c9e157fb14d6166 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h -@@ -49,6 +49,11 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { +@@ -53,6 +53,11 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { v8::Local context, const char* id, Environment* optional_env); diff --git a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch index 118ed65580183..4d18cbb616238 100644 --- a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch +++ b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch @@ -18,10 +18,10 @@ index a7329d279bb07542d3f4027e0c8e2b035d493e5b..5cff70923b4ea7a4df918b2d3d1fbc71 /** diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index bfee280212fc4d85b2b0a92ac79d898de3cb5ab3..a79cec8d82b439202ecf40b3d55b75706d3aaf29 100644 +index 7cec4e9a3e3675ba75d66a44ed4e142d13ca1821..0c7aad193442a7e5cab62638441969a7d4983ef9 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js -@@ -795,6 +795,8 @@ function parsePackageName(specifier, base) { +@@ -824,6 +824,8 @@ function parsePackageName(specifier, base) { return { packageName, packageSubpath, isScoped }; } @@ -30,7 +30,7 @@ index bfee280212fc4d85b2b0a92ac79d898de3cb5ab3..a79cec8d82b439202ecf40b3d55b7570 /** * @param {string} specifier * @param {string | URL | undefined} base -@@ -807,6 +809,10 @@ function packageResolve(specifier, base, conditions) { +@@ -836,6 +838,10 @@ function packageResolve(specifier, base, conditions) { return new URL('node:' + specifier); } @@ -41,7 +41,7 @@ index bfee280212fc4d85b2b0a92ac79d898de3cb5ab3..a79cec8d82b439202ecf40b3d55b7570 const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base); -@@ -1005,7 +1011,7 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { +@@ -1034,7 +1040,7 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { function throwIfUnsupportedURLProtocol(url) { if (url.protocol !== 'file:' && url.protocol !== 'data:' && @@ -73,10 +73,10 @@ index 6f25b2e67ab77613c6ed63c227bb875d5461f45f..d1527b859bbea15fdf30622fc8f2700b exportName === 'default') continue; diff --git a/lib/internal/url.js b/lib/internal/url.js -index 2a4ffefe2450708af61e09d7a9530bec1c15d922..9a1c49df14e8b3cef7e66789242a625c6afb3ca9 100644 +index 40b25f6890b5db721923ba2e9cc351e514ca22bc..288f3253b4c686d1b061dfcdf18dc95794943d87 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js -@@ -1483,6 +1483,8 @@ function fileURLToPath(path) { +@@ -1488,6 +1488,8 @@ function fileURLToPath(path) { path = new URL(path); else if (!isURLInstance(path)) throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path); diff --git a/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch b/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch index 7d174e36b5bab..ed97d7bb902d5 100644 --- a/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch +++ b/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch @@ -7,10 +7,10 @@ Subject: fix: expose tracing::Agent and use tracing::TracingController instead This API is used by Electron to create Node's tracing controller. diff --git a/src/api/environment.cc b/src/api/environment.cc -index 315e5c1d03a59dbb1eed5a79ec013a0815e3f5fe..8a7ad50b818448fa14eb4707c1dcec2a1339d2db 100644 +index 3e2e6a04ddd51e688f77e4f0f7db53b933cb2390..2e6f4a5c4b894a7425db110b3aadbe734f137327 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -474,6 +474,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { +@@ -490,6 +490,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { return env->platform(); } @@ -22,7 +22,7 @@ index 315e5c1d03a59dbb1eed5a79ec013a0815e3f5fe..8a7ad50b818448fa14eb4707c1dcec2a int thread_pool_size, node::tracing::TracingController* tracing_controller) { diff --git a/src/node.h b/src/node.h -index 845dbb9ef6ed37213dd0a9044e883c5feaa43b6e..c3da0c8be37fb0983bd389fc7466ab85a21afbda 100644 +index 58ff9010c78f317788d4fc47cc2143faca96a49c..9579b04472350fca5b5dbce354d373b50f873972 100644 --- a/src/node.h +++ b/src/node.h @@ -129,6 +129,7 @@ namespace node { @@ -33,7 +33,7 @@ index 845dbb9ef6ed37213dd0a9044e883c5feaa43b6e..c3da0c8be37fb0983bd389fc7466ab85 class TracingController; } -@@ -650,6 +651,8 @@ NODE_EXTERN void GetNodeReport(Environment* env, +@@ -652,6 +653,8 @@ NODE_EXTERN void GetNodeReport(Environment* env, NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env); NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env); diff --git a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch index 99321778dfb0b..c33d26e0fbfa4 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -17,7 +17,7 @@ Upstreams: - https://github.com/nodejs/node/pull/39136 diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc -index b907e9e9cdc4e407ee8361cebce2dc168b8c0ed3..804baa633cd7d1a57a8248b30cb1c4f65d169bd9 100644 +index 81ba818a2dc7d31aa6cadfb3a3c547e10631ecf3..6d5fbe2ffa81f379f7899b29f4b26bfbf590bc4e 100644 --- a/src/crypto/crypto_cipher.cc +++ b/src/crypto/crypto_cipher.cc @@ -27,7 +27,8 @@ using v8::Value; @@ -31,10 +31,10 @@ index b907e9e9cdc4e407ee8361cebce2dc168b8c0ed3..804baa633cd7d1a57a8248b30cb1c4f6 case EVP_CIPH_GCM_MODE: #ifndef OPENSSL_NO_OCB diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc -index 9777737126551035430178a2e0956769865b9b1a..c13185c32a26ac9facb12106c4e756640e35fb93 100644 +index a1d0dfc16ce23503b0985ec6e185fb54758c8893..85daa8c8c12c28571f0ee739868549335cb1f730 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc -@@ -164,7 +164,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { +@@ -159,7 +159,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { const unsigned char* buf; size_t len; size_t rem; @@ -43,7 +43,7 @@ index 9777737126551035430178a2e0956769865b9b1a..c13185c32a26ac9facb12106c4e75664 if (!SSL_client_hello_get0_ext( ssl.get(), TLSEXT_TYPE_application_layer_protocol_negotiation, -@@ -177,13 +177,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { +@@ -172,13 +172,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { len = (buf[0] << 8) | buf[1]; if (len + 2 != rem) return nullptr; return reinterpret_cast(buf + 3); @@ -60,7 +60,7 @@ index 9777737126551035430178a2e0956769865b9b1a..c13185c32a26ac9facb12106c4e75664 if (!SSL_client_hello_get0_ext( ssl.get(), TLSEXT_TYPE_server_name, -@@ -205,15 +207,20 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) { +@@ -200,15 +202,20 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) { if (len + 2 > rem) return nullptr; return reinterpret_cast(buf + 5); @@ -84,7 +84,7 @@ index 9777737126551035430178a2e0956769865b9b1a..c13185c32a26ac9facb12106c4e75664 const char* X509ErrorCode(long err) { // NOLINT(runtime/int) const char* code = "UNSPECIFIED"; -@@ -1044,14 +1051,14 @@ MaybeLocal GetClientHelloCiphers( +@@ -1039,14 +1046,14 @@ MaybeLocal GetClientHelloCiphers( Environment* env, const SSLPointer& ssl) { EscapableHandleScope scope(env->isolate()); @@ -248,10 +248,10 @@ index 4eacb1f142b6e04d6db17ca267d1fb6814666a01..79ad930c8bea22cf1ca645373438cc27 if (target diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index f1bb7a9c7aadbc061f3de4de72f13f45a2195bee..4ea6d851450c46659e7e19f50c614419a46b30c0 100644 +index 28eb1bd6b7dc839fa6aefebe5813343c8e9444bb..1fe573cd7b6894743a0986e87802960ad09e2dd9 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -495,24 +495,15 @@ Maybe Decorate(Environment* env, Local obj, +@@ -493,24 +493,15 @@ Maybe Decorate(Environment* env, Local obj, V(BIO) \ V(PKCS7) \ V(X509V3) \ @@ -277,7 +277,7 @@ index f1bb7a9c7aadbc061f3de4de72f13f45a2195bee..4ea6d851450c46659e7e19f50c614419 V(USER) \ #define V(name) case ERR_LIB_##name: lib = #name "_"; break; -@@ -686,7 +677,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -684,7 +675,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); uint32_t len = args[0].As()->Value(); @@ -286,7 +286,7 @@ index f1bb7a9c7aadbc061f3de4de72f13f45a2195bee..4ea6d851450c46659e7e19f50c614419 if (data == nullptr) { // There's no memory available for the allocation. // Return nothing. -@@ -697,7 +688,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -695,7 +686,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { data, len, [](void* data, size_t len, void* deleter_data) { @@ -295,7 +295,7 @@ index f1bb7a9c7aadbc061f3de4de72f13f45a2195bee..4ea6d851450c46659e7e19f50c614419 }, data); Local buffer = ArrayBuffer::New(env->isolate(), store); -@@ -705,10 +696,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -703,10 +694,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { } void SecureHeapUsed(const FunctionCallbackInfo& args) { @@ -309,10 +309,10 @@ index f1bb7a9c7aadbc061f3de4de72f13f45a2195bee..4ea6d851450c46659e7e19f50c614419 } // namespace diff --git a/src/node_metadata.cc b/src/node_metadata.cc -index a221dcde050ad7b64cf25df1e1b3a3063a6f37e5..acf95e74882dbd65c65de75c933795c597817894 100644 +index d4c8ccde21d3973f3099ee3075dc3c11d55cb514..d57435a73e17c21dad2a7c8fb2c6e8a356630d88 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc -@@ -9,7 +9,7 @@ +@@ -10,7 +10,7 @@ #include "v8.h" #include "zlib.h" @@ -322,7 +322,7 @@ index a221dcde050ad7b64cf25df1e1b3a3063a6f37e5..acf95e74882dbd65c65de75c933795c5 #if NODE_OPENSSL_HAS_QUIC #include diff --git a/src/node_metadata.h b/src/node_metadata.h -index b7cacae4c3d430c888fa7b5c66d8ed822e18f59d..d3b2ba33b06e1ebe140a30c777907f2bdffa098c 100644 +index 89c2d36611ee7bca78fc0c818e720188d0cbd6fc..a40121abd28ae7c51f91eabae39db947ab0b12d5 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -6,7 +6,7 @@ @@ -335,7 +335,7 @@ index b7cacae4c3d430c888fa7b5c66d8ed822e18f59d..d3b2ba33b06e1ebe140a30c777907f2b #if NODE_OPENSSL_HAS_QUIC #include diff --git a/src/node_options.cc b/src/node_options.cc -index e2a051d03c7edefea4a2fc34e841f3ef59931c04..635b8f60806854e4e02be546c40824b9a95b88a2 100644 +index 633c574c8199c1f57b6e55b732ea6f3792bf9317..d0af2849045fbe0287836dffe5c5d0083f35557d 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -5,7 +5,7 @@ @@ -348,7 +348,7 @@ index e2a051d03c7edefea4a2fc34e841f3ef59931c04..635b8f60806854e4e02be546c40824b9 #endif diff --git a/src/node_options.h b/src/node_options.h -index 7346fc7441eb3c3c6f8b0ea2d3cafa73308abe14..a13647f171f6e87b5be2f4863c87d981e12a09a2 100644 +index 6c9c929399f336dda2da4fe095d69c8f87970103..431536297e1a18b65f3c7a10883a736abcebe84d 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -11,7 +11,7 @@ diff --git a/patches/node/fix_override_createjob_in_node_platform.patch b/patches/node/fix_override_createjob_in_node_platform.patch index db1b20be50cd6..27dd584314927 100644 --- a/patches/node/fix_override_createjob_in_node_platform.patch +++ b/patches/node/fix_override_createjob_in_node_platform.patch @@ -9,10 +9,10 @@ This patch adds an override for NodePlatform::CreateJob, using the same parameters as PostJob. diff --git a/src/node_platform.cc b/src/node_platform.cc -index b87413bcb9cfcbc8a51036edc5f6fd95e0906a96..389813fae96db76e385d88ad351b4bf4743298a5 100644 +index 7dd0526e6ece5fd86ab3847be592e778e48b5d37..b3994c4398598c67c0029394d58e8f4dba032c5d 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc -@@ -525,6 +525,12 @@ std::unique_ptr NodePlatform::PostJob(v8::TaskPriority priority, +@@ -534,6 +534,12 @@ std::unique_ptr NodePlatform::PostJob(v8::TaskPriority priority, this, priority, std::move(job_task), NumberOfWorkerThreads()); } diff --git a/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch b/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch index ac44e23703663..203578457ef85 100644 --- a/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch +++ b/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch @@ -37,10 +37,10 @@ index 3a3228ddc9eb6b53efc0721466479a9f62cd8967..175a67840348ca507d6e8b29835e5ab3 HistogramBase::kInternalFieldCount); SetProtoMethodNoSideEffect(isolate, tmpl, "count", GetCount); diff --git a/src/node_messaging.cc b/src/node_messaging.cc -index f88270fc75de91610a973c0649e1bc699c3e014d..e47f7a597a6ca0cfd71fec1e42f0fbb75cb539c7 100644 +index 009ac0056c5486a3f94889f70b592e26827d86a0..ba497064de834c4ea565bb267d1e95e4647b79eb 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc -@@ -1467,13 +1467,16 @@ static void InitMessaging(Local target, +@@ -1495,13 +1495,16 @@ static void InitMessaging(Local target, t->Inherit(BaseObject::GetConstructorTemplate(env)); t->InstanceTemplate()->SetInternalFieldCount( JSTransferable::kInternalFieldCount); diff --git a/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch b/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch index 6e64b21b652f7..0c287b3ad3d55 100644 --- a/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch +++ b/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch @@ -6,10 +6,10 @@ Subject: fix: suppress clang -Wdeprecated-declarations in libuv Should be upstreamed. diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c -index 33e874ac442f88b58d2b68c8ec9764f6f664552e..285393bc501658e3474830bf4aebccecf589c32f 100644 +index 99432053cc3b242e514268b7aba2e2d83a9e64f2..750a5424953aad104ba1e865fefd55d316485917 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c -@@ -1821,10 +1821,17 @@ int uv_os_uname(uv_utsname_t* buffer) { +@@ -1743,10 +1743,17 @@ int uv_os_uname(uv_utsname_t* buffer) { #ifdef _MSC_VER #pragma warning(suppress : 4996) #endif diff --git a/patches/node/fix_tolocalstring_unicode_mismatch.patch b/patches/node/fix_tolocalstring_unicode_mismatch.patch deleted file mode 100644 index 4b22e3470eedb..0000000000000 --- a/patches/node/fix_tolocalstring_unicode_mismatch.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Fri, 25 Nov 2022 10:18:24 +0100 -Subject: fix: toLocalString Unicode mismatch - -Fixes a failure resultant of V8 updating to ICU 72. - -Refs https://chromium-review.googlesource.com/c/v8/v8/+/4004606. - -Date.toLocalString now uses uU+202f (narrow nbsp) before "PM" and "AM". - -This patch can be removed when https://github.com/nodejs/node/pull/45068 -is backported to Node.js v18. - -diff --git a/test/parallel/test-intl.js b/test/parallel/test-intl.js -index 7d1742f2c7d1c6e335d3ccfc81ce0834c1de9c19..df391bd4de3db9a41f3274ca678c9034be9255fe 100644 ---- a/test/parallel/test-intl.js -+++ b/test/parallel/test-intl.js -@@ -97,7 +97,7 @@ if (!common.hasIntl) { - // Test format - { - const localeString = date0.toLocaleString(['en'], optsGMT); -- assert.strictEqual(localeString, '1/1/1970, 12:00:00 AM'); -+ assert.strictEqual(localeString, '1/1/1970, 12:00:00 AM'); - } - // number format - { diff --git a/patches/node/fixup_for_error_declaration_shadows_a_local_variable.patch b/patches/node/fixup_for_error_declaration_shadows_a_local_variable.patch index c8d37e80dacf8..c2681f39fb7f9 100644 --- a/patches/node/fixup_for_error_declaration_shadows_a_local_variable.patch +++ b/patches/node/fixup_for_error_declaration_shadows_a_local_variable.patch @@ -11,7 +11,7 @@ https://chromium-review.googlesource.com/c/chromium/src/+/3860569 diff --git a/src/node_options-inl.h b/src/node_options-inl.h old mode 100644 new mode 100755 -index 7facb22afc3c9bd7b52a61626cca1d7733acb7fc..0c1f36d072f053494258e4117cd8f43e2fe940ba +index 988814c876ee4e4f2ae47b32a1de1b7f33fca7a0..0b5dd95b0a308a1dd91c634873335c8eb4e1ce5d --- a/src/node_options-inl.h +++ b/src/node_options-inl.h @@ -387,12 +387,12 @@ void OptionsParser::Parse( diff --git a/patches/node/macos_avoid_posix_spawnp_cwd_bug_3597.patch b/patches/node/macos_avoid_posix_spawnp_cwd_bug_3597.patch deleted file mode 100644 index f05f9ee5186e0..0000000000000 --- a/patches/node/macos_avoid_posix_spawnp_cwd_bug_3597.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jameson Nash -Date: Fri, 15 Apr 2022 14:10:27 -0400 -Subject: macos: avoid posix_spawnp() cwd bug (#3597) - -macOS 10.15 has a bug where configuring the working directory with -posix_spawn_file_actions_addchdir_np() makes posix_spawnp() fail with -ENOENT even though the executable is spawned successfully. - -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index c8816b85b7e531648064e739fb89257565ad64bb..de51bac3d0e8daf519d35c6a3994f1479590607a 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -671,27 +671,25 @@ static int uv__spawn_resolve_and_spawn(const uv_process_options_t* options, - if (options->env != NULL) - env = options->env; - -- /* If options->file contains a slash, posix_spawn/posix_spawnp behave -- * the same, and don't involve PATH resolution at all. Otherwise, if -- * options->file does not include a slash, but no custom environment is -- * to be used, the environment used for path resolution as well for the -- * child process is that of the parent process, so posix_spawnp is the -- * way to go. */ -- if (strchr(options->file, '/') != NULL || options->env == NULL) { -+ /* If options->file contains a slash, posix_spawn/posix_spawnp should behave -+ * the same, and do not involve PATH resolution at all. The libc -+ * `posix_spawnp` provided by Apple is buggy (since 10.15), so we now emulate it -+ * here, per https://github.com/libuv/libuv/pull/3583. */ -+ if (strchr(options->file, '/') != NULL) { - do -- err = posix_spawnp(pid, options->file, actions, attrs, options->args, env); -+ err = posix_spawn(pid, options->file, actions, attrs, options->args, env); - while (err == EINTR); - return err; - } - - /* Look for the definition of PATH in the provided env */ -- path = uv__spawn_find_path_in_env(options->env); -+ path = uv__spawn_find_path_in_env(env); - - /* The following resolution logic (execvpe emulation) is copied from - * https://git.musl-libc.org/cgit/musl/tree/src/process/execvp.c - * and adapted to work for our specific usage */ - -- /* If no path was provided in options->env, use the default value -+ /* If no path was provided in env, use the default value - * to look for the executable */ - if (path == NULL) - path = _PATH_DEFPATH; -diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h -index 199402e31406cf8ba360d54769461bb5285011ee..f8c08a4a7eb164ffff495c81e1f5df712084648b 100644 ---- a/deps/uv/test/test-list.h -+++ b/deps/uv/test/test-list.h -@@ -322,6 +322,7 @@ TEST_DECLARE (spawn_inherit_streams) - TEST_DECLARE (spawn_quoted_path) - TEST_DECLARE (spawn_tcp_server) - TEST_DECLARE (spawn_exercise_sigchld_issue) -+TEST_DECLARE (spawn_relative_path) - TEST_DECLARE (fs_poll) - TEST_DECLARE (fs_poll_getpath) - TEST_DECLARE (fs_poll_close_request) -@@ -954,6 +955,7 @@ TASK_LIST_START - TEST_ENTRY (spawn_quoted_path) - TEST_ENTRY (spawn_tcp_server) - TEST_ENTRY (spawn_exercise_sigchld_issue) -+ TEST_ENTRY (spawn_relative_path) - TEST_ENTRY (fs_poll) - TEST_ENTRY (fs_poll_getpath) - TEST_ENTRY (fs_poll_close_request) -diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c -index dfd5458ef37c664af9a55a8383bdb3121885db3b..de9c710020ef7da66e45f5617a8a697e698fa202 100644 ---- a/deps/uv/test/test-spawn.c -+++ b/deps/uv/test/test-spawn.c -@@ -1981,3 +1981,37 @@ void spawn_stdin_stdout(void) { - } - } - #endif /* !_WIN32 */ -+ -+TEST_IMPL(spawn_relative_path) { -+ char* sep; -+ -+ init_process_options("spawn_helper1", exit_cb); -+ -+ exepath_size = sizeof(exepath) - 2; -+ ASSERT_EQ(0, uv_exepath(exepath, &exepath_size)); -+ exepath[exepath_size] = '\0'; -+ -+ /* Poor man's basename(3). */ -+ sep = strrchr(exepath, '/'); -+ if (sep == NULL) -+ sep = strrchr(exepath, '\\'); -+ ASSERT_NOT_NULL(sep); -+ -+ /* Split into dirname and basename and make basename relative. */ -+ memmove(sep + 2, sep, 1 + strlen(sep)); -+ sep[0] = '\0'; -+ sep[1] = '.'; -+ sep[2] = '/'; -+ -+ options.cwd = exepath; -+ options.file = options.args[0] = sep + 1; -+ -+ ASSERT_EQ(0, uv_spawn(uv_default_loop(), &process, &options)); -+ ASSERT_EQ(0, uv_run(uv_default_loop(), UV_RUN_DEFAULT)); -+ -+ ASSERT_EQ(1, exit_cb_called); -+ ASSERT_EQ(1, close_cb_called); -+ -+ MAKE_VALGRIND_HAPPY(); -+ return 0; -+} diff --git a/patches/node/macos_don_t_use_thread-unsafe_strtok_3524.patch b/patches/node/macos_don_t_use_thread-unsafe_strtok_3524.patch deleted file mode 100644 index 69e57568216d0..0000000000000 --- a/patches/node/macos_don_t_use_thread-unsafe_strtok_3524.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ben Noordhuis -Date: Wed, 9 Mar 2022 11:06:39 +0100 -Subject: macos: don't use thread-unsafe strtok() (#3524) - -Refs https://github.com/libuv/libuv/pull/3524 - -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index 8cde389b826b6b167437845eccd5fed440dcadc4..147164e7ea25abbf655452930d78ee0a714cce36 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -387,30 +387,22 @@ static void uv__spawn_init_posix_spawn_fncs(void) { - - - static void uv__spawn_init_can_use_setsid(void) { -- static const int MACOS_CATALINA_VERSION_MAJOR = 19; -- char version_str[256]; -- char* version_major_str; -- size_t version_str_size = 256; -- int r; -- int version_major; -- -- /* Get a version string */ -- r = sysctlbyname("kern.osrelease", version_str, &version_str_size, NULL, 0); -- if (r != 0) -+ int which[] = {CTL_KERN, KERN_OSRELEASE}; -+ unsigned major; -+ unsigned minor; -+ unsigned patch; -+ char buf[256]; -+ size_t len; -+ -+ len = sizeof(buf); -+ if (sysctl(which, ARRAY_SIZE(which), buf, &len, NULL, 0)) - return; - -- /* Try to get the major version number. If not found -- * fall back to the fork/exec flow */ -- version_major_str = strtok(version_str, "."); -- if (version_major_str == NULL) -+ /* NULL specifies to use LC_C_LOCALE */ -+ if (3 != sscanf_l(buf, NULL, "%u.%u.%u", &major, &minor, &patch)) - return; - -- /* Parse the version major as a number. If it is greater than -- * the major version for macOS Catalina (aka macOS 10.15), then -- * the POSIX_SPAWN_SETSID flag is available */ -- version_major = atoi_l(version_major_str, NULL); /* Use LC_C_LOCALE */ -- if (version_major >= MACOS_CATALINA_VERSION_MAJOR) -- posix_spawn_can_use_setsid = 1; -+ posix_spawn_can_use_setsid = (major >= 19); /* macOS Catalina */ - } - - diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index 34f17d343ffe5..995981e14213c 100644 --- a/patches/node/pass_all_globals_through_require.patch +++ b/patches/node/pass_all_globals_through_require.patch @@ -6,11 +6,11 @@ Subject: Pass all globals through "require" (cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 68edd781e33a3e8a451ece8191b918ca70e756eb..7d780ed13412bb307435d98d4a8830a86dd72da1 100644 +index 33bc7f28a41c6c40face8f493d07d3c0061608a7..eb73c774118653c0746f78d4b72b31cb7c4f41f2 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -134,6 +134,13 @@ const { - CHAR_COLON +@@ -137,6 +137,13 @@ const { + CHAR_FORWARD_SLASH, } = require('internal/constants'); +// Store the "global" variable from global scope into a local scope, so we can @@ -23,7 +23,7 @@ index 68edd781e33a3e8a451ece8191b918ca70e756eb..7d780ed13412bb307435d98d4a8830a8 const { isProxy } = require('internal/util/types'); -@@ -1154,10 +1161,12 @@ Module.prototype._compile = function(content, filename) { +@@ -1213,10 +1220,12 @@ Module.prototype._compile = function(content, filename) { if (requireDepth === 0) statCache = new SafeMap(); if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, diff --git a/patches/node/process_bsd_handle_kevent_note_exit_failure_3451.patch b/patches/node/process_bsd_handle_kevent_note_exit_failure_3451.patch deleted file mode 100644 index b8b4e9ef2541c..0000000000000 --- a/patches/node/process_bsd_handle_kevent_note_exit_failure_3451.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jameson Nash -Date: Tue, 1 Feb 2022 15:27:12 -0500 -Subject: process,bsd: handle kevent NOTE_EXIT failure (#3451) - -The kernel may return ESRCH if the child has already exited here. -This is rather annoying, and means we must indirectly handle -notification to our event loop of the process exit. - -Refs: https://github.com/libuv/libuv/pull/3441 -Refs: https://github.com/libuv/libuv/pull/3257 - -diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h -index 16be13b99f5db77741aa276e90a437ef4eb5ba32..2dcc8b32f5165dd75061a1b55cc1abd2ab93ccc9 100644 ---- a/deps/uv/src/unix/internal.h -+++ b/deps/uv/src/unix/internal.h -@@ -145,7 +145,8 @@ typedef struct uv__stream_queued_fds_s uv__stream_queued_fds_t; - - /* loop flags */ - enum { -- UV_LOOP_BLOCK_SIGPROF = 1 -+ UV_LOOP_BLOCK_SIGPROF = 0x1, -+ UV_LOOP_REAP_CHILDREN = 0x2 - }; - - /* flags of excluding ifaddr */ -diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c -index efbc561dee2574f06ebd9408d1e89e435c93cc5a..857eb1d54bfde99754ce2c6e92a287c288bd9f52 100644 ---- a/deps/uv/src/unix/kqueue.c -+++ b/deps/uv/src/unix/kqueue.c -@@ -285,7 +285,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { - for (i = 0; i < nfds; i++) { - ev = events + i; - if (ev->filter == EVFILT_PROC) { -- uv__wait_children(loop); -+ loop->flags |= UV_LOOP_REAP_CHILDREN; - nevents++; - continue; - } -@@ -382,6 +382,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { - nevents++; - } - -+ if (loop->flags & UV_LOOP_REAP_CHILDREN) { -+ loop->flags &= ~UV_LOOP_REAP_CHILDREN; -+ uv__wait_children(loop); -+ } -+ - if (reset_timeout != 0) { - timeout = user_timeout; - reset_timeout = 0; -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index c1f6bd4b0076f0835caf83c45a6a896e7ae5def9..2920b942962357827bae9bcad23af8333e8b007f 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -507,8 +507,12 @@ int uv_spawn(uv_loop_t* loop, - #if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) - struct kevent event; - EV_SET(&event, pid, EVFILT_PROC, EV_ADD | EV_ONESHOT, NOTE_EXIT, 0, 0); -- if (kevent(loop->backend_fd, &event, 1, NULL, 0, NULL)) -- abort(); -+ if (kevent(loop->backend_fd, &event, 1, NULL, 0, NULL)) { -+ if (errno != ESRCH) -+ abort(); -+ /* Process already exited. Call waitpid on the next loop iteration. */ -+ loop->flags |= UV_LOOP_REAP_CHILDREN; -+ } - #endif - - QUEUE_INSERT_TAIL(&loop->process_handles, &process->queue); diff --git a/patches/node/process_fix_hang_after_note_exit_3521.patch b/patches/node/process_fix_hang_after_note_exit_3521.patch deleted file mode 100644 index 768eda13452b3..0000000000000 --- a/patches/node/process_fix_hang_after_note_exit_3521.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jameson Nash -Date: Wed, 23 Mar 2022 15:39:38 +0900 -Subject: process: fix hang after NOTE_EXIT (#3521) - -Bug #3504 seems to affect more platforms than just OpenBSD. As this -seems to be a race condition in these kernels, we do not want to fail -because of it. Instead, we remove the WNOHANG flag from waitpid, and -track exactly which processes have exited. Should also be a slight speed -improvement for excessively large numbers of live children. - -diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c -index 857eb1d54bfde99754ce2c6e92a287c288bd9f52..036055149fcabcb9ff8f43522120c82b3474ab99 100644 ---- a/deps/uv/src/unix/kqueue.c -+++ b/deps/uv/src/unix/kqueue.c -@@ -117,6 +117,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { - unsigned int revents; - QUEUE* q; - uv__io_t* w; -+ uv_process_t* process; - sigset_t* pset; - sigset_t set; - uint64_t base; -@@ -284,12 +285,22 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { - loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; - for (i = 0; i < nfds; i++) { - ev = events + i; -+ fd = ev->ident; -+ -+ /* Handle kevent NOTE_EXIT results */ - if (ev->filter == EVFILT_PROC) { -- loop->flags |= UV_LOOP_REAP_CHILDREN; -+ QUEUE_FOREACH(q, &loop->process_handles) { -+ process = QUEUE_DATA(q, uv_process_t, queue); -+ if (process->pid == fd) { -+ process->flags |= UV_HANDLE_REAP; -+ loop->flags |= UV_LOOP_REAP_CHILDREN; -+ break; -+ } -+ } - nevents++; - continue; - } -- fd = ev->ident; -+ - /* Skip invalidated events, see uv__platform_invalidate_fd */ - if (fd == -1) - continue; -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index 147164e7ea25abbf655452930d78ee0a714cce36..c8816b85b7e531648064e739fb89257565ad64bb 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -63,12 +63,18 @@ extern char **environ; - # include "zos-base.h" - #endif - --#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -+#if defined(__APPLE__) || \ -+ defined(__DragonFly__) || \ -+ defined(__FreeBSD__) || \ -+ defined(__NetBSD__) || \ -+ defined(__OpenBSD__) - #include -+#else -+#define UV_USE_SIGCHLD - #endif - - --#if !(defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) -+#ifdef UV_USE_SIGCHLD - static void uv__chld(uv_signal_t* handle, int signum) { - assert(signum == SIGCHLD); - uv__wait_children(handle->loop); -@@ -80,6 +86,7 @@ void uv__wait_children(uv_loop_t* loop) { - int exit_status; - int term_signal; - int status; -+ int options; - pid_t pid; - QUEUE pending; - QUEUE* q; -@@ -93,19 +100,33 @@ void uv__wait_children(uv_loop_t* loop) { - process = QUEUE_DATA(q, uv_process_t, queue); - q = QUEUE_NEXT(q); - -+#ifndef UV_USE_SIGCHLD -+ if ((process->flags & UV_HANDLE_REAP) == 0) -+ continue; -+ options = 0; -+ process->flags &= ~UV_HANDLE_REAP; -+#else -+ options = WNOHANG; -+#endif -+ - do -- pid = waitpid(process->pid, &status, WNOHANG); -+ pid = waitpid(process->pid, &status, options); - while (pid == -1 && errno == EINTR); - -- if (pid == 0) -+#ifdef UV_USE_SIGCHLD -+ if (pid == 0) /* Not yet exited */ - continue; -+#endif - - if (pid == -1) { - if (errno != ECHILD) - abort(); -+ /* The child died, and we missed it. This probably means someone else -+ * stole the waitpid from us. Handle this by not handling it at all. */ - continue; - } - -+ assert(pid == process->pid); - process->status = status; - QUEUE_REMOVE(&process->queue); - QUEUE_INSERT_TAIL(&pending, &process->queue); -@@ -964,7 +985,7 @@ int uv_spawn(uv_loop_t* loop, - goto error; - } - --#if !(defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) -+#ifdef UV_USE_SIGCHLD - uv_signal_start(&loop->child_watcher, uv__chld, SIGCHLD); - #endif - -@@ -983,13 +1004,14 @@ int uv_spawn(uv_loop_t* loop, - * fail to open a stdio handle. This ensures we can eventually reap the child - * with waitpid. */ - if (exec_errorno == 0) { --#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -+#ifndef UV_USE_SIGCHLD - struct kevent event; - EV_SET(&event, pid, EVFILT_PROC, EV_ADD | EV_ONESHOT, NOTE_EXIT, 0, 0); - if (kevent(loop->backend_fd, &event, 1, NULL, 0, NULL)) { - if (errno != ESRCH) - abort(); - /* Process already exited. Call waitpid on the next loop iteration. */ -+ process->flags |= UV_HANDLE_REAP; - loop->flags |= UV_LOOP_REAP_CHILDREN; - } - #endif -diff --git a/deps/uv/src/uv-common.h b/deps/uv/src/uv-common.h -index 8a190bf8fa8c5a282feaf251aec2a30c95776888..6001b0cf68d0b0268b578218b664a737f43c9521 100644 ---- a/deps/uv/src/uv-common.h -+++ b/deps/uv/src/uv-common.h -@@ -130,7 +130,10 @@ enum { - UV_SIGNAL_ONE_SHOT = 0x02000000, - - /* Only used by uv_poll_t handles. */ -- UV_HANDLE_POLL_SLOW = 0x01000000 -+ UV_HANDLE_POLL_SLOW = 0x01000000, -+ -+ /* Only used by uv_process_t handles. */ -+ UV_HANDLE_REAP = 0x10000000 - }; - - int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap); diff --git a/patches/node/process_monitor_for_exit_with_kqueue_on_bsds_3441.patch b/patches/node/process_monitor_for_exit_with_kqueue_on_bsds_3441.patch deleted file mode 100644 index 38609025d0f79..0000000000000 --- a/patches/node/process_monitor_for_exit_with_kqueue_on_bsds_3441.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jeremy Rose -Date: Mon, 31 Jan 2022 11:49:22 -0800 -Subject: process: monitor for exit with kqueue on BSDs (#3441) - -This adds a workaround for an xnu kernel bug that sometimes results in -SIGCHLD not being delivered. The workaround is to use kevent to listen -for EVFILT_PROC/NOTE_EXIT events instead of relying on SIGCHLD on *BSD. - -Apple rdar: FB9529664 -Refs: https://github.com/libuv/libuv/pull/3257 - -diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h -index 12d4da93686e993830a7d09e74d08191fc808f4f..16be13b99f5db77741aa276e90a437ef4eb5ba32 100644 ---- a/deps/uv/src/unix/internal.h -+++ b/deps/uv/src/unix/internal.h -@@ -282,6 +282,7 @@ uv_handle_type uv__handle_type(int fd); - FILE* uv__open_file(const char* path); - int uv__getpwuid_r(uv_passwd_t* pwd); - int uv__search_path(const char* prog, char* buf, size_t* buflen); -+void uv__wait_children(uv_loop_t* loop); - - /* random */ - int uv__random_devurandom(void* buf, size_t buflen); -diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c -index 75e9110709da8d30628449311cb916a26c775ecf..efbc561dee2574f06ebd9408d1e89e435c93cc5a 100644 ---- a/deps/uv/src/unix/kqueue.c -+++ b/deps/uv/src/unix/kqueue.c -@@ -284,6 +284,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { - loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds; - for (i = 0; i < nfds; i++) { - ev = events + i; -+ if (ev->filter == EVFILT_PROC) { -+ uv__wait_children(loop); -+ nevents++; -+ continue; -+ } - fd = ev->ident; - /* Skip invalidated events, see uv__platform_invalidate_fd */ - if (fd == -1) -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index 91bf3c507022b2eddc0d36f40d73a977bf731fbc..c1f6bd4b0076f0835caf83c45a6a896e7ae5def9 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -49,10 +49,20 @@ extern char **environ; - # include "zos-base.h" - #endif - -+#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -+#include -+#endif -+ - -+#if !(defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) - static void uv__chld(uv_signal_t* handle, int signum) { -+ assert(signum == SIGCHLD); -+ uv__wait_children(handle->loop); -+} -+#endif -+ -+void uv__wait_children(uv_loop_t* loop) { - uv_process_t* process; -- uv_loop_t* loop; - int exit_status; - int term_signal; - int status; -@@ -61,10 +71,7 @@ static void uv__chld(uv_signal_t* handle, int signum) { - QUEUE* q; - QUEUE* h; - -- assert(signum == SIGCHLD); -- - QUEUE_INIT(&pending); -- loop = handle->loop; - - h = &loop->process_handles; - q = QUEUE_HEAD(h); -@@ -420,7 +427,9 @@ int uv_spawn(uv_loop_t* loop, - if (err) - goto error; - -+#if !(defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) - uv_signal_start(&loop->child_watcher, uv__chld, SIGCHLD); -+#endif - - /* Acquire write lock to prevent opening new fds in worker threads */ - uv_rwlock_wrlock(&loop->cloexec_lock); -@@ -495,6 +504,13 @@ int uv_spawn(uv_loop_t* loop, - - /* Only activate this handle if exec() happened successfully */ - if (exec_errorno == 0) { -+#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -+ struct kevent event; -+ EV_SET(&event, pid, EVFILT_PROC, EV_ADD | EV_ONESHOT, NOTE_EXIT, 0, 0); -+ if (kevent(loop->backend_fd, &event, 1, NULL, 0, NULL)) -+ abort(); -+#endif -+ - QUEUE_INSERT_TAIL(&loop->process_handles, &process->queue); - uv__handle_start(process); - } -diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h -index 1f566861a0e2e9e29c925972155f49667bb7ce85..a43edf1a4a9b0932ec73b8edaca0f676ecf3ccfa 100644 ---- a/deps/uv/test/test-list.h -+++ b/deps/uv/test/test-list.h -@@ -320,6 +320,7 @@ TEST_DECLARE (spawn_reads_child_path) - TEST_DECLARE (spawn_inherit_streams) - TEST_DECLARE (spawn_quoted_path) - TEST_DECLARE (spawn_tcp_server) -+TEST_DECLARE (spawn_exercise_sigchld_issue) - TEST_DECLARE (fs_poll) - TEST_DECLARE (fs_poll_getpath) - TEST_DECLARE (fs_poll_close_request) -@@ -950,6 +951,7 @@ TASK_LIST_START - TEST_ENTRY (spawn_inherit_streams) - TEST_ENTRY (spawn_quoted_path) - TEST_ENTRY (spawn_tcp_server) -+ TEST_ENTRY (spawn_exercise_sigchld_issue) - TEST_ENTRY (fs_poll) - TEST_ENTRY (fs_poll_getpath) - TEST_ENTRY (fs_poll_close_request) -diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c -index 9f2eb24b2d6daf339bec12027134409cfc3b4a82..dfd5458ef37c664af9a55a8383bdb3121885db3b 100644 ---- a/deps/uv/test/test-spawn.c -+++ b/deps/uv/test/test-spawn.c -@@ -1891,6 +1891,44 @@ TEST_IMPL(spawn_quoted_path) { - #endif - } - -+TEST_IMPL(spawn_exercise_sigchld_issue) { -+ int r; -+ int i; -+ uv_process_options_t dummy_options = {0}; -+ uv_process_t dummy_processes[100]; -+ char* args[2]; -+ -+ init_process_options("spawn_helper1", exit_cb); -+ -+ r = uv_spawn(uv_default_loop(), &process, &options); -+ ASSERT_EQ(r, 0); -+ -+ // This test exercises a bug in the darwin kernel that causes SIGCHLD not to -+ // be delivered sometimes. Calling posix_spawn many times increases the -+ // likelihood of encountering this issue, so spin a few times to make this -+ // test more reliable. -+ dummy_options.file = args[0] = "program-that-had-better-not-exist"; -+ args[1] = NULL; -+ dummy_options.args = args; -+ dummy_options.exit_cb = fail_cb; -+ dummy_options.flags = 0; -+ for (i = 0; i < 100; i++) { -+ r = uv_spawn(uv_default_loop(), &dummy_processes[i], &dummy_options); -+ if (r != UV_ENOENT) -+ ASSERT_EQ(r, UV_EACCES); -+ uv_close((uv_handle_t*) &dummy_processes[i], close_cb); -+ } -+ -+ r = uv_run(uv_default_loop(), UV_RUN_DEFAULT); -+ ASSERT_EQ(r, 0); -+ -+ ASSERT_EQ(exit_cb_called, 1); -+ ASSERT_EQ(close_cb_called, 101); -+ -+ MAKE_VALGRIND_HAPPY(); -+ return 0; -+} -+ - /* Helper for child process of spawn_inherit_streams */ - #ifndef _WIN32 - void spawn_stdin_stdout(void) { diff --git a/patches/node/process_only_use_f_dupfd_cloexec_if_it_is_defined_3512.patch b/patches/node/process_only_use_f_dupfd_cloexec_if_it_is_defined_3512.patch deleted file mode 100644 index 5b525fb18a5f0..0000000000000 --- a/patches/node/process_only_use_f_dupfd_cloexec_if_it_is_defined_3512.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jameson Nash -Date: Sat, 5 Mar 2022 12:52:04 -0500 -Subject: process: only use F_DUPFD_CLOEXEC if it is defined (#3512) - -We can save a syscall on most modern systems (required by POSIX 2008), -but not on all systems. - -Also handle errors from CLOEXEC. Even though fcntl does not really -define there to be any, it could theoretically be EBADF if the user -happened to pass a bad file descriptor to the same number fd (such that -no other code happened to already fail on that). - -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index d208f99be40df9f36447552daf2772c1cab1ce79..7705068730cb0536998bad7d304cb87df99b72e8 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -275,9 +275,20 @@ static void uv__process_child_init(const uv_process_options_t* options, - use_fd = pipes[fd][1]; - if (use_fd < 0 || use_fd >= fd) - continue; -+#ifdef F_DUPFD_CLOEXEC /* POSIX 2008 */ - pipes[fd][1] = fcntl(use_fd, F_DUPFD_CLOEXEC, stdio_count); -+#else -+ pipes[fd][1] = fcntl(use_fd, F_DUPFD, stdio_count); -+#endif - if (pipes[fd][1] == -1) - uv__write_errno(error_fd); -+#ifndef F_DUPFD_CLOEXEC /* POSIX 2008 */ -+ n = uv__cloexec_fcntl(pipes[fd][1], 1); -+ if (n) { -+ uv__write_int(error_fd, n); -+ _exit(127); -+ } -+#endif - } - - for (fd = 0; fd < stdio_count; fd++) { -@@ -300,8 +311,13 @@ static void uv__process_child_init(const uv_process_options_t* options, - } - - if (fd == use_fd) { -- if (close_fd == -1) -- uv__cloexec_fcntl(use_fd, 0); -+ if (close_fd == -1) { -+ n = uv__cloexec_fcntl(use_fd, 0); -+ if (n) { -+ uv__write_int(error_fd, n); -+ _exit(127); -+ } -+ } - } - else { - fd = dup2(use_fd, fd); diff --git a/patches/node/process_reset_the_signal_mask_if_the_fork_fails_3537.patch b/patches/node/process_reset_the_signal_mask_if_the_fork_fails_3537.patch deleted file mode 100644 index e0cd88c292b7e..0000000000000 --- a/patches/node/process_reset_the_signal_mask_if_the_fork_fails_3537.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jameson Nash -Date: Fri, 11 Mar 2022 12:05:24 -0500 -Subject: process: reset the signal mask if the fork fails (#3537) - -Fix a regression that sneaked into posix spawn changes. - -Refs: https://github.com/libuv/libuv/pull/3257 - -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index b85aa3b94edd040952e0d350a47a38d9ba8a67d3..d208f99be40df9f36447552daf2772c1cab1ce79 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -790,11 +790,6 @@ static int uv__spawn_and_init_child_fork(const uv_process_options_t* options, - - *pid = fork(); - -- if (*pid == -1) { -- /* Failed to fork */ -- return UV__ERR(errno); -- } -- - if (*pid == 0) { - /* Fork succeeded, in the child process */ - uv__process_child_init(options, stdio_count, pipes, error_fd); -@@ -804,6 +799,10 @@ static int uv__spawn_and_init_child_fork(const uv_process_options_t* options, - if (pthread_sigmask(SIG_SETMASK, &sigoldset, NULL) != 0) - abort(); - -+ if (*pid == -1) -+ /* Failed to fork */ -+ return UV__ERR(errno); -+ - /* Fork succeeded, in the parent process */ - return 0; - } diff --git a/patches/node/process_simplify_uv_write_int_calls_3519.patch b/patches/node/process_simplify_uv_write_int_calls_3519.patch deleted file mode 100644 index 201c9c949d49a..0000000000000 --- a/patches/node/process_simplify_uv_write_int_calls_3519.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jameson Nash -Date: Mon, 7 Mar 2022 17:07:49 -0500 -Subject: process: simplify uv__write_int calls (#3519) - -Refs https://github.com/libuv/libuv/pull/3519 - -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index b6f9756c6a6710f5f10762b9299cc35047b98097..8cde389b826b6b167437845eccd5fed440dcadc4 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -216,16 +216,14 @@ static void uv__write_int(int fd, int val) { - n = write(fd, &val, sizeof(val)); - while (n == -1 && errno == EINTR); - -- if (n == -1 && errno == EPIPE) -- return; /* parent process has quit */ -- -- assert(n == sizeof(val)); -+ /* The write might have failed (e.g. if the parent process has died), -+ * but we have nothing left but to _exit ourself now too. */ -+ _exit(127); - } - - - static void uv__write_errno(int error_fd) { - uv__write_int(error_fd, UV__ERR(errno)); -- _exit(127); - } - - -@@ -284,10 +282,8 @@ static void uv__process_child_init(const uv_process_options_t* options, - uv__write_errno(error_fd); - #ifndef F_DUPFD_CLOEXEC /* POSIX 2008 */ - n = uv__cloexec(pipes[fd][1], 1); -- if (n) { -+ if (n) - uv__write_int(error_fd, n); -- _exit(127); -- } - #endif - } - -@@ -313,10 +309,8 @@ static void uv__process_child_init(const uv_process_options_t* options, - if (fd == use_fd) { - if (close_fd == -1) { - n = uv__cloexec(use_fd, 0); -- if (n) { -+ if (n) - uv__write_int(error_fd, n); -- _exit(127); -- } - } - } - else { -@@ -368,7 +362,6 @@ static void uv__process_child_init(const uv_process_options_t* options, - #endif - - uv__write_errno(error_fd); -- abort(); - } - #endif - diff --git a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch index e82fcdf373a0e..954ce3be81245 100644 --- a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch +++ b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch @@ -7,7 +7,7 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were a real filesystem. diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js -index 108b11a2f960d2c7b0054b4d6d7a236c124ec9fe..83ac636db19a66f43fc7d3c1fc1e8290eeadd334 100644 +index cbca692e0ef458aad9beea30d04e1152e1fed5e5..9cf2c2d71208ad960f54965ddefa98bea51bfa6a 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -104,6 +104,10 @@ process.domain = null; @@ -18,14 +18,14 @@ index 108b11a2f960d2c7b0054b4d6d7a236c124ec9fe..83ac636db19a66f43fc7d3c1fc1e8290 +// internalBinding is not leaked to user code. +process.internalBinding = internalBinding; + - // process.config is serialized config.gypi - const nativeModule = internalBinding('builtins'); - + // TODO(@jasnell): Once this has gone through one full major + // release cycle, remove the Proxy and setter and update the + // getter to either return a read-only object or always return diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 7d780ed13412bb307435d98d4a8830a86dd72da1..5ea58cdbf5b1caa41ff3d1c7f4569d112974425f 100644 +index eb73c774118653c0746f78d4b72b31cb7c4f41f2..44e4c22ebf39fc9c52f789173a2cc50300bcd181 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -92,7 +92,7 @@ const fs = require('fs'); +@@ -94,7 +94,7 @@ const fs = require('fs'); const internalFS = require('internal/fs/utils'); const path = require('path'); const { sep } = path; @@ -34,7 +34,7 @@ index 7d780ed13412bb307435d98d4a8830a86dd72da1..5ea58cdbf5b1caa41ff3d1c7f4569d11 const packageJsonReader = require('internal/modules/package_json_reader'); const { safeGetenv } = internalBinding('credentials'); const { -@@ -168,7 +168,7 @@ function stat(filename) { +@@ -171,7 +171,7 @@ function stat(filename) { const result = statCache.get(filename); if (result !== undefined) return result; } diff --git a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch b/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch index 37d6fd07f371f..821271b0a3467 100644 --- a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch +++ b/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch @@ -7,10 +7,10 @@ Subject: refactor: alter child_process.fork to use execute script with When forking a child script, we setup a special environment to make the Electron binary run like the upstream node. On Mac, we use the helper app as node binary. diff --git a/lib/child_process.js b/lib/child_process.js -index 335de95ec06a9985821f3dbaee802ec319f1f013..73c1dc769542865bdf7a2a03c16cef141d3f4b05 100644 +index 55e6b781cd00699921bf138b757fc3555942646b..1bc5f92181a48e1ee37e59220ad11a755b20c9f4 100644 --- a/lib/child_process.js +++ b/lib/child_process.js -@@ -136,6 +136,16 @@ function fork(modulePath, args = [], options) { +@@ -137,7 +137,18 @@ function fork(modulePath, args = [], options) { validateObject(options, 'options'); } options = { ...options, shell: false }; @@ -25,5 +25,7 @@ index 335de95ec06a9985821f3dbaee802ec319f1f013..73c1dc769542865bdf7a2a03c16cef14 + } + options.execPath = options.execPath || process.execPath; ++ + validateArgumentNullCheck(options.execPath, 'options.execPath'); // Prepare arguments for fork: diff --git a/patches/node/reland_macos_use_posix_spawn_instead_of_fork_3257.patch b/patches/node/reland_macos_use_posix_spawn_instead_of_fork_3257.patch deleted file mode 100644 index cccbbf11736e0..0000000000000 --- a/patches/node/reland_macos_use_posix_spawn_instead_of_fork_3257.patch +++ /dev/null @@ -1,889 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jameson Nash -Date: Wed, 2 Mar 2022 15:15:39 -0500 -Subject: Reland "macos: use posix_spawn instead of fork" (#3257) - -Fixes: https://github.com/libuv/libuv/issues/3050 -Refs: https://github.com/libuv/libuv/issues/3086 -Refs: https://github.com/libuv/libuv/pull/3064 -Refs: https://github.com/libuv/libuv/pull/3107 -Refs: https://github.com/libuv/libuv/pull/3064 - -This reverts commit 217fdf4265589889d00c7c0622fde2710971a020, then fixes -several issues with it: - -* remove error fast-cleanup code that triggers a nodejs bug - -Refs: https://github.com/libuv/libuv/pull/3107#issuecomment-782482608 - -* protect posix_spawn from EINTR - -This is not a documented valid error, but seems to have been observed. - -* ignore setuid/setgid syscall - -This kernel function is not permitted unless the process is setuid root, -so disable this syscall. Falling back to fork/exec should be okay for -the rare cases that the user decides they need to do setuid(getuid()) or -setuid(geteuid()) for the child. - -Refs: https://github.com/libuv/libuv/pull/3107#issuecomment-782482608 - -* improve posix_spawn path search - -Ports the improvements in musl back to this function - -* fix some additional problems and formatting issues - -We previously might fail to start a watcher, in rare failure cases, -resulting in a zombie that we would fail to kill. Also avoid creating -the signal-pipe unless required (addresses a review comment from Apple) - -* fix fd->fd mapping reuse - -There was a chance that when duplicating the fd's into stdio_count+fd we -might be closing a currently opened fd with that value. - -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index 2920b942962357827bae9bcad23af8333e8b007f..b85aa3b94edd040952e0d350a47a38d9ba8a67d3 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -35,8 +36,21 @@ - #include - - #if defined(__APPLE__) && !TARGET_OS_IPHONE -+# include -+# include -+# include -+# include -+# include -+# include - # include -+# include - # define environ (*_NSGetEnviron()) -+ -+/* macOS 10.14 back does not define this constant */ -+# ifndef POSIX_SPAWN_SETSID -+# define POSIX_SPAWN_SETSID 1024 -+# endif -+ - #else - extern char **environ; - #endif -@@ -261,22 +275,22 @@ static void uv__process_child_init(const uv_process_options_t* options, - use_fd = pipes[fd][1]; - if (use_fd < 0 || use_fd >= fd) - continue; -- pipes[fd][1] = fcntl(use_fd, F_DUPFD, stdio_count); -+ pipes[fd][1] = fcntl(use_fd, F_DUPFD_CLOEXEC, stdio_count); - if (pipes[fd][1] == -1) - uv__write_errno(error_fd); - } - - for (fd = 0; fd < stdio_count; fd++) { -- close_fd = pipes[fd][0]; -+ close_fd = -1; - use_fd = pipes[fd][1]; - - if (use_fd < 0) { - if (fd >= 3) - continue; - else { -- /* redirect stdin, stdout and stderr to /dev/null even if UV_IGNORE is -- * set -- */ -+ /* Redirect stdin, stdout and stderr to /dev/null even if UV_IGNORE is -+ * set. */ -+ uv__close_nocheckstdio(fd); /* Free up fd, if it happens to be open. */ - use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR); - close_fd = use_fd; - -@@ -285,28 +299,24 @@ static void uv__process_child_init(const uv_process_options_t* options, - } - } - -- if (fd == use_fd) -- uv__cloexec_fcntl(use_fd, 0); -- else -+ if (fd == use_fd) { -+ if (close_fd == -1) -+ uv__cloexec_fcntl(use_fd, 0); -+ } -+ else { - fd = dup2(use_fd, fd); -+ } - - if (fd == -1) - uv__write_errno(error_fd); - -- if (fd <= 2) -+ if (fd <= 2 && close_fd == -1) - uv__nonblock_fcntl(fd, 0); - - if (close_fd >= stdio_count) - uv__close(close_fd); - } - -- for (fd = 0; fd < stdio_count; fd++) { -- use_fd = pipes[fd][1]; -- -- if (use_fd >= stdio_count) -- uv__close(use_fd); -- } -- - if (options->cwd != NULL && chdir(options->cwd)) - uv__write_errno(error_fd); - -@@ -327,9 +337,8 @@ static void uv__process_child_init(const uv_process_options_t* options, - if ((options->flags & UV_PROCESS_SETUID) && setuid(options->uid)) - uv__write_errno(error_fd); - -- if (options->env != NULL) { -+ if (options->env != NULL) - environ = options->env; -- } - - /* Reset signal mask just before exec. */ - sigemptyset(&signewset); -@@ -348,6 +357,562 @@ static void uv__process_child_init(const uv_process_options_t* options, - #endif - - -+#if defined(__APPLE__) -+typedef struct uv__posix_spawn_fncs_tag { -+ struct { -+ int (*addchdir_np)(const posix_spawn_file_actions_t *, const char *); -+ } file_actions; -+} uv__posix_spawn_fncs_t; -+ -+ -+static uv_once_t posix_spawn_init_once = UV_ONCE_INIT; -+static uv__posix_spawn_fncs_t posix_spawn_fncs; -+static int posix_spawn_can_use_setsid; -+ -+ -+static void uv__spawn_init_posix_spawn_fncs(void) { -+ /* Try to locate all non-portable functions at runtime */ -+ posix_spawn_fncs.file_actions.addchdir_np = -+ dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np"); -+} -+ -+ -+static void uv__spawn_init_can_use_setsid(void) { -+ static const int MACOS_CATALINA_VERSION_MAJOR = 19; -+ char version_str[256]; -+ char* version_major_str; -+ size_t version_str_size = 256; -+ int r; -+ int version_major; -+ -+ /* Get a version string */ -+ r = sysctlbyname("kern.osrelease", version_str, &version_str_size, NULL, 0); -+ if (r != 0) -+ return; -+ -+ /* Try to get the major version number. If not found -+ * fall back to the fork/exec flow */ -+ version_major_str = strtok(version_str, "."); -+ if (version_major_str == NULL) -+ return; -+ -+ /* Parse the version major as a number. If it is greater than -+ * the major version for macOS Catalina (aka macOS 10.15), then -+ * the POSIX_SPAWN_SETSID flag is available */ -+ version_major = atoi_l(version_major_str, NULL); /* Use LC_C_LOCALE */ -+ if (version_major >= MACOS_CATALINA_VERSION_MAJOR) -+ posix_spawn_can_use_setsid = 1; -+} -+ -+ -+static void uv__spawn_init_posix_spawn(void) { -+ /* Init handles to all potentially non-defined functions */ -+ uv__spawn_init_posix_spawn_fncs(); -+ -+ /* Init feature detection for POSIX_SPAWN_SETSID flag */ -+ uv__spawn_init_can_use_setsid(); -+} -+ -+ -+static int uv__spawn_set_posix_spawn_attrs( -+ posix_spawnattr_t* attrs, -+ const uv__posix_spawn_fncs_t* posix_spawn_fncs, -+ const uv_process_options_t* options) { -+ int err; -+ unsigned int flags; -+ sigset_t signal_set; -+ -+ err = posix_spawnattr_init(attrs); -+ if (err != 0) { -+ /* If initialization fails, no need to de-init, just return */ -+ return err; -+ } -+ -+ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) { -+ /* kauth_cred_issuser currently requires exactly uid == 0 for these -+ * posixspawn_attrs (set_groups_np, setuid_np, setgid_np), which deviates -+ * from the normal specification of setuid (which also uses euid), and they -+ * are also undocumented syscalls, so we do not use them. */ -+ err = ENOSYS; -+ goto error; -+ } -+ -+ /* Set flags for spawn behavior -+ * 1) POSIX_SPAWN_CLOEXEC_DEFAULT: (Apple Extension) All descriptors in the -+ * parent will be treated as if they had been created with O_CLOEXEC. The -+ * only fds that will be passed on to the child are those manipulated by -+ * the file actions -+ * 2) POSIX_SPAWN_SETSIGDEF: Signals mentioned in spawn-sigdefault in the -+ * spawn attributes will be reset to behave as their default -+ * 3) POSIX_SPAWN_SETSIGMASK: Signal mask will be set to the value of -+ * spawn-sigmask in attributes -+ * 4) POSIX_SPAWN_SETSID: Make the process a new session leader if a detached -+ * session was requested. */ -+ flags = POSIX_SPAWN_CLOEXEC_DEFAULT | -+ POSIX_SPAWN_SETSIGDEF | -+ POSIX_SPAWN_SETSIGMASK; -+ if (options->flags & UV_PROCESS_DETACHED) { -+ /* If running on a version of macOS where this flag is not supported, -+ * revert back to the fork/exec flow. Otherwise posix_spawn will -+ * silently ignore the flag. */ -+ if (!posix_spawn_can_use_setsid) { -+ err = ENOSYS; -+ goto error; -+ } -+ -+ flags |= POSIX_SPAWN_SETSID; -+ } -+ err = posix_spawnattr_setflags(attrs, flags); -+ if (err != 0) -+ goto error; -+ -+ /* Reset all signal the child to their default behavior */ -+ sigfillset(&signal_set); -+ err = posix_spawnattr_setsigdefault(attrs, &signal_set); -+ if (err != 0) -+ goto error; -+ -+ /* Reset the signal mask for all signals */ -+ sigemptyset(&signal_set); -+ err = posix_spawnattr_setsigmask(attrs, &signal_set); -+ if (err != 0) -+ goto error; -+ -+ return err; -+ -+error: -+ (void) posix_spawnattr_destroy(attrs); -+ return err; -+} -+ -+ -+static int uv__spawn_set_posix_spawn_file_actions( -+ posix_spawn_file_actions_t* actions, -+ const uv__posix_spawn_fncs_t* posix_spawn_fncs, -+ const uv_process_options_t* options, -+ int stdio_count, -+ int (*pipes)[2]) { -+ int fd; -+ int fd2; -+ int use_fd; -+ int err; -+ -+ err = posix_spawn_file_actions_init(actions); -+ if (err != 0) { -+ /* If initialization fails, no need to de-init, just return */ -+ return err; -+ } -+ -+ /* Set the current working directory if requested */ -+ if (options->cwd != NULL) { -+ if (posix_spawn_fncs->file_actions.addchdir_np == NULL) { -+ err = ENOSYS; -+ goto error; -+ } -+ -+ err = posix_spawn_fncs->file_actions.addchdir_np(actions, options->cwd); -+ if (err != 0) -+ goto error; -+ } -+ -+ /* Do not return ENOSYS after this point, as we may mutate pipes. */ -+ -+ /* First duplicate low numbered fds, since it's not safe to duplicate them, -+ * they could get replaced. Example: swapping stdout and stderr; without -+ * this fd 2 (stderr) would be duplicated into fd 1, thus making both -+ * stdout and stderr go to the same fd, which was not the intention. */ -+ for (fd = 0; fd < stdio_count; fd++) { -+ use_fd = pipes[fd][1]; -+ if (use_fd < 0 || use_fd >= fd) -+ continue; -+ use_fd = stdio_count; -+ for (fd2 = 0; fd2 < stdio_count; fd2++) { -+ /* If we were not setting POSIX_SPAWN_CLOEXEC_DEFAULT, we would need to -+ * also consider whether fcntl(fd, F_GETFD) returned without the -+ * FD_CLOEXEC flag set. */ -+ if (pipes[fd2][1] == use_fd) { -+ use_fd++; -+ fd2 = 0; -+ } -+ } -+ err = posix_spawn_file_actions_adddup2( -+ actions, -+ pipes[fd][1], -+ use_fd); -+ assert(err != ENOSYS); -+ if (err != 0) -+ goto error; -+ pipes[fd][1] = use_fd; -+ } -+ -+ /* Second, move the descriptors into their respective places */ -+ for (fd = 0; fd < stdio_count; fd++) { -+ use_fd = pipes[fd][1]; -+ if (use_fd < 0) { -+ if (fd >= 3) -+ continue; -+ else { -+ /* If ignored, redirect to (or from) /dev/null, */ -+ err = posix_spawn_file_actions_addopen( -+ actions, -+ fd, -+ "/dev/null", -+ fd == 0 ? O_RDONLY : O_RDWR, -+ 0); -+ assert(err != ENOSYS); -+ if (err != 0) -+ goto error; -+ continue; -+ } -+ } -+ -+ if (fd == use_fd) -+ err = posix_spawn_file_actions_addinherit_np(actions, fd); -+ else -+ err = posix_spawn_file_actions_adddup2(actions, use_fd, fd); -+ assert(err != ENOSYS); -+ if (err != 0) -+ goto error; -+ -+ /* Make sure the fd is marked as non-blocking (state shared between child -+ * and parent). */ -+ uv__nonblock_fcntl(use_fd, 0); -+ } -+ -+ /* Finally, close all the superfluous descriptors */ -+ for (fd = 0; fd < stdio_count; fd++) { -+ use_fd = pipes[fd][1]; -+ if (use_fd < stdio_count) -+ continue; -+ -+ /* Check if we already closed this. */ -+ for (fd2 = 0; fd2 < fd; fd2++) { -+ if (pipes[fd2][1] == use_fd) -+ break; -+ } -+ if (fd2 < fd) -+ continue; -+ -+ err = posix_spawn_file_actions_addclose(actions, use_fd); -+ assert(err != ENOSYS); -+ if (err != 0) -+ goto error; -+ } -+ -+ return 0; -+ -+error: -+ (void) posix_spawn_file_actions_destroy(actions); -+ return err; -+} -+ -+char* uv__spawn_find_path_in_env(char** env) { -+ char** env_iterator; -+ const char path_var[] = "PATH="; -+ -+ /* Look for an environment variable called PATH in the -+ * provided env array, and return its value if found */ -+ for (env_iterator = env; *env_iterator != NULL; env_iterator++) { -+ if (strncmp(*env_iterator, path_var, sizeof(path_var) - 1) == 0) { -+ /* Found "PATH=" at the beginning of the string */ -+ return *env_iterator + sizeof(path_var) - 1; -+ } -+ } -+ -+ return NULL; -+} -+ -+ -+static int uv__spawn_resolve_and_spawn(const uv_process_options_t* options, -+ posix_spawnattr_t* attrs, -+ posix_spawn_file_actions_t* actions, -+ pid_t* pid) { -+ const char *p; -+ const char *z; -+ const char *path; -+ size_t l; -+ size_t k; -+ int err; -+ int seen_eacces; -+ -+ path = NULL; -+ err = -1; -+ seen_eacces = 0; -+ -+ /* Short circuit for erroneous case */ -+ if (options->file == NULL) -+ return ENOENT; -+ -+ /* The environment for the child process is that of the parent unless overriden -+ * by options->env */ -+ char** env = environ; -+ if (options->env != NULL) -+ env = options->env; -+ -+ /* If options->file contains a slash, posix_spawn/posix_spawnp behave -+ * the same, and don't involve PATH resolution at all. Otherwise, if -+ * options->file does not include a slash, but no custom environment is -+ * to be used, the environment used for path resolution as well for the -+ * child process is that of the parent process, so posix_spawnp is the -+ * way to go. */ -+ if (strchr(options->file, '/') != NULL || options->env == NULL) { -+ do -+ err = posix_spawnp(pid, options->file, actions, attrs, options->args, env); -+ while (err == EINTR); -+ return err; -+ } -+ -+ /* Look for the definition of PATH in the provided env */ -+ path = uv__spawn_find_path_in_env(options->env); -+ -+ /* The following resolution logic (execvpe emulation) is copied from -+ * https://git.musl-libc.org/cgit/musl/tree/src/process/execvp.c -+ * and adapted to work for our specific usage */ -+ -+ /* If no path was provided in options->env, use the default value -+ * to look for the executable */ -+ if (path == NULL) -+ path = _PATH_DEFPATH; -+ -+ k = strnlen(options->file, NAME_MAX + 1); -+ if (k > NAME_MAX) -+ return ENAMETOOLONG; -+ -+ l = strnlen(path, PATH_MAX - 1) + 1; -+ -+ for (p = path;; p = z) { -+ /* Compose the new process file from the entry in the PATH -+ * environment variable and the actual file name */ -+ char b[PATH_MAX + NAME_MAX]; -+ z = strchr(p, ':'); -+ if (!z) -+ z = p + strlen(p); -+ if ((size_t)(z - p) >= l) { -+ if (!*z++) -+ break; -+ -+ continue; -+ } -+ memcpy(b, p, z - p); -+ b[z - p] = '/'; -+ memcpy(b + (z - p) + (z > p), options->file, k + 1); -+ -+ /* Try to spawn the new process file. If it fails with ENOENT, the -+ * new process file is not in this PATH entry, continue with the next -+ * PATH entry. */ -+ do -+ err = posix_spawn(pid, b, actions, attrs, options->args, env); -+ while (err == EINTR); -+ -+ switch (err) { -+ case EACCES: -+ seen_eacces = 1; -+ break; /* continue search */ -+ case ENOENT: -+ case ENOTDIR: -+ break; /* continue search */ -+ default: -+ return err; -+ } -+ -+ if (!*z++) -+ break; -+ } -+ -+ if (seen_eacces) -+ return EACCES; -+ return err; -+} -+ -+ -+static int uv__spawn_and_init_child_posix_spawn( -+ const uv_process_options_t* options, -+ int stdio_count, -+ int (*pipes)[2], -+ pid_t* pid, -+ const uv__posix_spawn_fncs_t* posix_spawn_fncs) { -+ int err; -+ posix_spawnattr_t attrs; -+ posix_spawn_file_actions_t actions; -+ -+ err = uv__spawn_set_posix_spawn_attrs(&attrs, posix_spawn_fncs, options); -+ if (err != 0) -+ goto error; -+ -+ /* This may mutate pipes. */ -+ err = uv__spawn_set_posix_spawn_file_actions(&actions, -+ posix_spawn_fncs, -+ options, -+ stdio_count, -+ pipes); -+ if (err != 0) { -+ (void) posix_spawnattr_destroy(&attrs); -+ goto error; -+ } -+ -+ /* Try to spawn options->file resolving in the provided environment -+ * if any */ -+ err = uv__spawn_resolve_and_spawn(options, &attrs, &actions, pid); -+ assert(err != ENOSYS); -+ -+ /* Destroy the actions/attributes */ -+ (void) posix_spawn_file_actions_destroy(&actions); -+ (void) posix_spawnattr_destroy(&attrs); -+ -+error: -+ /* In an error situation, the attributes and file actions are -+ * already destroyed, only the happy path requires cleanup */ -+ return UV__ERR(err); -+} -+#endif -+ -+static int uv__spawn_and_init_child_fork(const uv_process_options_t* options, -+ int stdio_count, -+ int (*pipes)[2], -+ int error_fd, -+ pid_t* pid) { -+ sigset_t signewset; -+ sigset_t sigoldset; -+ -+ /* Start the child with most signals blocked, to avoid any issues before we -+ * can reset them, but allow program failures to exit (and not hang). */ -+ sigfillset(&signewset); -+ sigdelset(&signewset, SIGKILL); -+ sigdelset(&signewset, SIGSTOP); -+ sigdelset(&signewset, SIGTRAP); -+ sigdelset(&signewset, SIGSEGV); -+ sigdelset(&signewset, SIGBUS); -+ sigdelset(&signewset, SIGILL); -+ sigdelset(&signewset, SIGSYS); -+ sigdelset(&signewset, SIGABRT); -+ if (pthread_sigmask(SIG_BLOCK, &signewset, &sigoldset) != 0) -+ abort(); -+ -+ *pid = fork(); -+ -+ if (*pid == -1) { -+ /* Failed to fork */ -+ return UV__ERR(errno); -+ } -+ -+ if (*pid == 0) { -+ /* Fork succeeded, in the child process */ -+ uv__process_child_init(options, stdio_count, pipes, error_fd); -+ abort(); -+ } -+ -+ if (pthread_sigmask(SIG_SETMASK, &sigoldset, NULL) != 0) -+ abort(); -+ -+ /* Fork succeeded, in the parent process */ -+ return 0; -+} -+ -+static int uv__spawn_and_init_child( -+ uv_loop_t* loop, -+ const uv_process_options_t* options, -+ int stdio_count, -+ int (*pipes)[2], -+ pid_t* pid) { -+ int signal_pipe[2] = { -1, -1 }; -+ int status; -+ int err; -+ int exec_errorno; -+ ssize_t r; -+ -+#if defined(__APPLE__) -+ uv_once(&posix_spawn_init_once, uv__spawn_init_posix_spawn); -+ -+ /* Special child process spawn case for macOS Big Sur (11.0) onwards -+ * -+ * Big Sur introduced a significant performance degradation on a call to -+ * fork/exec when the process has many pages mmaped in with MAP_JIT, like, say -+ * a javascript interpreter. Electron-based applications, for example, -+ * are impacted; though the magnitude of the impact depends on how much the -+ * app relies on subprocesses. -+ * -+ * On macOS, though, posix_spawn is implemented in a way that does not -+ * exhibit the problem. This block implements the forking and preparation -+ * logic with posix_spawn and its related primitives. It also takes advantage of -+ * the macOS extension POSIX_SPAWN_CLOEXEC_DEFAULT that makes impossible to -+ * leak descriptors to the child process. */ -+ err = uv__spawn_and_init_child_posix_spawn(options, -+ stdio_count, -+ pipes, -+ pid, -+ &posix_spawn_fncs); -+ -+ /* The posix_spawn flow will return UV_ENOSYS if any of the posix_spawn_x_np -+ * non-standard functions is both _needed_ and _undefined_. In those cases, -+ * default back to the fork/execve strategy. For all other errors, just fail. */ -+ if (err != UV_ENOSYS) -+ return err; -+ -+#endif -+ -+ /* This pipe is used by the parent to wait until -+ * the child has called `execve()`. We need this -+ * to avoid the following race condition: -+ * -+ * if ((pid = fork()) > 0) { -+ * kill(pid, SIGTERM); -+ * } -+ * else if (pid == 0) { -+ * execve("/bin/cat", argp, envp); -+ * } -+ * -+ * The parent sends a signal immediately after forking. -+ * Since the child may not have called `execve()` yet, -+ * there is no telling what process receives the signal, -+ * our fork or /bin/cat. -+ * -+ * To avoid ambiguity, we create a pipe with both ends -+ * marked close-on-exec. Then, after the call to `fork()`, -+ * the parent polls the read end until it EOFs or errors with EPIPE. -+ */ -+ err = uv__make_pipe(signal_pipe, 0); -+ if (err) -+ return err; -+ -+ /* Acquire write lock to prevent opening new fds in worker threads */ -+ uv_rwlock_wrlock(&loop->cloexec_lock); -+ -+ err = uv__spawn_and_init_child_fork(options, stdio_count, pipes, signal_pipe[1], pid); -+ -+ /* Release lock in parent process */ -+ uv_rwlock_wrunlock(&loop->cloexec_lock); -+ -+ uv__close(signal_pipe[1]); -+ -+ if (err == 0) { -+ do -+ r = read(signal_pipe[0], &exec_errorno, sizeof(exec_errorno)); -+ while (r == -1 && errno == EINTR); -+ -+ if (r == 0) -+ ; /* okay, EOF */ -+ else if (r == sizeof(exec_errorno)) { -+ do -+ err = waitpid(*pid, &status, 0); /* okay, read errorno */ -+ while (err == -1 && errno == EINTR); -+ assert(err == *pid); -+ err = exec_errorno; -+ } else if (r == -1 && errno == EPIPE) { -+ /* Something unknown happened to our child before spawn */ -+ do -+ err = waitpid(*pid, &status, 0); /* okay, got EPIPE */ -+ while (err == -1 && errno == EINTR); -+ assert(err == *pid); -+ err = UV_EPIPE; -+ } else -+ abort(); -+ } -+ -+ uv__close_nocheckstdio(signal_pipe[0]); -+ -+ return err; -+} -+ - int uv_spawn(uv_loop_t* loop, - uv_process_t* process, - const uv_process_options_t* options) { -@@ -355,18 +920,13 @@ int uv_spawn(uv_loop_t* loop, - /* fork is marked __WATCHOS_PROHIBITED __TVOS_PROHIBITED. */ - return UV_ENOSYS; - #else -- sigset_t signewset; -- sigset_t sigoldset; -- int signal_pipe[2] = { -1, -1 }; - int pipes_storage[8][2]; - int (*pipes)[2]; - int stdio_count; -- ssize_t r; - pid_t pid; - int err; - int exec_errorno; - int i; -- int status; - - assert(options->file != NULL); - assert(!(options->flags & ~(UV_PROCESS_DETACHED | -@@ -379,6 +939,7 @@ int uv_spawn(uv_loop_t* loop, - - uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS); - QUEUE_INIT(&process->queue); -+ process->status = 0; - - stdio_count = options->stdio_count; - if (stdio_count < 3) -@@ -403,106 +964,24 @@ int uv_spawn(uv_loop_t* loop, - goto error; - } - -- /* This pipe is used by the parent to wait until -- * the child has called `execve()`. We need this -- * to avoid the following race condition: -- * -- * if ((pid = fork()) > 0) { -- * kill(pid, SIGTERM); -- * } -- * else if (pid == 0) { -- * execve("/bin/cat", argp, envp); -- * } -- * -- * The parent sends a signal immediately after forking. -- * Since the child may not have called `execve()` yet, -- * there is no telling what process receives the signal, -- * our fork or /bin/cat. -- * -- * To avoid ambiguity, we create a pipe with both ends -- * marked close-on-exec. Then, after the call to `fork()`, -- * the parent polls the read end until it EOFs or errors with EPIPE. -- */ -- err = uv__make_pipe(signal_pipe, 0); -- if (err) -- goto error; -- - #if !(defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) - uv_signal_start(&loop->child_watcher, uv__chld, SIGCHLD); - #endif - -- /* Acquire write lock to prevent opening new fds in worker threads */ -- uv_rwlock_wrlock(&loop->cloexec_lock); -- -- /* Start the child with most signals blocked, to avoid any issues before we -- * can reset them, but allow program failures to exit (and not hang). */ -- sigfillset(&signewset); -- sigdelset(&signewset, SIGKILL); -- sigdelset(&signewset, SIGSTOP); -- sigdelset(&signewset, SIGTRAP); -- sigdelset(&signewset, SIGSEGV); -- sigdelset(&signewset, SIGBUS); -- sigdelset(&signewset, SIGILL); -- sigdelset(&signewset, SIGSYS); -- sigdelset(&signewset, SIGABRT); -- if (pthread_sigmask(SIG_BLOCK, &signewset, &sigoldset) != 0) -- abort(); -- -- pid = fork(); -- if (pid == -1) -- err = UV__ERR(errno); -- -- if (pid == 0) -- uv__process_child_init(options, stdio_count, pipes, signal_pipe[1]); -+ /* Spawn the child */ -+ exec_errorno = uv__spawn_and_init_child(loop, options, stdio_count, pipes, &pid); - -- if (pthread_sigmask(SIG_SETMASK, &sigoldset, NULL) != 0) -- abort(); -- -- /* Release lock in parent process */ -- uv_rwlock_wrunlock(&loop->cloexec_lock); -- -- uv__close(signal_pipe[1]); -- -- if (pid == -1) { -- uv__close(signal_pipe[0]); -- goto error; -- } -- -- process->status = 0; -- exec_errorno = 0; -- do -- r = read(signal_pipe[0], &exec_errorno, sizeof(exec_errorno)); -- while (r == -1 && errno == EINTR); -- -- if (r == 0) -- ; /* okay, EOF */ -- else if (r == sizeof(exec_errorno)) { -- do -- err = waitpid(pid, &status, 0); /* okay, read errorno */ -- while (err == -1 && errno == EINTR); -- assert(err == pid); -- } else if (r == -1 && errno == EPIPE) { -- do -- err = waitpid(pid, &status, 0); /* okay, got EPIPE */ -- while (err == -1 && errno == EINTR); -- assert(err == pid); -- } else -- abort(); -- -- uv__close_nocheckstdio(signal_pipe[0]); -- -- for (i = 0; i < options->stdio_count; i++) { -- err = uv__process_open_stream(options->stdio + i, pipes[i]); -- if (err == 0) -- continue; -- -- while (i--) -- uv__process_close_stream(options->stdio + i); -- -- goto error; -- } -+#if 0 -+ /* This runs into a nodejs issue (it expects initialized streams, even if the -+ * exec failed). -+ * See https://github.com/libuv/libuv/pull/3107#issuecomment-782482608 */ -+ if (exec_errorno != 0) -+ goto error; -+#endif - -- /* Only activate this handle if exec() happened successfully */ -+ /* Activate this handle if exec() happened successfully, even if we later -+ * fail to open a stdio handle. This ensures we can eventually reap the child -+ * with waitpid. */ - if (exec_errorno == 0) { - #if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) - struct kevent event; -@@ -515,12 +994,22 @@ int uv_spawn(uv_loop_t* loop, - } - #endif - -+ process->pid = pid; -+ process->exit_cb = options->exit_cb; - QUEUE_INSERT_TAIL(&loop->process_handles, &process->queue); - uv__handle_start(process); - } - -- process->pid = pid; -- process->exit_cb = options->exit_cb; -+ for (i = 0; i < options->stdio_count; i++) { -+ err = uv__process_open_stream(options->stdio + i, pipes[i]); -+ if (err == 0) -+ continue; -+ -+ while (i--) -+ uv__process_close_stream(options->stdio + i); -+ -+ goto error; -+ } - - if (pipes != pipes_storage) - uv__free(pipes); diff --git a/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch b/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch index 1eb1e9bd2045e..b24b7d4ce50e3 100644 --- a/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch +++ b/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch @@ -25,7 +25,7 @@ index a771b1813731edf4f0dd60f3505799e389f1d876..b9461677e2d7d1df192e752496e62cca bench.start(); for (let i = 0; i < n; i++) diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js -index cd9ca227b9cac4ff021ce1643000ea4b45163df6..0846afec28ab5fb507eb5f3eb211f635d61dca17 100644 +index fe2e132af1166a05c3e94cdae362dd46f62bf65b..caa9214fa30a715a5eea00e7fc3b091e40c07131 100644 --- a/lib/internal/main/worker_thread.js +++ b/lib/internal/main/worker_thread.js @@ -10,7 +10,7 @@ const { @@ -37,7 +37,7 @@ index cd9ca227b9cac4ff021ce1643000ea4b45163df6..0846afec28ab5fb507eb5f3eb211f635 } = primordials; const { -@@ -157,6 +157,8 @@ port.on('message', (message) => { +@@ -113,6 +113,8 @@ port.on('message', (message) => { process.cwd = function() { const currentCounter = Atomics.load(cwdCounter, 0); diff --git a/patches/node/src_iwyu_in_cleanup_queue_cc.patch b/patches/node/src_iwyu_in_cleanup_queue_cc.patch deleted file mode 100644 index 2554390c32c5a..0000000000000 --- a/patches/node/src_iwyu_in_cleanup_queue_cc.patch +++ /dev/null @@ -1,17 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Wed, 12 Oct 2022 21:28:57 +0200 -Subject: src: iwyu in cleanup_queue.cc - -Upstreamed in https://github.com/nodejs/node/pull/44983. - -diff --git a/src/cleanup_queue.cc b/src/cleanup_queue.cc -index 5235513f16c2574a88675d5a2f19d9cae3c417ac..6290b6796c532702fb5e7549ff0c3ad14d2b89d8 100644 ---- a/src/cleanup_queue.cc -+++ b/src/cleanup_queue.cc -@@ -1,4 +1,5 @@ - #include "cleanup_queue.h" // NOLINT(build/include_inline) -+#include - #include - #include "cleanup_queue-inl.h" - diff --git a/patches/node/support_v8_sandboxed_pointers.patch b/patches/node/support_v8_sandboxed_pointers.patch index feb7dbd5029dc..9855b3539c62b 100644 --- a/patches/node/support_v8_sandboxed_pointers.patch +++ b/patches/node/support_v8_sandboxed_pointers.patch @@ -7,10 +7,10 @@ This refactors several allocators to allocate within the V8 memory cage, allowing them to be compatible with the V8_SANDBOXED_POINTERS feature. diff --git a/src/api/environment.cc b/src/api/environment.cc -index 8a7ad50b818448fa14eb4707c1dcec2a1339d2db..b6981c37d5b286e22f24d11751eb05f72ca27619 100644 +index 2e6f4a5c4b894a7425db110b3aadbe734f137327..c0c422e969543dcd570dabfd8ff0755abe37face 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -82,6 +82,14 @@ MaybeLocal PrepareStackTraceCallback(Local context, +@@ -86,6 +86,14 @@ MaybeLocal PrepareStackTraceCallback(Local context, return result; } @@ -26,10 +26,10 @@ index 8a7ad50b818448fa14eb4707c1dcec2a1339d2db..b6981c37d5b286e22f24d11751eb05f7 void* ret; if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers) diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 4ea6d851450c46659e7e19f50c614419a46b30c0..64c1639142f40962209901bd84b3f349be855ea0 100644 +index 1fe573cd7b6894743a0986e87802960ad09e2dd9..ff1346f65f3c280da9962df87eb0710a3077ed03 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -326,10 +326,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { +@@ -324,10 +324,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { return *this; } @@ -66,7 +66,7 @@ index 4ea6d851450c46659e7e19f50c614419a46b30c0..64c1639142f40962209901bd84b3f349 std::unique_ptr ptr = ArrayBuffer::NewBackingStore( allocated_data_, size(), -@@ -341,10 +366,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { +@@ -339,10 +364,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { data_ = nullptr; size_ = 0; return ptr; @@ -79,7 +79,7 @@ index 4ea6d851450c46659e7e19f50c614419a46b30c0..64c1639142f40962209901bd84b3f349 return ArrayBuffer::New(env->isolate(), std::move(store)); } -@@ -673,6 +699,16 @@ namespace { +@@ -671,6 +697,16 @@ namespace { // in which case this has the same semantics as // using OPENSSL_malloc. However, if the secure heap is // initialized, SecureBuffer will automatically use it. @@ -96,7 +96,7 @@ index 4ea6d851450c46659e7e19f50c614419a46b30c0..64c1639142f40962209901bd84b3f349 void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); -@@ -694,6 +730,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -692,6 +728,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { Local buffer = ArrayBuffer::New(env->isolate(), store); args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); } @@ -105,7 +105,7 @@ index 4ea6d851450c46659e7e19f50c614419a46b30c0..64c1639142f40962209901bd84b3f349 void SecureHeapUsed(const FunctionCallbackInfo& args) { #ifndef OPENSSL_IS_BORINGSSL diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h -index 7f83d6d1919df55e2e9274afa95b17c8bada1158..0949f7fd1cbd5ab46a4cb9b44598aea4924b6429 100644 +index 716b40be50cdc2ebbd249e5a9d562385169f77ad..271b8b9c0e4b2b613fdc82c4ed0e7bc7cb9bba4f 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h @@ -279,7 +279,7 @@ class ByteSource { @@ -118,7 +118,7 @@ index 7f83d6d1919df55e2e9274afa95b17c8bada1158..0949f7fd1cbd5ab46a4cb9b44598aea4 v8::Local ToArrayBuffer(Environment* env); diff --git a/src/node_i18n.cc b/src/node_i18n.cc -index 581d52a7d05738133e5c3fad33cb73b7c575ef0b..6a4f24aa1d6853826e7ab5c729918c9048284128 100644 +index 808f1fa8d77718e0d44033203485fb2c2796d8e1..56ea735e74fe6d4296d3b179ccb9792daac568b5 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -104,7 +104,7 @@ namespace { @@ -131,7 +131,7 @@ index 581d52a7d05738133e5c3fad33cb73b7c575ef0b..6a4f24aa1d6853826e7ab5c729918c90 return ret; diff --git a/src/node_internals.h b/src/node_internals.h -index f27e03aed66fed5a4dc59ec3ab1102a9ea2c8c56..6d315edb9ce87fe8cce8af91bb45fd0810c748e1 100644 +index efbdbeabf5a6afb658cbdc7888f94952e55f4f71..8b37639361e8902d7e1481071d3ec24be30339e0 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -99,7 +99,9 @@ v8::Maybe InitializePrimordials(v8::Local context); diff --git a/patches/node/test_remove_experimental-wasm-threads_flag.patch b/patches/node/test_remove_experimental-wasm-threads_flag.patch deleted file mode 100644 index 22f469666413f..0000000000000 --- a/patches/node/test_remove_experimental-wasm-threads_flag.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Thu, 20 Oct 2022 16:41:57 +0200 -Subject: test: remove experimental-wasm-threads flag -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It is already true by default in V8. - -Refs: https://github.com/v8/v8/commit/be9ff65a06963f9326756c056a338e1b9e07499c -PR-URL: https://github.com/nodejs/node/pull/45074 -Reviewed-By: Richard Lau -Reviewed-By: Antoine du Hamel -Reviewed-By: Colin Ihrig -Reviewed-By: James M Snell -Reviewed-By: Tobias Nießen - -diff --git a/test/parallel/test-worker-message-port-wasm-threads.js b/test/parallel/test-worker-message-port-wasm-threads.js -index 7eda7802348aaad90c8fc25ed4b2d51e8e9fadf0..4174a8951e9340f244355a07b6c631a0bb06e2c2 100644 ---- a/test/parallel/test-worker-message-port-wasm-threads.js -+++ b/test/parallel/test-worker-message-port-wasm-threads.js -@@ -1,4 +1,3 @@ --// Flags: --experimental-wasm-threads - 'use strict'; - const common = require('../common'); - const assert = require('assert'); diff --git a/patches/node/unix_remove_uv_cloexec_ioctl_3515.patch b/patches/node/unix_remove_uv_cloexec_ioctl_3515.patch deleted file mode 100644 index 937abe6108d84..0000000000000 --- a/patches/node/unix_remove_uv_cloexec_ioctl_3515.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jameson Nash -Date: Sun, 6 Mar 2022 15:01:33 -0500 -Subject: unix: remove uv__cloexec_ioctl() (#3515) - -Now that uv__cloexec_fcntl() is simplified -(https://github.com/libuv/libuv/pull/3492), there is no benefit to -maintaining duplicate code paths for the same thing. - -diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c -index a87b96cfc1dfdc88fa712a4fa991320ff28f2dcd..7cd3a2a954ff7d70e6ba7a6f7538648841bc54b2 100644 ---- a/deps/uv/src/unix/core.c -+++ b/deps/uv/src/unix/core.c -@@ -597,20 +597,6 @@ int uv__nonblock_ioctl(int fd, int set) { - - return 0; - } -- -- --int uv__cloexec_ioctl(int fd, int set) { -- int r; -- -- do -- r = ioctl(fd, set ? FIOCLEX : FIONCLEX); -- while (r == -1 && errno == EINTR); -- -- if (r) -- return UV__ERR(errno); -- -- return 0; --} - #endif - - -@@ -645,7 +631,7 @@ int uv__nonblock_fcntl(int fd, int set) { - } - - --int uv__cloexec_fcntl(int fd, int set) { -+int uv__cloexec(int fd, int set) { - int flags; - int r; - -diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h -index 2dcc8b32f5165dd75061a1b55cc1abd2ab93ccc9..543993989b8765247e140e9d950a25192e5e1ca5 100644 ---- a/deps/uv/src/unix/internal.h -+++ b/deps/uv/src/unix/internal.h -@@ -175,11 +175,9 @@ struct uv__stream_queued_fds_s { - defined(__linux__) || \ - defined(__OpenBSD__) || \ - defined(__NetBSD__) --#define uv__cloexec uv__cloexec_ioctl - #define uv__nonblock uv__nonblock_ioctl - #define UV__NONBLOCK_IS_IOCTL 1 - #else --#define uv__cloexec uv__cloexec_fcntl - #define uv__nonblock uv__nonblock_fcntl - #define UV__NONBLOCK_IS_IOCTL 0 - #endif -@@ -197,8 +195,7 @@ struct uv__stream_queued_fds_s { - #endif - - /* core */ --int uv__cloexec_ioctl(int fd, int set); --int uv__cloexec_fcntl(int fd, int set); -+int uv__cloexec(int fd, int set); - int uv__nonblock_ioctl(int fd, int set); - int uv__nonblock_fcntl(int fd, int set); - int uv__close(int fd); /* preserves errno */ -diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c -index 7705068730cb0536998bad7d304cb87df99b72e8..b6f9756c6a6710f5f10762b9299cc35047b98097 100644 ---- a/deps/uv/src/unix/process.c -+++ b/deps/uv/src/unix/process.c -@@ -283,7 +283,7 @@ static void uv__process_child_init(const uv_process_options_t* options, - if (pipes[fd][1] == -1) - uv__write_errno(error_fd); - #ifndef F_DUPFD_CLOEXEC /* POSIX 2008 */ -- n = uv__cloexec_fcntl(pipes[fd][1], 1); -+ n = uv__cloexec(pipes[fd][1], 1); - if (n) { - uv__write_int(error_fd, n); - _exit(127); -@@ -312,7 +312,7 @@ static void uv__process_child_init(const uv_process_options_t* options, - - if (fd == use_fd) { - if (close_fd == -1) { -- n = uv__cloexec_fcntl(use_fd, 0); -+ n = uv__cloexec(use_fd, 0); - if (n) { - uv__write_int(error_fd, n); - _exit(127); diff --git a/patches/node/unix_simplify_uv_cloexec_fcntl_3492.patch b/patches/node/unix_simplify_uv_cloexec_fcntl_3492.patch deleted file mode 100644 index 13229f0466cd1..0000000000000 --- a/patches/node/unix_simplify_uv_cloexec_fcntl_3492.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ben Noordhuis -Date: Sat, 5 Mar 2022 18:55:49 +0100 -Subject: unix: simplify uv__cloexec_fcntl() (#3492) - -FD_CLOEXEC is the only defined flag for fcntl(F_SETFD) so don't bother -getting the status of that flag first with fcntl(F_GETFD), just set it. - -diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c -index 71e9c525c4a77b8b5322e8516c58329100a8d951..a87b96cfc1dfdc88fa712a4fa991320ff28f2dcd 100644 ---- a/deps/uv/src/unix/core.c -+++ b/deps/uv/src/unix/core.c -@@ -649,21 +649,9 @@ int uv__cloexec_fcntl(int fd, int set) { - int flags; - int r; - -- do -- r = fcntl(fd, F_GETFD); -- while (r == -1 && errno == EINTR); -- -- if (r == -1) -- return UV__ERR(errno); -- -- /* Bail out now if already set/clear. */ -- if (!!(r & FD_CLOEXEC) == !!set) -- return 0; -- -+ flags = 0; - if (set) -- flags = r | FD_CLOEXEC; -- else -- flags = r & ~FD_CLOEXEC; -+ flags = FD_CLOEXEC; - - do - r = fcntl(fd, F_SETFD, flags); diff --git a/patches/node/v8_api_advance_api_deprecation.patch b/patches/node/v8_api_advance_api_deprecation.patch index 7f6626dc90e55..ac55bc94a4203 100644 --- a/patches/node/v8_api_advance_api_deprecation.patch +++ b/patches/node/v8_api_advance_api_deprecation.patch @@ -7,10 +7,10 @@ Refs https://chromium-review.googlesource.com/c/v8/v8/+/3702449 Should be upstreamed. diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc -index 14311237384c023ce6759d31c1db7c09eb521ab7..8f82a61a4345bdd4ffcab7ba93019ad23fbd3259 100644 +index 1abf6801e0544b14dd26f0b96536bd78c5b01679..93e339602800a21726c9414bf2ebe9a2e5517a3b 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc -@@ -217,7 +217,8 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel, +@@ -219,7 +219,8 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel, bool prevent_shutdown) : delegate_(std::move(delegate)), prevent_shutdown_(prevent_shutdown), retaining_context_(false) { diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index 1afb938e3f8c0..bcfc42d59acd4 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -49,10 +49,12 @@ "parallel/test-snapshot-dns-resolve-localhost", "parallel/test-snapshot-dns-resolve-localhost-promise", "parallel/test-snapshot-error", + "parallel/test-snapshot-incompatible", "parallel/test-snapshot-gzip", "parallel/test-snapshot-umd", "parallel/test-snapshot-eval", "parallel/test-snapshot-warning", + "parallel/test-snapshot-weak-reference", "parallel/test-snapshot-typescript", "parallel/test-stdout-close-catch", "parallel/test-tls-cert-chains-concat", @@ -119,9 +121,11 @@ "parallel/test-trace-events-none", "parallel/test-trace-events-process-exit", "parallel/test-trace-events-promises", + "parallel/test-trace-events-threadpool", "parallel/test-trace-events-v8", "parallel/test-trace-events-vm", "parallel/test-trace-events-worker-metadata", + "parallel/test-tz-version", "parallel/test-webcrypto-derivebits-cfrg", "parallel/test-webcrypto-derivekey-cfrg", "parallel/test-webcrypto-encrypt-decrypt",