NetBSD Problem Report #53455
From www@NetBSD.org Mon Jul 16 18:42:17 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id EC1FA7A154
for <gnats-bugs@gnats.NetBSD.org>; Mon, 16 Jul 2018 18:42:17 +0000 (UTC)
Message-Id: <20180716184216.A003D7A1F0@mollari.NetBSD.org>
Date: Mon, 16 Jul 2018 18:42:16 +0000 (UTC)
From: bsiegert@NetBSD.org
Reply-To: bsiegert@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: xfsettingsd crashes
X-Send-Pr-Version: www-1.0
>Number: 53455
>Category: pkg
>Synopsis: xfsettingsd crashes
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: youri
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 16 18:45:00 +0000 2018
>Closed-Date: Wed Jul 18 19:21:11 +0000 2018
>Last-Modified: Wed Jul 18 19:21:11 +0000 2018
>Originator: Benny Siegert
>Release: pkgsrc-current as of 2018-07-14
>Organization:
The NetBSD Foundation
>Environment:
NetBSD shiso.mirbsd.org 8.0_RC2 NetBSD 8.0_RC2 (GENERIC) #0: Mon Jun 25 13:01:26 UTC 2018 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
I upgraded my system from a slightly older XFCE build (February) to the newest packages and NetBSD-8.0_RC2.
When I start my xfce session, not all settings seem to be applied, and there is a core file for xfsettingsd in my home directory.
Running gdb on the core file gives
Reading symbols from /usr/pkg/bin/xfsettingsd...(no debugging symbols found)...done.
[New process 1]
[New process 3]
[New process 2]
Core was generated by `xfsettingsd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007c98fb010821 in up_exported_daemon_get_lid_is_closed () from /usr/pkg/lib/libupower-glib.so.3
[Current thread is 1 (LWP 1)]
(gdb) bt
#0 0x00007c98fb010821 in up_exported_daemon_get_lid_is_closed () from /usr/pkg/lib/libupower-glib.so.3
#1 0x0000000000412149 in ?? ()
#2 0x00007c98fa82f43d in g_type_create_instance () from /usr/pkg/lib/libgobject-2.0.so.0
#3 0x00007c98fa813459 in g_object_new_internal () from /usr/pkg/lib/libgobject-2.0.so.0
#4 0x00007c98fa81481b in g_object_new_with_properties () from /usr/pkg/lib/libgobject-2.0.so.0
#5 0x00007c98fa81547b in g_object_new () from /usr/pkg/lib/libgobject-2.0.so.0
#6 0x0000000000411a87 in ?? ()
#7 0x00007c98fa82f43d in g_type_create_instance () from /usr/pkg/lib/libgobject-2.0.so.0
#8 0x00007c98fa813459 in g_object_new_internal () from /usr/pkg/lib/libgobject-2.0.so.0
#9 0x00007c98fa81481b in g_object_new_with_properties () from /usr/pkg/lib/libgobject-2.0.so.0
#10 0x00007c98fa81547b in g_object_new () from /usr/pkg/lib/libgobject-2.0.so.0
#11 0x0000000000407e5b in ?? ()
#12 0x00007c98facb89b5 in do_call () from /usr/pkg/lib/libgio-2.0.so.0
#13 0x00007c98facb8b82 in request_name_cb () from /usr/pkg/lib/libgio-2.0.so.0
#14 0x00007c98fac82606 in g_task_return_now () from /usr/pkg/lib/libgio-2.0.so.0
#15 0x00007c98fac82f6a in g_task_return () from /usr/pkg/lib/libgio-2.0.so.0
#16 0x00007c98facb1167 in g_dbus_connection_call_done () from /usr/pkg/lib/libgio-2.0.so.0
#17 0x00007c98fac82606 in g_task_return_now () from /usr/pkg/lib/libgio-2.0.so.0
#18 0x00007c98fac8262f in complete_in_idle_cb () from /usr/pkg/lib/libgio-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#19 0x00007c98fa446427 in g_main_context_dispatch () from /usr/pkg/lib/libglib-2.0.so.0
#20 0x00007c98fa446745 in g_main_context_iterate.isra () from /usr/pkg/lib/libglib-2.0.so.0
#21 0x00007c98fa446a22 in g_main_loop_run () from /usr/pkg/lib/libglib-2.0.so.0
#22 0x00007c98fda04a24 in gtk_main () from /usr/pkg/lib/libgtk-3.so.0
#23 0x00000000004127c6 in ?? ()
#24 0x0000000000407c5b in ?? ()
#25 0x00007c98fed76000 in ?? ()
#26 0x0000000000000001 in ?? ()
#27 0x00007f7fff791e98 in ?? ()
#28 0x0000000000000000 in ?? ()
Note that this is not a laptop, thus there is no lid that could open or close.
>How-To-Repeat:
Install the following xfce packages:
$ pkg_info | grep xfce
libxfce4util-4.13.1 Xfce basic library
xfce4-conf-4.13.4 Xfce client-server configuration storage and query system
libxfce4ui-4.13.4 Xfce widget library
xfce4-garcon-0.6.1nb3 Xfce menu library
xfce4-exo-0.12.2 Xfce extension library
xfce4-xarchiver-0.5.4nb7 Xfce archiver handler
xfce4-wm-themes-4.10.0nb7 Xfce window manager themes
xfce4-wm-4.13.0nb3 Xfce window manager
xfce4-tumbler-0.2.1nb2 D-Bus thumbnailing service
xfce4-panel-4.13.3 Xfce panel
xfce4-thunar-1.8.1 Xfce file manager
xfce4-terminal-0.8.7.4 Xfce terminal emulator
xfce4-settings-4.13.4 Xfce settings manager
xfce4-session-4.13.0nb5 Xfce session manager
xfce4-power-manager-1.6.1 Xfce power manager
xfce4-orage-4.12.1nb8 Xfce time managing application
xfce4-mousepad-0.4.0nb8 Xfce text editor
xfce4-desktop-4.12.4 Xfce desktop background manager
xfce4-appfinder-4.13.0 Xfce application finder
elementary-xfce-icon-theme-0.11 Elementary icons forked, extended and maintained for Xfce
xfce4-4.12.0nb13 Xfce
$ pkg_info | grep upower
upower-0.99.4nb3 Power management system message bus service
Start XFCE.
>Fix:
?
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->youri
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Mon, 16 Jul 2018 18:46:45 +0000
Responsible-Changed-Why:
Over to maintainer
From: Benny Siegert <bsiegert@netbsd.org>
To: gnats-bugs@netbsd.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org,
pkgsrc-bugs@netbsd.org
Cc:
Subject: Re: pkg/53455: xfsettingsd crashes
Date: Mon, 16 Jul 2018 18:52:55 +0000
Searching for the name of the crashing function, I found
https://www.ubuntuupdates.org/package/core/xenial/main/updates/upower,
which states
* Fix up_client_new() returning an invalid object (that causes crashes on
any operation) when upowerd is not (yet) started. (LP: #1546641)
I noticed that upowerd is not running in my session, and starting it fails with
(upowerd:2307): UPower-WARNING **: 18:48:29.875: failed to load config
file '/usr/pkg/etc/UPower/UPower/UPower.conf': No such file or
directory
The config file is in etc/UPower/UPower.conf, not where it is
searching for it. Symlinking it into the correct place makes the
daemon exit immediately:
$ /usr/pkg/libexec/upowerd -v
TI:18:51:50 Starting upowerd version 0.99.4
TI:18:51:50 name lost, exiting
From: Benny Siegert <bsiegert@netbsd.org>
To: gnats-bugs@netbsd.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org,
pkgsrc-bugs@netbsd.org
Cc:
Subject: Re: pkg/53455: xfsettingsd crashes
Date: Tue, 17 Jul 2018 22:46:50 +0200
Proposed patch:
? work
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/upower/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- Makefile 5 Jun 2018 19:14:29 -0000 1.13
+++ Makefile 17 Jul 2018 20:46:08 -0000
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.13 2018/06/05 19:14:29 youri Exp $
DISTNAME= upower-0.99.4
-PKGREVISION= 3
+PKGREVISION= 4
CATEGORIES= sysutils
MASTER_SITES= https://upower.freedesktop.org/releases/
EXTRACT_SUFX= .tar.xz
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/upower/distinfo,v
retrieving revision 1.4
diff -u -r1.4 distinfo
--- distinfo 12 Mar 2016 11:50:08 -0000 1.4
+++ distinfo 17 Jul 2018 20:46:08 -0000
@@ -4,3 +4,6 @@
RMD160 (upower-0.99.4.tar.xz) = 6cc312d44a19ffc604c3a3282d03b9cdb6aa3638
SHA512 (upower-0.99.4.tar.xz) =
b3fdee5ccf5f4d0c69e227f543272f6952119132814e27bc8f112716b8d36b5e07741a87bcf02203e80ef910cad9ddffa1adecb338c9a9aaa5e1038b62be07f3
Size (upower-0.99.4.tar.xz) = 426292 bytes
+SHA1 (patch-libupower-glib_up-client.c) =
9eab8b87649546ab7f4d16f009f464a97142836c
+SHA1 (patch-libupower-glib_up-client.h) =
d4c458a6f9ce07166a7e1f6c3ad757ca731b32b7
+SHA1 (patch-tools_up-tool.c) = e7594be12597f47b3c4f2eb65c486004804539ee
Index: patches/patch-libupower-glib_up-client.c
===================================================================
RCS file: patches/patch-libupower-glib_up-client.c
diff -N patches/patch-libupower-glib_up-client.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libupower-glib_up-client.c 17 Jul 2018 20:46:08 -0000
@@ -0,0 +1,169 @@
+$NetBSD$
+
+From 932a6a39e35754be571e1274aec4730fd42dba13 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt@ubuntu.com>
+Date: Wed, 18 May 2016 09:22:43 +0200
+Subject: [PATCH 1/9] lib: Add proper error and cancellable handling to
+ UpClient constructor
+
+A GObject's _init() should never fail or block, but this is currently the case
+as up_client_init() connects to upowerd on D-Bus. Convert this to the GInitable
+interface and provide a new constructor up_client_new_full() which accepts a
+GCancellable and GError, so that clients can do proper error handling
+and reporting.
+
+This changes up_client_new() to return NULL when connecting to upowerd fails.
+This provides a more well-defined behaviour in this case as clients can check
+for this and our methods stop segfaulting as they have checks like
+
+ g_return_val_if_fail (UP_IS_CLIENT (client), ...)
+
+Previously we returned a valid object, but trying to call any method on it
+segfaulted due to the NULL D-Bus proxy, so client code had no chance to check
+whether the UpClient object was really valid.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=95350
+
+--- libupower-glib/up-client.c
++++ libupower-glib/up-client.c
+@@ -39,9 +39,10 @@
+ #include "up-daemon-generated.h"
+ #include "up-device.h"
+
+-static void up_client_class_init (UpClientClass *klass);
+-static void up_client_init (UpClient *client);
+-static void up_client_finalize (GObject *object);
++static void up_client_class_init (UpClientClass *klass);
++static void up_client_initable_iface_init (GInitableIface *iface);
++static void up_client_init (UpClient *client);
++static void up_client_finalize (GObject *object);
+
+ #define UP_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o),
UP_TYPE_CLIENT, UpClientPrivate))
+
+@@ -73,7 +74,8 @@ enum {
+ static guint signals [UP_CLIENT_LAST_SIGNAL] = { 0 };
+ static gpointer up_client_object = NULL;
+
+-G_DEFINE_TYPE (UpClient, up_client, G_TYPE_OBJECT)
++G_DEFINE_TYPE_WITH_CODE (UpClient, up_client, G_TYPE_OBJECT,
++ G_IMPLEMENT_INTERFACE(G_TYPE_INITABLE,
up_client_initable_iface_init))
+
+ /**
+ * up_client_get_devices:
+@@ -434,11 +436,10 @@ up_client_class_init (UpClientClass *klass)
+ * up_client_init:
+ * @client: This class instance
+ */
+-static void
+-up_client_init (UpClient *client)
++static gboolean
++up_client_initable_init (GInitable *initable, GCancellable
*cancellable, GError **error)
+ {
+- GError *error = NULL;
+-
++ UpClient *client = UP_CLIENT (initable);
+ client->priv = UP_CLIENT_GET_PRIVATE (client);
+
+ /* connect to main interface */
+@@ -446,13 +447,10 @@ up_client_init (UpClient *client)
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.freedesktop.UPower",
+ "/org/freedesktop/UPower",
+- NULL,
+- &error);
+- if (client->priv->proxy == NULL) {
+- g_warning ("Couldn't connect to proxy: %s", error->message);
+- g_error_free (error);
+- return;
+- }
++ cancellable,
++ error);
++ if (client->priv->proxy == NULL)
++ return FALSE;
+
+ /* all callbacks */
+ g_signal_connect (client->priv->proxy, "device-added",
+@@ -461,6 +459,23 @@ up_client_init (UpClient *client)
+ G_CALLBACK (up_device_removed_cb), client);
+ g_signal_connect (client->priv->proxy, "notify",
+ G_CALLBACK (up_client_notify_cb), client);
++
++ return TRUE;
++}
++
++static void
++up_client_initable_iface_init (GInitableIface *iface)
++{
++ iface->init = up_client_initable_init;
++}
++
++/*
++ * up_client_init:
++ * @client: This class instance
++ */
++static void
++up_client_init (UpClient *client)
++{
+ }
+
+ /*
+@@ -482,23 +497,52 @@ up_client_finalize (GObject *object)
+ }
+
+ /**
+- * up_client_new:
++ * up_client_new_full:
++ * @cancellable: (allow-none): A #GCancellable or %NULL.
++ * @error: Return location for error or %NULL.
+ *
+- * Creates a new #UpClient object.
++ * Creates a new #UpClient object. If connecting to upowerd on D-Bus fails,
++ % this returns %NULL and sets @error.
+ *
+- * Return value: a new UpClient object.
++ * Return value: a new UpClient object, or %NULL on failure.
+ *
+- * Since: 0.9.0
++ * Since: 0.99.5
+ **/
+ UpClient *
+-up_client_new (void)
++up_client_new_full (GCancellable *cancellable, GError **error)
+ {
+ if (up_client_object != NULL) {
+ g_object_ref (up_client_object);
+ } else {
+- up_client_object = g_object_new (UP_TYPE_CLIENT, NULL);
+- g_object_add_weak_pointer (up_client_object, &up_client_object);
++ up_client_object = g_initable_new (UP_TYPE_CLIENT, cancellable, error, NULL);
++ if (up_client_object)
++ g_object_add_weak_pointer (up_client_object, &up_client_object);
+ }
+ return UP_CLIENT (up_client_object);
+ }
+
++/**
++ * up_client_new:
++ *
++ * Creates a new #UpClient object. If connecting to upowerd on D-Bus fails,
++ * this returns %NULL and prints out a warning with the error message.
++ * Consider using up_client_new_full() instead which allows you to
handle errors
++ * and cancelling long operations yourself.
++ *
++ * Return value: a new UpClient object, or %NULL on failure.
++ *
++ * Since: 0.9.0
++ **/
++UpClient *
++up_client_new (void)
++{
++ GError *error = NULL;
++ UpClient *client;
++ client = up_client_new_full (NULL, &error);
++ if (client == NULL) {
++ g_warning ("Couldn't connect to proxy: %s", error->message);
++ g_error_free (error);
++ }
++ return client;
++}
++
Index: patches/patch-libupower-glib_up-client.h
===================================================================
RCS file: patches/patch-libupower-glib_up-client.h
diff -N patches/patch-libupower-glib_up-client.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libupower-glib_up-client.h 17 Jul 2018 20:46:09 -0000
@@ -0,0 +1,39 @@
+$NetBSD$
+
+From 932a6a39e35754be571e1274aec4730fd42dba13 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt@ubuntu.com>
+Date: Wed, 18 May 2016 09:22:43 +0200
+Subject: [PATCH 1/9] lib: Add proper error and cancellable handling to
+ UpClient constructor
+
+A GObject's _init() should never fail or block, but this is currently the case
+as up_client_init() connects to upowerd on D-Bus. Convert this to the GInitable
+interface and provide a new constructor up_client_new_full() which accepts a
+GCancellable and GError, so that clients can do proper error handling
+and reporting.
+
+This changes up_client_new() to return NULL when connecting to upowerd fails.
+This provides a more well-defined behaviour in this case as clients can check
+for this and our methods stop segfaulting as they have checks like
+
+ g_return_val_if_fail (UP_IS_CLIENT (client), ...)
+
+Previously we returned a valid object, but trying to call any method on it
+segfaulted due to the NULL D-Bus proxy, so client code had no chance to check
+whether the UpClient object was really valid.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=95350
+
+--- libupower-glib/up-client.h
++++ libupower-glib/up-client.h
+@@ -72,6 +72,7 @@ typedef struct
+ /* general */
+ GType up_client_get_type (void);
+ UpClient *up_client_new (void);
++UpClient *up_client_new_full (GCancellable *cancellable, GError **error);
+
+ /* sync versions */
+ UpDevice * up_client_get_display_device (UpClient *client);
+--
+2.8.1
+
Index: patches/patch-tools_up-tool.c
===================================================================
RCS file: patches/patch-tools_up-tool.c
diff -N patches/patch-tools_up-tool.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-tools_up-tool.c 17 Jul 2018 20:46:09 -0000
@@ -0,0 +1,35 @@
+$NetBSD$
+
+From 4e83fabac13250fdc61ef5db817e82c32b7b301b Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt@ubuntu.com>
+Date: Tue, 17 May 2016 15:36:21 +0200
+Subject: [PATCH 2/9] up-tool: Exit early when connecting to upower fails
+
+This avoids spewing dozens of assertions like
+
+ libupower-glib-CRITICAL **: up_client_get_devices: assertion
'UP_IS_CLIENT (client)' failed
+ libupower-glib-CRITICAL **: up_device_get_object_path: assertion
'UP_IS_DEVICE (device)' failed
+
+and useless default values and then exiting successfully (which might confuse
+users or scripts trying to parse the output).
+
+Use the new up_client_new_full() constructor so that we get a proper GError.
+
+Side issue in https://bugs.freedesktop.org/show_bug.cgi?id=95350
+
+--- tools/up-tool.c
++++ tools/up-tool.c
+@@ -285,7 +285,12 @@ main (int argc, char **argv)
+ g_option_context_free (context);
+
+ loop = g_main_loop_new (NULL, FALSE);
+- client = up_client_new ();
++ client = up_client_new_full (NULL, &error);
++ if (client == NULL) {
++ g_warning ("Cannot connect to upowerd: %s", error->message);
++ g_error_free (error);
++ return EXIT_FAILURE;
++ }
+
+ if (opt_version) {
+ gchar *daemon_version;
From: Youri Mouton <youri.mout@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: youri@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
bsiegert@NetBSD.org
Subject: Re: pkg/53455: xfsettingsd crashes
Date: Wed, 18 Jul 2018 09:37:56 +0200
I=E2=80=99m currently trekking so I can=E2=80=99t review but if it works ple=
ase commit :) thanks !
Envoy=C3=A9 de mon iPhone
> Le 17 juil. 2018 =C3=A0 22:50, Benny Siegert <bsiegert@netbsd.org> a =C3=A9=
crit :
>=20
> The following reply was made to PR pkg/53455; it has been noted by GNATS.
>=20
> From: Benny Siegert <bsiegert@netbsd.org>
> To: gnats-bugs@netbsd.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org,=
=20
> pkgsrc-bugs@netbsd.org
> Cc:=20
> Subject: Re: pkg/53455: xfsettingsd crashes
> Date: Tue, 17 Jul 2018 22:46:50 +0200
>=20
> Proposed patch:
>=20
> ? work
> Index: Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/pkgsrc/sysutils/upower/Makefile,v
> retrieving revision 1.13
> diff -u -r1.13 Makefile
> --- Makefile 5 Jun 2018 19:14:29 -0000 1.13
> +++ Makefile 17 Jul 2018 20:46:08 -0000
> @@ -1,7 +1,7 @@
> # $NetBSD: Makefile,v 1.13 2018/06/05 19:14:29 youri Exp $
>=20
> DISTNAME=3D upower-0.99.4
> -PKGREVISION=3D 3
> +PKGREVISION=3D 4
> CATEGORIES=3D sysutils
> MASTER_SITES=3D https://upower.freedesktop.org/releases/
> EXTRACT_SUFX=3D .tar.xz
> Index: distinfo
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/pkgsrc/sysutils/upower/distinfo,v
> retrieving revision 1.4
> diff -u -r1.4 distinfo
> --- distinfo 12 Mar 2016 11:50:08 -0000 1.4
> +++ distinfo 17 Jul 2018 20:46:08 -0000
> @@ -4,3 +4,6 @@
> RMD160 (upower-0.99.4.tar.xz) =3D 6cc312d44a19ffc604c3a3282d03b9cdb6aa363=
8
> SHA512 (upower-0.99.4.tar.xz) =3D
> b3fdee5ccf5f4d0c69e227f543272f6952119132814e27bc8f112716b8d36b5e07741a87bc=
f02203e80ef910cad9ddffa1adecb338c9a9aaa5e1038b62be07f3
> Size (upower-0.99.4.tar.xz) =3D 426292 bytes
> +SHA1 (patch-libupower-glib_up-client.c) =3D
> 9eab8b87649546ab7f4d16f009f464a97142836c
> +SHA1 (patch-libupower-glib_up-client.h) =3D
> d4c458a6f9ce07166a7e1f6c3ad757ca731b32b7
> +SHA1 (patch-tools_up-tool.c) =3D e7594be12597f47b3c4f2eb65c486004804539ee=
> Index: patches/patch-libupower-glib_up-client.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: patches/patch-libupower-glib_up-client.c
> diff -N patches/patch-libupower-glib_up-client.c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-libupower-glib_up-client.c 17 Jul 2018 20:46:08 -0000
> @@ -0,0 +1,169 @@
> +$NetBSD$
> +
> +=46rom 932a6a39e35754be571e1274aec4730fd42dba13 Mon Sep 17 00:00:00 2001
> +From: Martin Pitt <martin.pitt@ubuntu.com>
> +Date: Wed, 18 May 2016 09:22:43 +0200
> +Subject: [PATCH 1/9] lib: Add proper error and cancellable handling to
> + UpClient constructor
> +
> +A GObject's _init() should never fail or block, but this is currently the=
case
> +as up_client_init() connects to upowerd on D-Bus. Convert this to the GIn=
itable
> +interface and provide a new constructor up_client_new_full() which accept=
s a
> +GCancellable and GError, so that clients can do proper error handling
> +and reporting.
> +
> +This changes up_client_new() to return NULL when connecting to upowerd fa=
ils.
> +This provides a more well-defined behaviour in this case as clients can c=
heck
> +for this and our methods stop segfaulting as they have checks like
> +
> + g_return_val_if_fail (UP_IS_CLIENT (client), ...)
> +
> +Previously we returned a valid object, but trying to call any method on i=
t
> +segfaulted due to the NULL D-Bus proxy, so client code had no chance to c=
heck
> +whether the UpClient object was really valid.
> +
> +https://bugs.freedesktop.org/show_bug.cgi?id=3D95350
> +
> +--- libupower-glib/up-client.c
> ++++ libupower-glib/up-client.c
> +@@ -39,9 +39,10 @@
> + #include "up-daemon-generated.h"
> + #include "up-device.h"
> +
> +-static void up_client_class_init (UpClientClass *klass);
> +-static void up_client_init (UpClient *client);
> +-static void up_client_finalize (GObject *object);
> ++static void up_client_class_init (UpClientClass *klass);
> ++static void up_client_initable_iface_init (GInitableIface *iface);
> ++static void up_client_init (UpClient *client);
> ++static void up_client_finalize (GObject *object);
> +
> + #define UP_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o),
> UP_TYPE_CLIENT, UpClientPrivate))
> +
> +@@ -73,7 +74,8 @@ enum {
> + static guint signals [UP_CLIENT_LAST_SIGNAL] =3D { 0 };
> + static gpointer up_client_object =3D NULL;
> +
> +-G_DEFINE_TYPE (UpClient, up_client, G_TYPE_OBJECT)
> ++G_DEFINE_TYPE_WITH_CODE (UpClient, up_client, G_TYPE_OBJECT,
> ++ G_IMPLEMENT_INTERFACE(G_TYPE_INITABLE,
> up_client_initable_iface_init))
> +
> + /**
> + * up_client_get_devices:
> +@@ -434,11 +436,10 @@ up_client_class_init (UpClientClass *klass)
> + * up_client_init:
> + * @client: This class instance
> + */
> +-static void
> +-up_client_init (UpClient *client)
> ++static gboolean
> ++up_client_initable_init (GInitable *initable, GCancellable
> *cancellable, GError **error)
> + {
> +- GError *error =3D NULL;
> +-
> ++ UpClient *client =3D UP_CLIENT (initable);
> + client->priv =3D UP_CLIENT_GET_PRIVATE (client);
> +
> + /* connect to main interface */
> +@@ -446,13 +447,10 @@ up_client_init (UpClient *client)
> + G_DBUS_PROXY_FLAGS_NONE,
> + "org.freedesktop.UPower",
> + "/org/freedesktop/UPower",
> +- NULL,
> +- &error);
> +- if (client->priv->proxy =3D=3D NULL) {
> +- g_warning ("Couldn't connect to proxy: %s", error->message);
> +- g_error_free (error);
> +- return;
> +- }
> ++ cancellable,
> ++ error);
> ++ if (client->priv->proxy =3D=3D NULL)
> ++ return FALSE;
> +
> + /* all callbacks */
> + g_signal_connect (client->priv->proxy, "device-added",
> +@@ -461,6 +459,23 @@ up_client_init (UpClient *client)
> + G_CALLBACK (up_device_removed_cb), client);
> + g_signal_connect (client->priv->proxy, "notify",
> + G_CALLBACK (up_client_notify_cb), client);
> ++
> ++ return TRUE;
> ++}
> ++
> ++static void
> ++up_client_initable_iface_init (GInitableIface *iface)
> ++{
> ++ iface->init =3D up_client_initable_init;
> ++}
> ++
> ++/*
> ++ * up_client_init:
> ++ * @client: This class instance
> ++ */
> ++static void
> ++up_client_init (UpClient *client)
> ++{
> + }
> +
> + /*
> +@@ -482,23 +497,52 @@ up_client_finalize (GObject *object)
> + }
> +
> + /**
> +- * up_client_new:
> ++ * up_client_new_full:
> ++ * @cancellable: (allow-none): A #GCancellable or %NULL.
> ++ * @error: Return location for error or %NULL.
> + *
> +- * Creates a new #UpClient object.
> ++ * Creates a new #UpClient object. If connecting to upowerd on D-Bus fai=
ls,
> ++ % this returns %NULL and sets @error.
> + *
> +- * Return value: a new UpClient object.
> ++ * Return value: a new UpClient object, or %NULL on failure.
> + *
> +- * Since: 0.9.0
> ++ * Since: 0.99.5
> + **/
> + UpClient *
> +-up_client_new (void)
> ++up_client_new_full (GCancellable *cancellable, GError **error)
> + {
> + if (up_client_object !=3D NULL) {
> + g_object_ref (up_client_object);
> + } else {
> +- up_client_object =3D g_object_new (UP_TYPE_CLIENT, NULL);
> +- g_object_add_weak_pointer (up_client_object, &up_client_object);
> ++ up_client_object =3D g_initable_new (UP_TYPE_CLIENT, cancellable, error=
, NULL);
> ++ if (up_client_object)
> ++ g_object_add_weak_pointer (up_client_object, &up_client_object);
> + }
> + return UP_CLIENT (up_client_object);
> + }
> +
> ++/**
> ++ * up_client_new:
> ++ *
> ++ * Creates a new #UpClient object. If connecting to upowerd on D-Bus fai=
ls,
> ++ * this returns %NULL and prints out a warning with the error message.
> ++ * Consider using up_client_new_full() instead which allows you to
> handle errors
> ++ * and cancelling long operations yourself.
> ++ *
> ++ * Return value: a new UpClient object, or %NULL on failure.
> ++ *
> ++ * Since: 0.9.0
> ++ **/
> ++UpClient *
> ++up_client_new (void)
> ++{
> ++ GError *error =3D NULL;
> ++ UpClient *client;
> ++ client =3D up_client_new_full (NULL, &error);
> ++ if (client =3D=3D NULL) {
> ++ g_warning ("Couldn't connect to proxy: %s", error->message);
> ++ g_error_free (error);
> ++ }
> ++ return client;
> ++}
> ++
> Index: patches/patch-libupower-glib_up-client.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: patches/patch-libupower-glib_up-client.h
> diff -N patches/patch-libupower-glib_up-client.h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-libupower-glib_up-client.h 17 Jul 2018 20:46:09 -0000
> @@ -0,0 +1,39 @@
> +$NetBSD$
> +
> +=46rom 932a6a39e35754be571e1274aec4730fd42dba13 Mon Sep 17 00:00:00 2001
> +From: Martin Pitt <martin.pitt@ubuntu.com>
> +Date: Wed, 18 May 2016 09:22:43 +0200
> +Subject: [PATCH 1/9] lib: Add proper error and cancellable handling to
> + UpClient constructor
> +
> +A GObject's _init() should never fail or block, but this is currently the=
case
> +as up_client_init() connects to upowerd on D-Bus. Convert this to the GIn=
itable
> +interface and provide a new constructor up_client_new_full() which accept=
s a
> +GCancellable and GError, so that clients can do proper error handling
> +and reporting.
> +
> +This changes up_client_new() to return NULL when connecting to upowerd fa=
ils.
> +This provides a more well-defined behaviour in this case as clients can c=
heck
> +for this and our methods stop segfaulting as they have checks like
> +
> + g_return_val_if_fail (UP_IS_CLIENT (client), ...)
> +
> +Previously we returned a valid object, but trying to call any method on i=
t
> +segfaulted due to the NULL D-Bus proxy, so client code had no chance to c=
heck
> +whether the UpClient object was really valid.
> +
> +https://bugs.freedesktop.org/show_bug.cgi?id=3D95350
> +
> +--- libupower-glib/up-client.h
> ++++ libupower-glib/up-client.h
> +@@ -72,6 +72,7 @@ typedef struct
> + /* general */
> + GType up_client_get_type (void);
> + UpClient *up_client_new (void);
> ++UpClient *up_client_new_full (GCancellable *cancellable, GError **error)=
;
> +
> + /* sync versions */
> + UpDevice * up_client_get_display_device (UpClient *client);
> +--
> +2.8.1
> +
> Index: patches/patch-tools_up-tool.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: patches/patch-tools_up-tool.c
> diff -N patches/patch-tools_up-tool.c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-tools_up-tool.c 17 Jul 2018 20:46:09 -0000
> @@ -0,0 +1,35 @@
> +$NetBSD$
> +
> +=46rom 4e83fabac13250fdc61ef5db817e82c32b7b301b Mon Sep 17 00:00:00 2001
> +From: Martin Pitt <martin.pitt@ubuntu.com>
> +Date: Tue, 17 May 2016 15:36:21 +0200
> +Subject: [PATCH 2/9] up-tool: Exit early when connecting to upower fails
> +
> +This avoids spewing dozens of assertions like
> +
> + libupower-glib-CRITICAL **: up_client_get_devices: assertion
> 'UP_IS_CLIENT (client)' failed
> + libupower-glib-CRITICAL **: up_device_get_object_path: assertion
> 'UP_IS_DEVICE (device)' failed
> +
> +and useless default values and then exiting successfully (which might con=
fuse
> +users or scripts trying to parse the output).
> +
> +Use the new up_client_new_full() constructor so that we get a proper GErr=
or.
> +
> +Side issue in https://bugs.freedesktop.org/show_bug.cgi?id=3D95350
> +
> +--- tools/up-tool.c
> ++++ tools/up-tool.c
> +@@ -285,7 +285,12 @@ main (int argc, char **argv)
> + g_option_context_free (context);
> +
> + loop =3D g_main_loop_new (NULL, FALSE);
> +- client =3D up_client_new ();
> ++ client =3D up_client_new_full (NULL, &error);
> ++ if (client =3D=3D NULL) {
> ++ g_warning ("Cannot connect to upowerd: %s", error->message);
> ++ g_error_free (error);
> ++ return EXIT_FAILURE;
> ++ }
> +
> + if (opt_version) {
> + gchar *daemon_version;
>=20
From: "Benny Siegert" <bsiegert@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53455 CVS commit: pkgsrc/sysutils/upower
Date: Wed, 18 Jul 2018 19:18:07 +0000
Module Name: pkgsrc
Committed By: bsiegert
Date: Wed Jul 18 19:18:07 UTC 2018
Modified Files:
pkgsrc/sysutils/upower: Makefile distinfo
Added Files:
pkgsrc/sysutils/upower/patches: patch-libupower-glib_up-client.c
patch-libupower-glib_up-client.h patch-tools_up-tool.c
Log Message:
Fix segfaults when upower is not running.
On my system, these patches stop xfsettingsd (from XFCE) from crashing
and dumping core during session startup. Thus, it can actually apply the
settings it is supposed to.
I just wish upstream had done a bugfix release, the patches are from 2016 :(
Fixes PR pkg/53455, which I filed :)
ok youri@
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 pkgsrc/sysutils/upower/Makefile
cvs rdiff -u -r1.4 -r1.5 pkgsrc/sysutils/upower/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/sysutils/upower/patches/patch-libupower-glib_up-client.c \
pkgsrc/sysutils/upower/patches/patch-libupower-glib_up-client.h \
pkgsrc/sysutils/upower/patches/patch-tools_up-tool.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Benny Siegert" <bsiegert@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53455 CVS commit: pkgsrc/doc
Date: Wed, 18 Jul 2018 19:18:59 +0000
Module Name: pkgsrc
Committed By: bsiegert
Date: Wed Jul 18 19:18:59 UTC 2018
Modified Files:
pkgsrc/doc: CHANGES-2018
Log Message:
upower patch for PR 53455
To generate a diff of this commit:
cvs rdiff -u -r1.3233 -r1.3234 pkgsrc/doc/CHANGES-2018
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Wed, 18 Jul 2018 19:21:11 +0000
State-Changed-Why:
Patch committed, and it seems to help!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.