Accepting request 923493 from GNOME:Next
- Add upstream crash fixer patches from stable branch: + b9e122044a7ccc1e2a3374c680b6ea82066bfa59.patch: arg: Replace gsize with size_t + 62025d4a2738a36ea5f1a7cebef08b22b5eef613.patch: Handle optional out parameters in callbacks - Stop disabling lto: Following this, stop passing dtrace=true and systemtap=true to meson, aswell as dropping systemtap-sdt-devel BuildRequires, follow upstream default. - Add optional pkgconfig(gtk4) BuildRequires: meson checks for it. OBS-URL: https://build.opensuse.org/request/show/923493 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gjs?expand=0&rev=203
This commit is contained in:
parent
7faca748fa
commit
6da4f8b49b
106
62025d4a2738a36ea5f1a7cebef08b22b5eef613.patch
Normal file
106
62025d4a2738a36ea5f1a7cebef08b22b5eef613.patch
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
From 62025d4a2738a36ea5f1a7cebef08b22b5eef613 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Evan Welsh <contact@evanwelsh.com>
|
||||||
|
Date: Fri, 24 Sep 2021 22:17:04 +0000
|
||||||
|
Subject: [PATCH] Handle optional out parameters in callbacks
|
||||||
|
|
||||||
|
Fixes #439
|
||||||
|
---
|
||||||
|
gi/arg.cpp | 26 ++++++++++++++++++++------
|
||||||
|
gi/arg.h | 6 ++----
|
||||||
|
gi/function.cpp | 14 ++++++++------
|
||||||
|
3 files changed, 30 insertions(+), 16 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gi/arg.cpp b/gi/arg.cpp
|
||||||
|
index 0b8af141..49f36d76 100644
|
||||||
|
--- a/gi/arg.cpp
|
||||||
|
+++ b/gi/arg.cpp
|
||||||
|
@@ -1861,17 +1861,31 @@ void gjs_gi_argument_init_default(GITypeInfo* type_info, GIArgument* arg) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-bool
|
||||||
|
-gjs_value_to_arg(JSContext *context,
|
||||||
|
- JS::HandleValue value,
|
||||||
|
- GIArgInfo *arg_info,
|
||||||
|
- GIArgument *arg)
|
||||||
|
-{
|
||||||
|
+bool gjs_value_to_callback_out_arg(JSContext* context, JS::HandleValue value,
|
||||||
|
+ GIArgInfo* arg_info, GIArgument* arg) {
|
||||||
|
+ GIDirection direction [[maybe_unused]] = g_arg_info_get_direction(arg_info);
|
||||||
|
+ g_assert(
|
||||||
|
+ (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) &&
|
||||||
|
+ "gjs_value_to_callback_out_arg does not handle in arguments.");
|
||||||
|
+
|
||||||
|
GjsArgumentFlags flags = GjsArgumentFlags::NONE;
|
||||||
|
GITypeInfo type_info;
|
||||||
|
|
||||||
|
g_arg_info_load_type(arg_info, &type_info);
|
||||||
|
|
||||||
|
+ // If the argument is optional and we're passed nullptr,
|
||||||
|
+ // ignore the GJS value.
|
||||||
|
+ if (g_arg_info_is_optional(arg_info) && !arg)
|
||||||
|
+ return true;
|
||||||
|
+
|
||||||
|
+ // Otherwise, throw an error to prevent a segfault.
|
||||||
|
+ if (!arg) {
|
||||||
|
+ gjs_throw(context,
|
||||||
|
+ "Return value %s is not optional but was passed NULL",
|
||||||
|
+ g_base_info_get_name(arg_info));
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (g_arg_info_may_be_null(arg_info))
|
||||||
|
flags |= GjsArgumentFlags::MAY_BE_NULL;
|
||||||
|
if (g_arg_info_is_caller_allocates(arg_info))
|
||||||
|
diff --git a/gi/arg.h b/gi/arg.h
|
||||||
|
index c81c2979..c5c81760 100644
|
||||||
|
--- a/gi/arg.h
|
||||||
|
+++ b/gi/arg.h
|
||||||
|
@@ -44,10 +44,8 @@ enum class GjsArgumentFlags : uint8_t {
|
||||||
|
GjsArgumentType arg_type);
|
||||||
|
|
||||||
|
GJS_JSAPI_RETURN_CONVENTION
|
||||||
|
-bool gjs_value_to_arg(JSContext *context,
|
||||||
|
- JS::HandleValue value,
|
||||||
|
- GIArgInfo *arg_info,
|
||||||
|
- GIArgument *arg);
|
||||||
|
+bool gjs_value_to_callback_out_arg(JSContext* context, JS::HandleValue value,
|
||||||
|
+ GIArgInfo* arg_info, GIArgument* arg);
|
||||||
|
|
||||||
|
GJS_JSAPI_RETURN_CONVENTION
|
||||||
|
bool gjs_array_to_explicit_array(JSContext* cx, JS::HandleValue value,
|
||||||
|
diff --git a/gi/function.cpp b/gi/function.cpp
|
||||||
|
index 25fea26f..da060607 100644
|
||||||
|
--- a/gi/function.cpp
|
||||||
|
+++ b/gi/function.cpp
|
||||||
|
@@ -532,9 +532,10 @@ bool GjsCallbackTrampoline::callback_closure_inner(
|
||||||
|
if (g_arg_info_get_direction(&arg_info) == GI_DIRECTION_IN)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- if (!gjs_value_to_arg(context, rval, &arg_info,
|
||||||
|
- get_argument_for_arg_info(&arg_info, args,
|
||||||
|
- i + c_args_offset)))
|
||||||
|
+ if (!gjs_value_to_callback_out_arg(
|
||||||
|
+ context, rval, &arg_info,
|
||||||
|
+ get_argument_for_arg_info(&arg_info, args,
|
||||||
|
+ i + c_args_offset)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
break;
|
||||||
|
@@ -587,9 +588,10 @@ bool GjsCallbackTrampoline::callback_closure_inner(
|
||||||
|
if (!JS_GetElement(context, out_array, elem_idx, &elem))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
- if (!gjs_value_to_arg(context, elem, &arg_info,
|
||||||
|
- get_argument_for_arg_info(&arg_info, args,
|
||||||
|
- i + c_args_offset)))
|
||||||
|
+ if (!gjs_value_to_callback_out_arg(
|
||||||
|
+ context, elem, &arg_info,
|
||||||
|
+ get_argument_for_arg_info(&arg_info, args,
|
||||||
|
+ i + c_args_offset)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
elem_idx++;
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
27
b9e122044a7ccc1e2a3374c680b6ea82066bfa59.patch
Normal file
27
b9e122044a7ccc1e2a3374c680b6ea82066bfa59.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From b9e122044a7ccc1e2a3374c680b6ea82066bfa59 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Evan Miller <emmiller@gmail.com>
|
||||||
|
Date: Sun, 12 Sep 2021 15:22:22 -0400
|
||||||
|
Subject: [PATCH] arg: Replace gsize with size_t
|
||||||
|
|
||||||
|
This is causing problems on 32-bit ppc architecture; see
|
||||||
|
https://gitlab.gnome.org/GNOME/glib/-/issues/2493
|
||||||
|
---
|
||||||
|
gi/arg.cpp | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/gi/arg.cpp b/gi/arg.cpp
|
||||||
|
index cff40e10..0b8af141 100644
|
||||||
|
--- a/gi/arg.cpp
|
||||||
|
+++ b/gi/arg.cpp
|
||||||
|
@@ -1706,7 +1706,7 @@ bool gjs_value_to_g_argument(JSContext* context, JS::HandleValue value,
|
||||||
|
|
||||||
|
case GI_TYPE_TAG_ARRAY: {
|
||||||
|
GjsAutoPointer<void> data;
|
||||||
|
- gsize length;
|
||||||
|
+ size_t length;
|
||||||
|
GIArrayType array_type = g_type_info_get_array_type(type_info);
|
||||||
|
|
||||||
|
/* First, let's handle the case where we're passed an instance
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
13
gjs.changes
13
gjs.changes
@ -1,3 +1,16 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Oct 4 17:12:28 UTC 2021 - Bjørn Lie <bjorn.lie@gmail.com>
|
||||||
|
|
||||||
|
- Add upstream crash fixer patches from stable branch:
|
||||||
|
+ b9e122044a7ccc1e2a3374c680b6ea82066bfa59.patch: arg: Replace
|
||||||
|
gsize with size_t
|
||||||
|
+ 62025d4a2738a36ea5f1a7cebef08b22b5eef613.patch: Handle optional
|
||||||
|
out parameters in callbacks
|
||||||
|
- Stop disabling lto: Following this, stop passing dtrace=true and
|
||||||
|
systemtap=true to meson, aswell as dropping systemtap-sdt-devel
|
||||||
|
BuildRequires, follow upstream default.
|
||||||
|
- Add optional pkgconfig(gtk4) BuildRequires: meson checks for it.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Sep 20 09:59:15 UTC 2021 - Michael Gorse <mgorse@suse.com>
|
Mon Sep 20 09:59:15 UTC 2021 - Michael Gorse <mgorse@suse.com>
|
||||||
|
|
||||||
|
14
gjs.spec
14
gjs.spec
@ -24,13 +24,16 @@ License: LGPL-2.0-or-later AND MIT
|
|||||||
Group: Development/Libraries/GNOME
|
Group: Development/Libraries/GNOME
|
||||||
URL: https://wiki.gnome.org/Projects/Gjs
|
URL: https://wiki.gnome.org/Projects/Gjs
|
||||||
Source0: https://download.gnome.org/sources/gjs/1.70/%{name}-%{version}.tar.xz
|
Source0: https://download.gnome.org/sources/gjs/1.70/%{name}-%{version}.tar.xz
|
||||||
|
# PATCH-FIX-UPSTREAM b9e122044a7ccc1e2a3374c680b6ea82066bfa59.patch -- arg: Replace gsize with size_t
|
||||||
|
Patch0: b9e122044a7ccc1e2a3374c680b6ea82066bfa59.patch
|
||||||
|
# PATCH-FIX-UPSTREAM 62025d4a2738a36ea5f1a7cebef08b22b5eef613.patch -- Handle optional out parameters in callbacks
|
||||||
|
Patch1: 62025d4a2738a36ea5f1a7cebef08b22b5eef613.patch
|
||||||
|
|
||||||
BuildRequires: c++_compiler
|
BuildRequires: c++_compiler
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: meson >= 0.52.0
|
BuildRequires: meson >= 0.52.0
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: readline-devel
|
BuildRequires: readline-devel
|
||||||
BuildRequires: systemtap-sdt-devel
|
|
||||||
%if 0%{?sle_version} && 0%{?sle_version} <= 150400
|
%if 0%{?sle_version} && 0%{?sle_version} <= 150400
|
||||||
BuildRequires: xorg-x11-Xvfb
|
BuildRequires: xorg-x11-Xvfb
|
||||||
%else
|
%else
|
||||||
@ -46,6 +49,7 @@ BuildRequires: pkgconfig(gobject-2.0) >= 2.58.0
|
|||||||
BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.53.4
|
BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.53.4
|
||||||
BuildRequires: pkgconfig(gthread-2.0) >= 2.50.0
|
BuildRequires: pkgconfig(gthread-2.0) >= 2.50.0
|
||||||
BuildRequires: pkgconfig(gtk+-3.0) >= 3.20
|
BuildRequires: pkgconfig(gtk+-3.0) >= 3.20
|
||||||
|
BuildRequires: pkgconfig(gtk4)
|
||||||
BuildRequires: pkgconfig(libffi)
|
BuildRequires: pkgconfig(libffi)
|
||||||
BuildRequires: pkgconfig(mozjs-78)
|
BuildRequires: pkgconfig(mozjs-78)
|
||||||
# Hack - fix sysprof static devel requires instead
|
# Hack - fix sysprof static devel requires instead
|
||||||
@ -98,12 +102,7 @@ Mozilla SpiderMonkey JavaScript engine.
|
|||||||
%autosetup -p1
|
%autosetup -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# FIXME # Doesn't play well with systemtap -- lets test this during 3.37 unstable round, do we still needed?
|
|
||||||
%global _lto_cflags %{nil}
|
|
||||||
|
|
||||||
%meson \
|
%meson \
|
||||||
-Ddtrace=true \
|
|
||||||
-Dsystemtap=true \
|
|
||||||
-Dinstalled_tests=false \
|
-Dinstalled_tests=false \
|
||||||
%{nil}
|
%{nil}
|
||||||
%meson_build
|
%meson_build
|
||||||
@ -111,7 +110,7 @@ Mozilla SpiderMonkey JavaScript engine.
|
|||||||
%install
|
%install
|
||||||
%meson_install
|
%meson_install
|
||||||
|
|
||||||
# FIXME # Try again on next versionbump
|
# FIXME # Try again on next versionbump -- version 1.70.0: does anyone know what this fixme is about?
|
||||||
%check
|
%check
|
||||||
export DISPLAY=:98
|
export DISPLAY=:98
|
||||||
Xvfb :98 >& Xvfb.log & trap "kill $! || true" EXIT
|
Xvfb :98 >& Xvfb.log & trap "kill $! || true" EXIT
|
||||||
@ -141,6 +140,5 @@ sleep 10
|
|||||||
%{_libdir}/*.so
|
%{_libdir}/*.so
|
||||||
%{_libdir}/pkgconfig/*.pc
|
%{_libdir}/pkgconfig/*.pc
|
||||||
%{_datadir}/%{name}-1.0/
|
%{_datadir}/%{name}-1.0/
|
||||||
%{_datadir}/systemtap/tapset/*.stp
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
Reference in New Issue
Block a user