Version in base suite: 1.74.2-1 Base version: gjs_1.74.2-1 Target version: gjs_1.74.2-1+deb12u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/g/gjs/gjs_1.74.2-1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/g/gjs/gjs_1.74.2-1+deb12u1.dsc changelog | 12 + patches/function-Always-initialize-callback-return-value.patch | 66 ++++++++++ patches/series | 1 3 files changed, 79 insertions(+) diff -Nru gjs-1.74.2/debian/changelog gjs-1.74.2/debian/changelog --- gjs-1.74.2/debian/changelog 2023-02-21 12:13:29.000000000 +0000 +++ gjs-1.74.2/debian/changelog 2023-09-09 19:29:21.000000000 +0000 @@ -1,3 +1,15 @@ +gjs (1.74.2-1+deb12u1) bookworm; urgency=medium + + * d/p/function-Always-initialize-callback-return-value.patch: + Add patch backported from upstream 1.77.1 avoiding infinite loops + of idle callbacks if an idle handler is called during GC. The most + common reason for this is if a GNOME Shell extension incorrectly does + not disconnect all of its signal/idle/timeout handlers. This change + mitigates the infinite loop and associated log flooding, but does not + fix the extension behaviour. (Closes: #1034356) + + -- Simon McVittie Sat, 09 Sep 2023 20:29:21 +0100 + gjs (1.74.2-1) unstable; urgency=medium * New upstream release diff -Nru gjs-1.74.2/debian/patches/function-Always-initialize-callback-return-value.patch gjs-1.74.2/debian/patches/function-Always-initialize-callback-return-value.patch --- gjs-1.74.2/debian/patches/function-Always-initialize-callback-return-value.patch 1970-01-01 00:00:00.000000000 +0000 +++ gjs-1.74.2/debian/patches/function-Always-initialize-callback-return-value.patch 2023-09-09 19:29:21.000000000 +0000 @@ -0,0 +1,66 @@ +From: Sebastian Keller +Date: Thu, 16 Mar 2023 22:35:49 +0100 +Subject: function: Always initialize callback return value + +When callback_closure() exits early, for example due to being called +during GC, the return value would not be initialized. This value is +often non-zero. If the callback is a source func of an idle or a timeout +this would then get interpreted as G_SOURCE_CONTINUE and the same would +repeat in the next iteration. If this happens fast enough, this results +in the entire process being seemingly frozen while spamming the log with +error messages. + +To fix this always initialize the return value to 0 or a comparable +neutral value. + +Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1868 +Bug-Debian: https://bugs.debian.org/1034356 +Forwarded: https://gitlab.gnome.org/GNOME/gjs/-/merge_requests/832 +Applied-upstream: 1.77.1, commit:c925d91e5d018f38b0f66d0ac592274d4b007efb +--- + gi/function.cpp | 18 ++++++++---------- + 1 file changed, 8 insertions(+), 10 deletions(-) + +diff --git a/gi/function.cpp b/gi/function.cpp +index 08a0ea2..2fe4b2c 100644 +--- a/gi/function.cpp ++++ b/gi/function.cpp +@@ -287,6 +287,14 @@ void GjsCallbackTrampoline::warn_about_illegal_js_callback(const char* when, + void GjsCallbackTrampoline::callback_closure(GIArgument** args, void* result) { + GITypeInfo ret_type; + ++ // Fill in the result with some hopefully neutral value ++ g_callable_info_load_return_type(m_info, &ret_type); ++ if (g_type_info_get_tag(&ret_type) != GI_TYPE_TAG_VOID) { ++ GIArgument argument = {}; ++ gjs_gi_argument_init_default(&ret_type, &argument); ++ set_return_ffi_arg_from_giargument(&ret_type, result, &argument); ++ } ++ + if (G_UNLIKELY(!is_valid())) { + warn_about_illegal_js_callback( + "during shutdown", +@@ -362,8 +370,6 @@ void GjsCallbackTrampoline::callback_closure(GIArgument** args, void* result) { + + JS::RootedValue rval(context); + +- g_callable_info_load_return_type(m_info, &ret_type); +- + if (!callback_closure_inner(context, this_object, &rval, args, &ret_type, + n_args, c_args_offset, result)) { + if (!JS_IsExceptionPending(context)) { +@@ -384,14 +390,6 @@ void GjsCallbackTrampoline::callback_closure(GIArgument** args, void* result) { + m_info.ns(), m_info.name()); + } + +- // Fill in the result with some hopefully neutral value +- if (g_type_info_get_tag(&ret_type) != GI_TYPE_TAG_VOID) { +- GIArgument argument = {}; +- g_callable_info_load_return_type(m_info, &ret_type); +- gjs_gi_argument_init_default(&ret_type, &argument); +- set_return_ffi_arg_from_giargument(&ret_type, result, &argument); +- } +- + // If the callback has a GError** argument, then make a GError from the + // value that was thrown. Otherwise, log it as "uncaught" (critical + // instead of warning) diff -Nru gjs-1.74.2/debian/patches/series gjs-1.74.2/debian/patches/series --- gjs-1.74.2/debian/patches/series 2023-02-21 12:13:29.000000000 +0000 +++ gjs-1.74.2/debian/patches/series 2023-09-09 19:29:21.000000000 +0000 @@ -0,0 +1 @@ +function-Always-initialize-callback-return-value.patch