From e07f1b610606ae77e3b6c988c2a3a81379956149 Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Tue, 3 Oct 2017 09:55:45 -0400 Subject: [PATCH] Update to 0.23.1 Signed-off-by: Jeremy Cline --- .gitignore | 1 + ...-unfreeze-event-for-ujson-2.0-compat.patch | 43 +++++++++++++++++++ matrix-synapse.spec | 13 +++++- sources | 2 +- 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 2483-unfreeze-event-for-ujson-2.0-compat.patch diff --git a/.gitignore b/.gitignore index e5b9225..8ca502c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /synapse-0.21.1.tar.gz /synapse-0.22.0.tar.gz /synapse-0.22.1.tar.gz +/synapse-0.23.1.tar.gz diff --git a/2483-unfreeze-event-for-ujson-2.0-compat.patch b/2483-unfreeze-event-for-ujson-2.0-compat.patch new file mode 100644 index 0000000..9091ea5 --- /dev/null +++ b/2483-unfreeze-event-for-ujson-2.0-compat.patch @@ -0,0 +1,43 @@ +From cafb8de132999507e9b05c751fbb32d199e7de50 Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Sat, 30 Sep 2017 11:22:37 -0400 +Subject: [PATCH] Unfreeze event before serializing with ujson + +In newer versions of https://github.com/esnme/ultrajson, ujson does not +serialize frozendicts (introduced in esnme/ultrajson@53f85b1). Although +the PyPI version is still 1.35, Fedora ships with a build from commit +esnme/ultrajson@2f1d487. This causes the serialization to fail if the +distribution-provided package is used. + +This runs the event through the unfreeze utility before serializing it. + +Thanks to @ignatenkobrain for tracking down the root cause. + +fixes #2351 + +Signed-off-by: Jeremy Cline +--- + synapse/handlers/message.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py +index be4f123c5..fe9d8848b 100644 +--- a/synapse/handlers/message.py ++++ b/synapse/handlers/message.py +@@ -26,6 +26,7 @@ + from synapse.util.async import run_on_reactor, ReadWriteLock, Limiter + from synapse.util.logcontext import preserve_fn + from synapse.util.metrics import measure_func ++from synapse.util.frozenutils import unfreeze + from synapse.visibility import filter_events_for_client + + from ._base import BaseHandler +@@ -503,7 +504,7 @@ def handle_new_client_event( + + # Ensure that we can round trip before trying to persist in db + try: +- dump = ujson.dumps(event.content) ++ dump = ujson.dumps(unfreeze(event.content)) + ujson.loads(dump) + except: + logger.exception("Failed to encode content: %r", event.content) diff --git a/matrix-synapse.spec b/matrix-synapse.spec index cd054f7..ce396a4 100644 --- a/matrix-synapse.spec +++ b/matrix-synapse.spec @@ -1,8 +1,8 @@ %global srcname synapse Name: matrix-%{srcname} -Version: 0.22.1 -Release: 4%{?dist} +Version: 0.23.1 +Release: 1%{?dist} Summary: A Matrix reference homeserver written in Python using Twisted License: ASL 2.0 URL: https://github.com/matrix-org/%{srcname} @@ -11,11 +11,15 @@ Source1: synapse.sysconfig # Upstream pins its version of pynacl: # https://github.com/matrix-org/synapse/issues/1642 Patch0: 0001-Remove-the-strict-version-requirement-for-pynacl.patch +# Compatibility with ujson-2.0+ +# https://github.com/matrix-org/synapse/pull/2483 +Patch1: 2483-unfreeze-event-for-ujson-2.0-compat.patch BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-setuptools BuildRequires: python2-sphinx +BuildRequires: python2-affinity BuildRequires: python2-bcrypt BuildRequires: python2-pyOpenSSL >= 0.14 BuildRequires: python2-bleach >= 1.4.2 @@ -47,6 +51,7 @@ BuildRequires: python2-yaml BuildRequires: systemd BuildRequires: python2-mock +Requires: python2-affinity Requires: python2-bcrypt Requires: python2-pyOpenSSL >= 0.14 Requires: python2-bleach >= 1.4.2 @@ -143,6 +148,10 @@ exit 0 %changelog +* Tue Oct 03 2017 Jeremy Cline - 0.23.1-1 +- Update to latest upstream +- Include patch to work with ujson-2.0+ + * Fri Sep 29 2017 Igor Gnatenko - 0.22.1-4 - Use python2 prefix for packages whenever possible - Add missing %%{?systemd_requires} diff --git a/sources b/sources index 6c0a958..fab052f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (synapse-0.22.1.tar.gz) = 0f40ddf8e6ab90f6e1e416b4e6dc0e47b88040a6fb19e309ee26632efc1aeb32dd5a7cd26a060017ff2e6ba6320a15b64e0c29a9e8f491f334e1e742583eab7a +SHA512 (synapse-0.23.1.tar.gz) = 2e1b12af21581386b2d30a1705e0803072a3e2225bd170743038e694a3e8ed01a3e4074b83b908d2f55ff7569fc8939a47527eb0a96d0ba031910b6965defb93