summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacho Ramos <pacho@gentoo.org>2014-09-26 10:39:22 +0000
committerPacho Ramos <pacho@gentoo.org>2014-09-26 10:39:22 +0000
commit995a9729752954e925937e23c0266ead4cddac17 (patch)
treecce6510f9dde62631086708f920c8e7058a988fe /dev-libs/gjs
parentmasked media-plugins/vdr-permashift-1.0.0, need new patch in media-video/vdr (diff)
downloadgentoo-2-995a9729752954e925937e23c0266ead4cddac17.tar.gz
gentoo-2-995a9729752954e925937e23c0266ead4cddac17.tar.bz2
gentoo-2-995a9729752954e925937e23c0266ead4cddac17.zip
Apply some upstream fixes that also prevent gjs crashes, bug #523608 by Serge Gavrilov
(Portage version: 2.2.12/cvs/Linux x86_64, signed Manifest commit with key A188FBD4)
Diffstat (limited to 'dev-libs/gjs')
-rw-r--r--dev-libs/gjs/ChangeLog11
-rw-r--r--dev-libs/gjs/files/gjs-1.40.1-ownership-transfer.patch72
-rw-r--r--dev-libs/gjs/files/gjs-1.40.1-ratelimit-rss.patch45
-rw-r--r--dev-libs/gjs/gjs-1.40.1-r1.ebuild (renamed from dev-libs/gjs/gjs-1.36.1.ebuild)40
4 files changed, 153 insertions, 15 deletions
diff --git a/dev-libs/gjs/ChangeLog b/dev-libs/gjs/ChangeLog
index 3a1ae3f0ccbc..9a46a3796622 100644
--- a/dev-libs/gjs/ChangeLog
+++ b/dev-libs/gjs/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for dev-libs/gjs
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/gjs/ChangeLog,v 1.51 2014/09/15 08:18:18 ago Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/gjs/ChangeLog,v 1.52 2014/09/26 10:39:22 pacho Exp $
+
+*gjs-1.40.1-r1 (26 Sep 2014)
+
+ 26 Sep 2014; Pacho Ramos <pacho@gentoo.org>
+ +files/gjs-1.40.1-ownership-transfer.patch,
+ +files/gjs-1.40.1-ratelimit-rss.patch, +gjs-1.40.1-r1.ebuild,
+ -gjs-1.36.1.ebuild:
+ Apply some upstream fixes that also prevent gjs crashes, bug #523608 by Serge
+ Gavrilov
15 Sep 2014; Agostino Sarubbo <ago@gentoo.org> gjs-1.40.1.ebuild:
Stable for sparc, wrt bug #512012
diff --git a/dev-libs/gjs/files/gjs-1.40.1-ownership-transfer.patch b/dev-libs/gjs/files/gjs-1.40.1-ownership-transfer.patch
new file mode 100644
index 000000000000..2a05e0e9465a
--- /dev/null
+++ b/dev-libs/gjs/files/gjs-1.40.1-ownership-transfer.patch
@@ -0,0 +1,72 @@
+From a432e83f967f3d15ef14cfa8040f868af13d1e74 Mon Sep 17 00:00:00 2001
+From: Giovanni Campagna <gcampagna@src.gnome.org>
+Date: Tue, 6 May 2014 19:03:15 +0200
+Subject: function: respect ownership transfer of instance parameters
+
+When calling a method that is (transfer full) on the instance
+parameter we need to make an extra ref/copy.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=729545
+
+diff --git a/gi/function.cpp b/gi/function.cpp
+index 859ea44..792778c 100644
+--- a/gi/function.cpp
++++ b/gi/function.cpp
+@@ -543,6 +543,7 @@ gjs_fill_method_instance (JSContext *context,
+ GIBaseInfo *container = g_base_info_get_container((GIBaseInfo *) function->info);
+ GIInfoType type = g_base_info_get_type(container);
+ GType gtype = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo *)container);
++ GITransfer transfer = g_callable_info_get_instance_ownership_transfer (function->info);
+
+ switch (type) {
+ case GI_INFO_TYPE_STRUCT:
+@@ -553,6 +554,8 @@ gjs_fill_method_instance (JSContext *context,
+ return JS_FALSE;
+
+ out_arg->v_pointer = gjs_gerror_from_error(context, obj);
++ if (transfer == GI_TRANSFER_EVERYTHING)
++ out_arg->v_pointer = g_error_copy ((GError*) out_arg->v_pointer);
+ } else {
+ if (!gjs_typecheck_boxed(context, obj,
+ container, gtype,
+@@ -560,6 +563,14 @@ gjs_fill_method_instance (JSContext *context,
+ return JS_FALSE;
+
+ out_arg->v_pointer = gjs_c_struct_from_boxed(context, obj);
++ if (transfer == GI_TRANSFER_EVERYTHING) {
++ if (gtype != G_TYPE_NONE)
++ out_arg->v_pointer = g_boxed_copy (gtype, out_arg->v_pointer);
++ else {
++ gjs_throw (context, "Cannot transfer ownership of instance argument for non boxed structure");
++ return JS_FALSE;
++ }
++ }
+ }
+ break;
+
+@@ -569,6 +580,8 @@ gjs_fill_method_instance (JSContext *context,
+ return JS_FALSE;
+
+ out_arg->v_pointer = gjs_c_union_from_union(context, obj);
++ if (transfer == GI_TRANSFER_EVERYTHING)
++ out_arg->v_pointer = g_boxed_copy (gtype, out_arg->v_pointer);
+ break;
+
+ case GI_INFO_TYPE_OBJECT:
+@@ -577,10 +590,14 @@ gjs_fill_method_instance (JSContext *context,
+ if (!gjs_typecheck_object(context, obj, gtype, JS_TRUE))
+ return JS_FALSE;
+ out_arg->v_pointer = gjs_g_object_from_object(context, obj);
++ if (transfer == GI_TRANSFER_EVERYTHING)
++ g_object_ref (out_arg->v_pointer);
+ } else if (gjs_typecheck_is_fundamental(context, obj, JS_FALSE)) {
+ if (!gjs_typecheck_fundamental(context, obj, gtype, JS_TRUE))
+ return JS_FALSE;
+ out_arg->v_pointer = gjs_g_fundamental_from_object(context, obj);
++ if (transfer == GI_TRANSFER_EVERYTHING)
++ gjs_fundamental_ref (context, out_arg->v_pointer);
+ } else {
+ gjs_throw_custom(context, "TypeError",
+ "%s.%s is not an object instance neither a fundamental instance of a supported type",
+--
+cgit v0.10.1
diff --git a/dev-libs/gjs/files/gjs-1.40.1-ratelimit-rss.patch b/dev-libs/gjs/files/gjs-1.40.1-ratelimit-rss.patch
new file mode 100644
index 000000000000..f4a95b8b371d
--- /dev/null
+++ b/dev-libs/gjs/files/gjs-1.40.1-ratelimit-rss.patch
@@ -0,0 +1,45 @@
+From 791b1a33424897549f487eb75a80f13c4f94437a Mon Sep 17 00:00:00 2001
+From: Giovanni Campagna <gcampagna@src.gnome.org>
+Date: Fri, 11 Apr 2014 18:38:57 +0200
+Subject: Ratelimit RSS-triggered GCs
+
+When loading a lot of data in memory (for example in the shell
+opening the overview, which loads all the desktop files and icons)
+the RSS can increase a lot, so we would trigger GCs continously
+without any hope of freeing memory, so ratelimit full GCs to at
+most one every 5 frames.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=728048
+
+--- a/gjs/jsapi-util.cpp
++++ b/gjs/jsapi-util.cpp
+@@ -1176,6 +1176,7 @@
+ }
+
+ static gulong linux_rss_trigger;
++static gint64 last_gc_time;
+ #endif
+
+ /**
+@@ -1193,6 +1194,13 @@
+ /* We initiate a GC if VM or RSS has grown by this much */
+ gulong vmsize;
+ gulong rss_size;
++ gint64 now;
++
++ /* We rate limit GCs to at most one per 5 frames.
++ One frame is 16666 microseconds (1000000/60)*/
++ now = g_get_monotonic_time();
++ if (now - last_gc_time < 5 * 16666)
++ return;
+
+ _linux_get_self_process_size (&vmsize, &rss_size);
+
+@@ -1209,6 +1217,7 @@
+ if (rss_size > linux_rss_trigger) {
+ linux_rss_trigger = (gulong) MIN(G_MAXULONG, rss_size * 1.25);
+ JS_GC(JS_GetRuntime(context));
++ last_gc_time = now;
+ } else if (rss_size < (0.75 * linux_rss_trigger)) {
+ /* If we've shrunk by 75%, lower the trigger */
+ linux_rss_trigger = (rss_size * 1.25);
diff --git a/dev-libs/gjs/gjs-1.36.1.ebuild b/dev-libs/gjs/gjs-1.40.1-r1.ebuild
index f291974b5be7..19dfb995f95b 100644
--- a/dev-libs/gjs/gjs-1.36.1.ebuild
+++ b/dev-libs/gjs/gjs-1.40.1-r1.ebuild
@@ -1,39 +1,51 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/gjs/gjs-1.36.1.ebuild,v 1.6 2014/05/07 02:44:20 tetromino Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/gjs/gjs-1.40.1-r1.ebuild,v 1.1 2014/09/26 10:39:22 pacho Exp $
EAPI="5"
GCONF_DEBUG="no"
-inherit gnome2 pax-utils virtualx
+inherit eutils gnome2 pax-utils virtualx
DESCRIPTION="Javascript bindings for GNOME"
-HOMEPAGE="http://live.gnome.org/Gjs"
+HOMEPAGE="https://wiki.gnome.org/Projects/Gjs"
LICENSE="MIT || ( MPL-1.1 LGPL-2+ GPL-2+ )"
SLOT="0"
-IUSE="+cairo examples"
-KEYWORDS="~alpha amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc x86 ~amd64-fbsd"
+IUSE="+cairo examples gtk test"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"
RDEPEND="
- >=dev-libs/glib-2.36.0:2
- >=dev-libs/gobject-introspection-1.36.0
+ >=dev-libs/glib-2.36:2
+ >=dev-libs/gobject-introspection-1.39.3
- dev-libs/dbus-glib
sys-libs/readline:0
- >=dev-lang/spidermonkey-1.8.5:0
+ dev-lang/spidermonkey:24
virtual/libffi
cairo? ( x11-libs/cairo )
+ gtk? ( x11-libs/gtk+:3 )
"
DEPEND="${RDEPEND}
+ gnome-base/gnome-common
sys-devel/gettext
virtual/pkgconfig
+ test? ( sys-apps/dbus )
"
-src_configure() {
- # AUTHORS, ChangeLog are empty
- DOCS="NEWS README"
+# Large amount of tests are broken even in master.
+RESTRICT="test"
+
+src_prepare() {
+ # Prevent gjs crashes, bug #523608 (from 'master')
+ epatch "${FILESDIR}/${PN}-1.40.1-ownership-transfer.patch"
+
+ # Ratelimit RSS-triggered GCs (from 'master')
+ epatch "${FILESDIR}/${PN}-1.40.1-ratelimit-rss.patch"
+ gnome2_src_prepare
+}
+
+src_configure() {
# FIXME: add systemtap/dtrace support, like in glib:2
# FIXME: --enable-systemtap installs files in ${D}/${D} for some reason
# XXX: Do NOT enable coverage, completely useless for portage installs
@@ -41,11 +53,11 @@ src_configure() {
--disable-systemtap \
--disable-dtrace \
--disable-coverage \
- $(use_with cairo cairo)
+ $(use_with cairo cairo) \
+ $(use_with gtk)
}
src_test() {
- # Tests need dbus
Xemake check
}