Browse Source

update purple facebook plugin to work with new upstream

Signed-off-by: guibuilder_pel7x64builder0 <guibuilder@powerel.org>
master
guibuilder_pel7x64builder0 7 years ago
parent
commit
f545596633
  1. 51
      SOURCES/purple-facebook-0.9.5-async-sockets-are-hard.patch
  2. 11
      SOURCES/purple-facebook-0.9.5-contacts.patch
  3. 43
      SOURCES/purple-facebook-0.9.5-glib-compiled-with-debug.patch
  4. 14
      SOURCES/purple-facebook-0.9.5-glib-error-cast-bug-2-electric-boogaloo.patch
  5. 26
      SPECS/purple-facebook.spec

51
SOURCES/purple-facebook-0.9.5-async-sockets-are-hard.patch

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
--- a/pidgin/libpurple/protocols/facebook/mqtt.c
+++ b/pidgin/libpurple/protocols/facebook/mqtt.c
@@ -361,26 +361,33 @@
g_byte_array_set_size(priv->rbuf, 0);
res = purple_ssl_read(priv->gsc, &byte, sizeof byte);
- g_byte_array_append(priv->rbuf, &byte, sizeof byte);
- if (res != sizeof byte) {
+ if (res < 0 && errno == EAGAIN) {
+ return;
+ } else if (res != 1) {
fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
_("Failed to read fixed header"));
return;
}
+ g_byte_array_append(priv->rbuf, &byte, sizeof byte);
+
mult = 1;
do {
res = purple_ssl_read(priv->gsc, &byte, sizeof byte);
- g_byte_array_append(priv->rbuf, &byte, sizeof byte);
- if (res != sizeof byte) {
+ /* TODO: this case isn't handled yet */
+ if (0 && res < 0 && errno == EAGAIN) {
+ return;
+ } else if (res != 1) {
fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
_("Failed to read packet size"));
return;
}
+ g_byte_array_append(priv->rbuf, &byte, sizeof byte);
+
priv->remz += (byte & 127) * mult;
mult *= 128;
} while ((byte & 128) != 0);
@@ -390,7 +397,9 @@
size = MIN(priv->remz, sizeof buf);
rize = purple_ssl_read(priv->gsc, buf, size);
- if (rize < 1) {
+ if (rize < 0 && errno == EAGAIN) {
+ return;
+ } else if (rize < 1) {
fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL,
_("Failed to read packet data"));
return;

11
SOURCES/purple-facebook-0.9.5-contacts.patch

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
--- a/pidgin/libpurple/protocols/facebook/api.c
+++ b/pidgin/libpurple/protocols/facebook/api.c
@@ -2424,7 +2424,7 @@
priv->contacts_delta = g_strdup(is_delta ? cursor : delta_cursor);
}
- if (users) {
+ if (users || (complete && !is_delta)) {
g_signal_emit_by_name(api, "contacts", users, complete);
}

43
SOURCES/purple-facebook-0.9.5-glib-compiled-with-debug.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
From 99e31624bf9e88b3002e05514db904d5aad35db6 Mon Sep 17 00:00:00 2001
From: dequis <dx@dxzone.com.ar>
Date: Sat, 25 Feb 2017 03:14:57 -0300
Subject: [PATCH] Fix crash when the error signal is raised and glib has
G_ENABLE_DEBUG

If glib is built with --enable-debug=yes, it will have G_ENABLE_DEBUG
set internally

This flag changes the g_marshal_value_peek_object() macro to use
g_value_get_object(), which performs sanity checks, instead of doing a
direct offset access.

The definition of our error signal was wrong, using a marshaller with
a GObject in the first parameter but setting the type of the GValue to
G_TYPE_ERROR. Since we have no marshaller for G_TYPE_ERROR, and that all
of those are functionally equivalent (and in fact use the exact same
code in non-debug builds), I went with POINTER for both sides.

The actual crash happened because of a g_return_val_if_fail() in the
sanity checks which made it return NULL after throwing a warning like
this:

g_value_get_object: assertion 'G_VALUE_HOLDS_OBJECT (value)' failed

This was reported by a gentoo user who had the debug use flag. Thanks!
---
facebook/facebook-api.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pidgin/libpurple/protocols/facebook/api.c b/pidgin/libpurple/protocols/facebook/api.c
index a94f9af..eb0e8b4 100644
--- a/pidgin/libpurple/protocols/facebook/api.c
+++ b/pidgin/libpurple/protocols/facebook/api.c
@@ -381,7 +381,7 @@
G_SIGNAL_ACTION,
0,
NULL, NULL,
- fb_marshal_VOID__OBJECT,
+ fb_marshal_VOID__POINTER,
G_TYPE_NONE,
1, G_TYPE_POINTER);

14
SOURCES/purple-facebook-0.9.5-glib-error-cast-bug-2-electric-boogaloo.patch

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
--- a/pidgin/libpurple/protocols/facebook/mqtt.c
+++ b/pidgin/libpurple/protocols/facebook/mqtt.c
@@ -113,9 +113,9 @@
G_SIGNAL_ACTION,
0,
NULL, NULL,
- fb_marshal_VOID__OBJECT,
+ fb_marshal_VOID__POINTER,
G_TYPE_NONE,
- 1, G_TYPE_ERROR);
+ 1, G_TYPE_POINTER);
/**
* FbMqtt::open:

26
SPECS/purple-facebook.spec

@ -13,13 +13,23 @@ @@ -13,13 +13,23 @@

Name: purple-facebook
Version: 0.9.5
Release: 1%{sha_rel}%{?dist}
Release: 4%{sha_rel}%{?dist}
Summary: Facebook protocol plugin for purple2

License: GPLv2+
URL: https://github.com/dequis/%{name}
Source0: %{url}/releases/download/v%{version}%{sha_ver}/%{name}-%{version}%{sha_ver}.tar.gz

# Backported from upstream.
# https://github.com/dequis/purple-facebook/issues/403
Patch0: %{name}-0.9.5-glib-compiled-with-debug.patch
# https://github.com/dequis/purple-facebook/commit/dc655d0556929cbbb0efbad360600d5987d740c5
Patch1: %{name}-0.9.5-contacts.patch
# https://github.com/dequis/purple-facebook/commit/8f124c72b969a5b688ad54695689c5d0aed53469
Patch2: %{name}-0.9.5-glib-error-cast-bug-2-electric-boogaloo.patch
# https://github.com/dequis/purple-facebook/commit/ef6ae47b8bf971d3f2803b1552b7debc59429dc1
Patch3: %{name}-0.9.5-async-sockets-are-hard.patch

BuildRequires: json-glib-devel
BuildRequires: libpurple-devel
BuildRequires: zlib-devel
@ -31,7 +41,7 @@ this plugin is back-ported for purple2. @@ -31,7 +41,7 @@ this plugin is back-ported for purple2.


%prep
%autosetup -n %{name}-%{version}%{sha_ver}
%autosetup -n %{name}-%{version}%{sha_ver} -p 1


%build
@ -47,7 +57,7 @@ this plugin is back-ported for purple2. @@ -47,7 +57,7 @@ this plugin is back-ported for purple2.


%check
%{__make} check
%make_build check


%files
@ -57,6 +67,16 @@ this plugin is back-ported for purple2. @@ -57,6 +67,16 @@ this plugin is back-ported for purple2.


%changelog
* Fri Mar 23 2018 Björn Esser <besser82@fedoraproject.org> - 0.9.5-4.9ff9acf9fa14
- Add patch from upstream fixing connection problem with TLS 1.3
- Add patch from upstream fixing another segfault with newer glib

* Wed Mar 21 2018 Björn Esser <besser82@fedoraproject.org> - 0.9.5-3.9ff9acf9fa14
- Add two patches from upstream fixing segfault with newer glib

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-2.9ff9acf9fa14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Aug 31 2017 Björn Esser <besser82@fedoraproject.org> - 0.9.5-1.9ff9acf9fa14
- New upstream release (rhbz#1487200)


Loading…
Cancel
Save