Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package python-fakeredis

[ Reason ]
The last upstream release of Redis (with security updates) changed the
semantics of the SINTER[STORE] commands. This broke the autopkgtests of
python-fakeredis which compared the results against the real Redis.

[ Impact ]
Currently the security update of Redis is blocked from migrating to
testing and would need help..

[ Tests ]
fakeredis has a big test suite and I did some manual tests as well.

[ Risks ]
The change is a behaviour change but Redis upstream considers it more
correct:
https://github.com/redis/redis/issues/9273
Given that fakeredis tries to mimic the Redis behaviour and the change
is pretty minimal, I think the risk is rather small.
I've tested the only reverse build dependency in the archive (cachy) to
build fine with the new fakeredis version.
Also fakeredis upstream acknowledged the patch:
https://github.com/jamesls/fakeredis/pull/303

[ Checklist ]
  [X] all changes are documented in the d/changelog and in the patch
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in testing

unblock python-fakeredis/1.4.5-4
diff --git a/debian/changelog b/debian/changelog
index 820c656..0aad551 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+python-fakeredis (1.4.5-4) unstable; urgency=medium
+
+  * Team upload.
+  * Bump tests dependency for new Redis behaviour
+
+ -- Jochen Sprickerhof <jspri...@debian.org>  Fri, 30 Jul 2021 22:40:47 +0200
+
+python-fakeredis (1.4.5-3) unstable; urgency=medium
+
+  * Team upload.
+  * Add patch for new Redis 6.0.15 SINTER behaviour (Closes: #991451)
+
+ -- Jochen Sprickerhof <jspri...@debian.org>  Fri, 30 Jul 2021 14:32:28 +0200
+
 python-fakeredis (1.4.5-2) unstable; urgency=medium
 
   * Lift pytest version cap.
diff --git a/debian/patches/0002-SINTER-STORE-requires-keys-to-be-sets.patch 
b/debian/patches/0002-SINTER-STORE-requires-keys-to-be-sets.patch
new file mode 100644
index 0000000..0e3fccb
--- /dev/null
+++ b/debian/patches/0002-SINTER-STORE-requires-keys-to-be-sets.patch
@@ -0,0 +1,56 @@
+From: Jochen Sprickerhof <jspri...@debian.org>
+Date: Fri, 30 Jul 2021 13:50:25 +0200
+Subject: SINTER[STORE] requires keys to be sets
+
+Starting with Redis 6.0.15 this behaviour changed.
+The definition of SINTER[STORE] states:
+
+"Keys that do not exist are considered to be empty sets."
+
+At the same time SINTER only accepts set:
+
+"intersection of all the given sets"
+
+Both quotes from: https://redis.io/commands/sinter.
+
+The behaviour of Redis 6.0.14 was that it ignored the type of later keys
+if it found an empty set and returned that. Radis 6.0.15 changed this
+behaviour to return a WRONGTYPE if it finds a non set key in the
+arguments.
+
+Example to reproduce:
+
+127.0.0.1:6379> FLUSHALL
+OK
+127.0.0.1:6379> SINTER a b
+(empty array)
+127.0.0.1:6379> SET b something
+OK
+127.0.0.1:6379> SINTER a b
+(error) WRONGTYPE Operation against a key holding the wrong kind of value
+
+Cf. https://github.com/redis/redis/issues/9273.
+---
+ fakeredis/_server.py | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/fakeredis/_server.py b/fakeredis/_server.py
+index f408ab7..a4f8599 100644
+--- a/fakeredis/_server.py
++++ b/fakeredis/_server.py
+@@ -1866,13 +1866,11 @@ class FakeSocket:
+     def sdiffstore(self, dst, *keys):
+         return self._setop(lambda a, b: a - b, False, dst, *keys)
+ 
+-    # The following keys can't be marked as sets because of the
+-    # stop_if_empty early-out.
+-    @command((Key(set),), (Key(),))
++    @command((Key(set),), (Key(set),))
+     def sinter(self, *keys):
+         return self._setop(lambda a, b: a & b, True, None, *keys)
+ 
+-    @command((Key(), Key(set)), (Key(),))
++    @command((Key(), Key(set)), (Key(set),))
+     def sinterstore(self, dst, *keys):
+         return self._setop(lambda a, b: a & b, True, dst, *keys)
+ 
diff --git a/debian/patches/series b/debian/patches/series
index d448f15..87b0361 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 skip-flaky-test.patch
+0002-SINTER-STORE-requires-keys-to-be-sets.patch
diff --git a/debian/tests/control b/debian/tests/control
index 91f1d97..9e7c574 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -12,6 +12,6 @@ Depends:
  python3-setuptools,
  python3-six,
  python3-sortedcontainers,
- redis-server,
+ redis-server (>= 5:6.0.15),
 Restrictions: allow-stderr, isolation-container
 Test-Command: set -e; for py in $(py3versions -i); do echo "[*] testing on 
$py:"; $py -Wd -m pytest -v -x --ignore=test/test_aioredis.py 2>&1; done

Reply via email to