rpms/libxfcegui4/F-12 libxfcegui4-4.6.1-fix-crash-in-client-session-free.patch, NONE, 1.1 libxfcegui4-4.6.1-session-client-fix-SEGV-inside-disconnect-helper.patch, NONE, 1.1 libxfcegui4.spec, 1.36, 1.37
Christoph Wickert
cwickert at fedoraproject.org
Mon Nov 2 01:43:07 UTC 2009
- Previous message (by thread): rpms/libxfcegui4/devel libxfcegui4-4.6.1-fix-crash-in-client-session-free.patch, NONE, 1.1 libxfcegui4-4.6.1-session-client-fix-SEGV-inside-disconnect-helper.patch, NONE, 1.1 libxfcegui4.spec, 1.36, 1.37
- Next message (by thread): comps comps-f10.xml.in, 1.291, 1.292 comps-f11.xml.in, 1.325, 1.326 comps-f12.xml.in, 1.181, 1.182 comps-f13.xml.in, 1.70, 1.71
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: cwickert
Update of /cvs/pkgs/rpms/libxfcegui4/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6009/F-12
Modified Files:
libxfcegui4.spec
Added Files:
libxfcegui4-4.6.1-fix-crash-in-client-session-free.patch
libxfcegui4-4.6.1-session-client-fix-SEGV-inside-disconnect-helper.patch
Log Message:
* Mon Nov 02 2009 Christoph Wickert <cwickert at fedoraproject.org> - 4.6.1-3
- Fix SEGV inside disconnect() helper (#532179)
- Update gtk-icon-cache scriptlets
libxfcegui4-4.6.1-fix-crash-in-client-session-free.patch:
session-client.c | 364 ++++++++++++++++++++-----------------------------------
1 file changed, 133 insertions(+), 231 deletions(-)
--- NEW FILE libxfcegui4-4.6.1-fix-crash-in-client-session-free.patch ---
>From caffa2a1e66f44d63ea201f186d5fd0c5337f4bf Mon Sep 17 00:00:00 2001
From: Dimitar Zhekov <hamster at mbox.contact.bg>
Date: Fri, 16 Oct 2009 07:43:42 +0000
Subject: various SessionClient improvements and bug fixes
* fix crash in client_session_free()
* strip previous client id from passsed argv before adding the new one
* fix crash when client_session_free() is called when not connected to
the session manager
* some refactoring to avoid code duplication
---
diff --git a/libxfcegui4/session-client.c b/libxfcegui4/session-client.c
index 4f036ec..3c63904 100644
--- a/libxfcegui4/session-client.c
+++ b/libxfcegui4/session-client.c
@@ -408,6 +408,7 @@ save_yourself_possibly_done (SessionClient * session_client)
|| (session_client->current_state ==
SESSION_CLIENT_DONE_WITH_INTERACT))
{
+ set_clone_restart_commands (session_client);
SmcSaveYourselfDone ((SmcConn) session_client->session_connection,
True);
@@ -468,7 +469,6 @@ save_yourself (SmcConn smc_conn, SmPointer client_data, int save_style,
}
}
- set_clone_restart_commands (session_client);
TRACE ("save_yourself - SESSION_CLIENT_SAVING_PHASE_1");
session_client->current_state = SESSION_CLIENT_SAVING_PHASE_1;
switch (interact_style)
@@ -563,168 +563,126 @@ interact (SmcConn smc_conn, SmPointer client_data)
save_yourself_possibly_done (session_client);
}
+#define APPEND 1
+#define REMOVE 2
+
static void
-set_clone_restart_commands (SessionClient * session_client)
+set_property_from_command (SessionClient * session_client, char *command,
+ gchar **ptr, gint alter_sm_id)
{
SmProp prop, *props[1];
- gchar **ptr, **args;
- gint i = 0;
+ gchar **args;
+ gint i;
gint argc;
SmPropValue *vals;
- if ((ptr = session_client->restart_command))
- {
- gboolean have_sm_id = FALSE;
+ if (!ptr)
+ return;
- /* Restart */
- ptr = session_client->restart_command;
- args = ptr;
- i = 0;
- for (argc = 0; *ptr; ptr++)
+ args = ptr;
+ for (argc = 0; *args; args++)
+ {
+ if (alter_sm_id == APPEND &&
+ !g_ascii_strncasecmp (*args, SM_ID_ARG, strlen (SM_ID_ARG)))
{
- if (!g_ascii_strncasecmp (*ptr, SM_ID_ARG, strlen (SM_ID_ARG)))
- {
- have_sm_id = TRUE;
- }
- argc++;
+ alter_sm_id = FALSE;
}
- if (!have_sm_id)
+ argc++;
+ }
+ if (alter_sm_id == APPEND)
+ {
+ argc += 2;
+ }
+ vals = g_new (SmPropValue, argc);
+
+ i = 0;
+ while (*ptr)
+ {
+ if (alter_sm_id == REMOVE &&
+ !g_ascii_strncasecmp (*ptr, SM_ID_ARG, strlen (SM_ID_ARG)))
{
- argc += 2;
+ /* skip the argument after SM_ID_ARG */
+ if (ptr[1] != NULL)
+ ptr++;
}
- vals = g_new (SmPropValue, argc);
- ptr = args;
- while (*ptr)
+ else
{
vals[i].length = strlen (*ptr);
- vals[i++].value = *ptr++;
+ vals[i++].value = *ptr;
}
- if (!have_sm_id)
- {
- vals[i].length = strlen (SM_ID_ARG);
- vals[i++].value = SM_ID_ARG;
- vals[i].length = strlen (session_client->given_client_id);
- vals[i++].value = session_client->given_client_id;
- }
- prop.name = SmRestartCommand;
- prop.type = SmLISTofARRAY8;
- prop.vals = vals;
- prop.num_vals = argc;
-
- props[0] = ∝
- SmcSetProperties ((SmcConn) session_client->session_connection, 1,
- props);
- g_free (vals);
+ ptr++;
}
- /* Clone */
- if ((ptr =
- session_client->clone_command ? session_client->
- clone_command : session_client->restart_command))
+ if (alter_sm_id == APPEND)
{
- args = ptr;
- for (argc = 0; *ptr; ptr++)
- argc++;
- vals = g_new (SmPropValue, argc);
- ptr = args;
- i = 0;
- while (*ptr)
- {
- vals[i].length = strlen (*ptr);
- vals[i++].value = *ptr++;
- }
+ vals[i].length = strlen (SM_ID_ARG);
+ vals[i++].value = SM_ID_ARG;
+ vals[i].length = strlen (session_client->given_client_id);
+ vals[i++].value = session_client->given_client_id;
+ }
- prop.name = SmCloneCommand;
- prop.type = SmLISTofARRAY8;
- prop.vals = vals;
- prop.num_vals = argc;
+ prop.name = command;
+ prop.type = SmLISTofARRAY8;
+ prop.vals = vals;
+ prop.num_vals = i;
- props[0] = ∝
- SmcSetProperties ((SmcConn) session_client->session_connection, 1,
- props);
- g_free (vals);
- }
+ props[0] = ∝
+ SmcSetProperties ((SmcConn) session_client->session_connection, 1, props);
+ g_free (vals);
+}
- /* Resign */
- if ((ptr = session_client->resign_command))
- {
- args = ptr;
- for (argc = 0; *ptr; ptr++)
- argc++;
- vals = g_new (SmPropValue, argc);
- ptr = args;
- i = 0;
- while (*ptr)
- {
- vals[i].length = strlen (*ptr);
- vals[i++].value = *ptr++;
- }
+static void
+set_clone_restart_commands (SessionClient * session_client)
+{
+ /* Restart */
+ set_property_from_command (session_client, SmRestartCommand,
+ session_client->restart_command, APPEND);
- prop.name = SmResignCommand;
- prop.type = SmLISTofARRAY8;
- prop.vals = vals;
- prop.num_vals = argc;
+ /* Clone */
+ set_property_from_command (session_client, SmCloneCommand,
+ session_client->clone_command ?
+ session_client->clone_command :
+ session_client->restart_command, REMOVE);
- props[0] = ∝
- SmcSetProperties ((SmcConn) session_client->session_connection, 1,
- props);
- g_free (prop.vals);
- }
+ /* Resign */
+ set_property_from_command (session_client, SmResignCommand,
+ session_client->resign_command, FALSE);
/* Discard */
- if ((ptr = session_client->discard_command))
- {
- args = ptr;
- for (argc = 0; *ptr; ptr++)
- argc++;
- vals = g_new (SmPropValue, argc);
- ptr = args;
- i = 0;
- while (*ptr)
- {
- vals[i].length = strlen (*ptr);
- vals[i++].value = *ptr++;
- }
+ set_property_from_command (session_client, SmDiscardCommand,
+ session_client->discard_command, FALSE);
- prop.name = SmDiscardCommand;
- prop.type = SmLISTofARRAY8;
- prop.vals = vals;
- prop.num_vals = argc;
+ /* Shutdown */
+ set_property_from_command (session_client, SmShutdownCommand,
+ session_client->shutdown_command, FALSE);
+}
- props[0] = ∝
- SmcSetProperties ((SmcConn) session_client->session_connection, 1,
- props);
- g_free (prop.vals);
- }
+#undef APPEND
+#undef REMOVE
- /* Shutdown */
- if ((ptr = session_client->shutdown_command))
- {
- args = ptr;
- for (argc = 0; *ptr; ptr++)
- argc++;
- vals = g_new (SmPropValue, argc);
- ptr = args;
- i = 0;
- while (*ptr)
- {
- vals[i].length = strlen (*ptr);
- vals[i++].value = *ptr++;
- }
+#endif
- prop.name = SmShutdownCommand;
- prop.type = SmLISTofARRAY8;
- prop.vals = vals;
- prop.num_vals = argc;
+static gchar** safe_strvdup(gchar ** const source)
+{
+ int count;
+ int i;
+ gchar** result;
+
+ if (source == NULL) {
+ return NULL;
+ }
- props[0] = ∝
- SmcSetProperties ((SmcConn) session_client->session_connection, 1,
- props);
- g_free (prop.vals);
+ count = g_strv_length((gchar **)source);
+ result = g_new0(gchar*, count + 1);
+
+ for (i = 0; i < count; ++i) {
+ result[i] = g_strdup(source[i]);
}
+
+ result[count] = NULL;
+ return result;
}
-#endif
SessionClient *
client_session_new_full (gpointer data, SessionRestartStyle restart_style,
@@ -759,11 +717,11 @@ client_session_new_full (gpointer data, SessionRestartStyle restart_style,
{
session_client->current_directory = g_strdup (g_get_home_dir ());
}
- session_client->clone_command = clone_command;
- session_client->resign_command = resign_command;
- session_client->restart_command = restart_command;
- session_client->discard_command = discard_command;
- session_client->shutdown_command = shutdown_command;
+ session_client->clone_command = safe_strvdup (clone_command);
+ session_client->resign_command = safe_strvdup (resign_command);
+ session_client->restart_command = safe_strvdup (restart_command);
+ session_client->discard_command = safe_strvdup (discard_command);
+ session_client->shutdown_command = safe_strvdup (shutdown_command);
session_client->shutdown = FALSE;
session_client->save_phase_2 = NULL;
@@ -781,7 +739,7 @@ client_session_new (gint argc, gchar * argv[], gpointer data,
SessionRestartStyle restart_style, gchar priority)
{
SessionClient *session_client;
- gchar **array;
+ gchar **array, **args;
gchar *client_id = NULL;
gboolean next_is_client_id = FALSE, had_display = FALSE;
GdkDisplay *dpy = gdk_display_get_default();
@@ -795,39 +753,41 @@ client_session_new (gint argc, gchar * argv[], gpointer data,
}
else
{
- array = g_new (gchar *, argc + 3);
- i = 0;
+ array = args = g_new (gchar *, argc + 3);
- while (i < argc)
+ for (i = 0; i < argc; i++)
{
- array[i] = argv[i];
if (next_is_client_id)
{
client_id = argv[i];
next_is_client_id = FALSE;
}
- if (!g_ascii_strncasecmp (argv[i], SM_ID_ARG, strlen (SM_ID_ARG)))
+ else if (!g_ascii_strncasecmp (argv[i], SM_ID_ARG, strlen (SM_ID_ARG)))
{
next_is_client_id = TRUE;
}
- else if (!g_ascii_strncasecmp (argv[i], DPY_ARG, strlen (DPY_ARG)))
+ else
{
- had_display = TRUE;
+ if (!g_ascii_strncasecmp (argv[i], DPY_ARG, strlen (DPY_ARG)))
+ {
+ had_display = TRUE;
+ }
+ *args++ = argv[i];
}
- i++;
}
if ((!had_display) && (dpy != NULL))
{
- array[i++] = "--display";
- array[i++] = (gchar *)gdk_display_get_name(dpy);
+ *args++ = DPY_ARG;
+ *args++ = (gchar *)gdk_display_get_name(dpy);
}
- array[i] = NULL;
+ *args = NULL;
}
session_client =
client_session_new_full (data, restart_style, priority, client_id,
- NULL, NULL, array, array, NULL, NULL, NULL);
+ NULL, NULL, array, NULL, NULL, NULL, NULL);
+ g_free (array);
return session_client;
}
@@ -837,7 +797,9 @@ void client_session_free(SessionClient * session_client)
/* session_client->data; */
/* session_client->session_connection; */
- if (session_client->current_state != SESSION_CLIENT_DISCONNECTED) {
+ if (session_client->session_connection != NULL &&
+ session_client->current_state != SESSION_CLIENT_DISCONNECTED)
+ {
disconnect(session_client);
}
@@ -854,27 +816,6 @@ void client_session_free(SessionClient * session_client)
g_free(session_client);
}
-static gchar** safe_strvdup(gchar ** const source)
-{
- int count;
- int i;
- gchar** result;
-
- if (source == NULL) {
- return NULL;
- }
-
- count = g_strv_length((gchar **)source);
- result = g_new0(gchar*, count + 1);
-
- for (i = 0; i < count; ++i) {
- result[i] = g_strdup(source[i]);
- }
-
- result[count] = NULL;
- return result;
-}
-
void client_session_set_save_phase_2_callback(SessionClient * session_client, save_phase_2_callback value)
{
session_client->save_phase_2 = value;
@@ -1053,84 +994,46 @@ void client_session_set_program(SessionClient * session_client, gchar const* val
#endif /* HAVE_LIBSM */
}
-void client_session_set_clone_command(SessionClient * session_client, gchar** const value)
+static gchar **copy_command(gchar **command, gchar** const value)
{
- if (session_client->clone_command == value) {
- return;
- }
-
- if (session_client->clone_command != NULL) {
- g_strfreev(session_client->clone_command);
- session_client->clone_command = NULL;
- }
+ if (command != value)
+ {
+ if (command != NULL) {
+ g_strfreev(command);
+ command = NULL;
+ }
- if (value != NULL) {
- session_client->clone_command = safe_strvdup(value);
+ if (value != NULL) {
+ command = safe_strvdup(value);
+ }
}
+
+ return command;
+}
+
+void client_session_set_clone_command(SessionClient * session_client, gchar** const value)
+{
+ session_client->clone_command = copy_command(session_client->clone_command, value);
}
void client_session_set_resign_command(SessionClient * session_client, gchar** const value)
{
- if (session_client->resign_command == value) {
- return;
- }
-
- if (session_client->resign_command != NULL) {
- g_strfreev(session_client->resign_command);
- session_client->resign_command = NULL;
- }
-
- if (value != NULL) {
- session_client->resign_command = safe_strvdup(value);
- }
+ session_client->resign_command = copy_command(session_client->resign_command, value);
}
void client_session_set_restart_command(SessionClient * session_client, gchar** const value)
{
- if (session_client->restart_command == value) {
- return;
- }
-
- if (session_client->restart_command != NULL) {
- g_strfreev(session_client->restart_command);
- session_client->restart_command = NULL;
- }
-
- if (value != NULL) {
- session_client->restart_command = safe_strvdup(value);
- }
+ session_client->restart_command = copy_command(session_client->restart_command, value);
}
void client_session_set_discard_command(SessionClient * session_client, gchar** const value)
{
- if (session_client->discard_command == value) {
- return;
- }
-
- if (session_client->discard_command != NULL) {
- g_strfreev(session_client->discard_command);
- session_client->discard_command = NULL;
- }
-
- if (value != NULL) {
- session_client->discard_command = safe_strvdup(value);
- }
+ session_client->discard_command = copy_command(session_client->discard_command, value);
}
void client_session_set_shutdown_command(SessionClient * session_client, gchar** const value)
{
- if (session_client->shutdown_command == value) {
- return;
- }
-
- if (session_client->shutdown_command != NULL) {
- g_strfreev(session_client->shutdown_command);
- session_client->shutdown_command = NULL;
- }
-
- if (value != NULL) {
- session_client->shutdown_command = safe_strvdup(value);
- }
+ session_client->shutdown_command = copy_command(session_client->shutdown_command, value);
}
save_phase_2_callback client_session_get_save_phase_2_callback(SessionClient * session_client)
--
cgit v0.8.2.1
libxfcegui4-4.6.1-session-client-fix-SEGV-inside-disconnect-helper.patch:
session-client.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--- NEW FILE libxfcegui4-4.6.1-session-client-fix-SEGV-inside-disconnect-helper.patch ---
>From 6f5cee8006a6800787e488fce36670e6aa62fa13 Mon Sep 17 00:00:00 2001
From: Eygene Ryabinkin <rea-xfce at codelabs.ru>
Date: Sat, 24 Oct 2009 23:23:42 +0400
Subject: [PATCH] session-client: fix SEGV inside disconnect() helper
Don't call SmcCloseConnection if no connection is present: we will
dereference NULL-pointer in this case and this will provoke SEGV
I had seen this problem when I tried to start xfce4 settings-helper
without running session manager: it whined that
-----
(xfce4-settings-helper:86452): xfce4-settings-helper-WARNING **:
Failed to connect to session manager
-----
and dumped core afterwards. With this patch I can run the utility
without session manager. May be the other clients of libxfcegui4
were affected -- don't currently know.
Signed-off-by: Eygene Ryabinkin <rea-xfce at codelabs.ru>
---
libxfcegui4/session-client.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libxfcegui4/session-client.c b/libxfcegui4/session-client.c
index 3c63904..c9c1137 100644
--- a/libxfcegui4/session-client.c
+++ b/libxfcegui4/session-client.c
@@ -335,9 +335,11 @@ logout_session (SessionClient * session_client)
static void
disconnect (SessionClient * session_client)
{
- SmcCloseConnection ((SmcConn) session_client->session_connection, 0,
- NULL);
- session_client->session_connection = NULL;
+ if (session_client->session_connection != NULL) {
+ SmcCloseConnection ((SmcConn) session_client->session_connection,
+ 0, NULL);
+ session_client->session_connection = NULL;
+ }
session_client->current_state = SESSION_CLIENT_DISCONNECTED;
gdk_set_sm_client_id (NULL);
}
--
1.6.4.4
Index: libxfcegui4.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libxfcegui4/F-12/libxfcegui4.spec,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -p -r1.36 -r1.37
--- libxfcegui4.spec 25 Jul 2009 08:57:44 -0000 1.36
+++ libxfcegui4.spec 2 Nov 2009 01:43:05 -0000 1.37
@@ -1,12 +1,18 @@
Summary: GTK widgets for Xfce
Name: libxfcegui4
Version: 4.6.1
-Release: 2%{?dist}
+Release: 3%{?dist}
License: LGPLv2+
URL: http://www.xfce.org/
Source0: http://www.xfce.org/archive/xfce-%{version}/src/libxfcegui4-%{version}.tar.bz2
Patch0: %{name}-4.4.2-xfce-exec-use-thunar.patch
-Patch1: libxfcegui4-4.6.0-keyboard-shortcuts.patch
+Patch1: %{name}-4.6.0-keyboard-shortcuts.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=532179
+# upstream: http://bugzilla.xfce.org/show_bug.cgi?id=5310
+# http://git.xfce.org/xfce/libxfcegui4/commit/?h=xfce-4.6&id=caffa2a1e66f44d63ea201f186d5fd0c5337f4bf
+Patch2: %{name}-4.6.1-fix-crash-in-client-session-free.patch
+# http://git.xfce.org/xfce/libxfcegui4/commit/?h=xfce-4.6&id=f2053a1e2db56c3f1f92e230140de4fe6ba04f48
+Patch3: %{name}-4.6.1-session-client-fix-SEGV-inside-disconnect-helper.patch
Group: System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires: gtk2 >= 2.0.6
@@ -44,6 +50,8 @@ to compile applications for Xfce.
%setup -q
%patch0 -p1 -b .thunar
%patch1 -p1 -b .shortcut
+%patch2 -p1 -b .client-session-free
+%patch3 -p1 -b .disconnect-helper
%build
%configure --enable-xinerama --disable-static
@@ -66,14 +74,16 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/glade3/*
rm -rf $RPM_BUILD_ROOT
%post
-touch --no-create %{_datadir}/icons/hicolor || :
-%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
-/sbin/ldconfig
+touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%postun
-touch --no-create %{_datadir}/icons/hicolor || :
-%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
-/sbin/ldconfig
+if [ $1 -eq 0 ] ; then
+ touch --no-create %{_datadir}/icons/hicolor &>/dev/null
+ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+fi
+
+%posttrans
+gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files -f %{name}.lang
%defattr(-,root,root,-)
@@ -96,6 +106,10 @@ touch --no-create %{_datadir}/icons/hico
%{_datadir}/glade3/pixmaps/hicolor/*/actions/*
%changelog
+* Mon Nov 02 2009 Christoph Wickert <cwickert at fedoraproject.org> - 4.6.1-3
+- Fix SEGV inside disconnect() helper (#532179)
+- Update gtk-icon-cache scriptlets
+
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 4.6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
- Previous message (by thread): rpms/libxfcegui4/devel libxfcegui4-4.6.1-fix-crash-in-client-session-free.patch, NONE, 1.1 libxfcegui4-4.6.1-session-client-fix-SEGV-inside-disconnect-helper.patch, NONE, 1.1 libxfcegui4.spec, 1.36, 1.37
- Next message (by thread): comps comps-f10.xml.in, 1.291, 1.292 comps-f11.xml.in, 1.325, 1.326 comps-f12.xml.in, 1.181, 1.182 comps-f13.xml.in, 1.70, 1.71
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list