Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package picard for openSUSE:Factory checked in at 2024-08-13 13:24:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/picard (Old) and /work/SRC/openSUSE:Factory/.picard.new.7232 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "picard" Tue Aug 13 13:24:12 2024 rev:72 rq:1193478 version:2.12 Changes: -------- --- /work/SRC/openSUSE:Factory/picard/picard.changes 2024-07-02 18:17:19.989358753 +0200 +++ /work/SRC/openSUSE:Factory/.picard.new.7232/picard.changes 2024-08-13 13:24:49.374193461 +0200 @@ -1,0 +2,7 @@ +Mon Aug 12 15:25:02 UTC 2024 - Antonio Larrosa <[email protected]> + +- Add patch from upstream to fix a segfault when filtering genres + results in empty list of genres: + * 0001-Fix-exception-when-genre-filtering-results-in.patch + +------------------------------------------------------------------- New: ---- 0001-Fix-exception-when-genre-filtering-results-in.patch BETA DEBUG BEGIN: New: results in empty list of genres: * 0001-Fix-exception-when-genre-filtering-results-in.patch BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ picard.spec ++++++ --- /var/tmp/diff_new_pack.q4Y5VK/_old 2024-08-13 13:24:50.170226627 +0200 +++ /var/tmp/diff_new_pack.q4Y5VK/_new 2024-08-13 13:24:50.170226627 +0200 @@ -26,6 +26,8 @@ Source0: https://codeload.github.com/metabrainz/picard/tar.gz/release-%{version}#/%{name}-%{version}.tar.gz # PATCH-FIX-SUSE picard-requirements.patch, [email protected] -- clean python requirements metadata Patch0: picard-requirements.patch +# PATCH-FIX-UPSTREAM 0001-Fix-exception-when-genre-filtering-results-in.patch [email protected] -- Fix segfault when genre filtering results in empty list +Patch1: 0001-Fix-exception-when-genre-filtering-results-in.patch BuildRequires: desktop-file-utils BuildRequires: fdupes BuildRequires: gcc-c++ ++++++ 0001-Fix-exception-when-genre-filtering-results-in.patch ++++++ >From b1a8b2c85c0615c2018de3c054d59f2a0b5315bd Mon Sep 17 00:00:00 2001 From: Philipp Wolfer <[email protected]> Date: Sat, 13 Jul 2024 11:05:31 +0200 Subject: [PATCH] PICARD-2939: Fix exception when genre filtering results in empty genre list --- picard/track.py | 2 ++ test/test_taggenrefilter.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/picard/track.py b/picard/track.py index 3da608de7f..025ebb8b55 100644 --- a/picard/track.py +++ b/picard/track.py @@ -115,6 +115,8 @@ def filter(self, counter: Counter, minusage=0) -> Counter: for name, count in counter.items(): if not self.skip(name): result[name] = count + if not result: + return result topcount = result.most_common(1)[0][1] for name, count in counter.items(): percent = 100 * count // topcount diff --git a/test/test_taggenrefilter.py b/test/test_taggenrefilter.py index 01a54c383d..46cb5a5a52 100644 --- a/test/test_taggenrefilter.py +++ b/test/test_taggenrefilter.py @@ -178,3 +178,15 @@ def test_filter_method_minusage(self): genres = Counter(ax=4, bx=5, ay=20, by=10, bz=4) result = tag_filter.filter(genres, minusage=50) self.assertEqual([('bx', 5), ('by', 10)], list(result.items())) + + def test_filter_method_empty_input(self): + tag_filter = TagGenreFilter("") + genres = Counter() + result = tag_filter.filter(genres) + self.assertEqual([], list(result.items())) + + def test_filter_method_empty_result(self): + tag_filter = TagGenreFilter("-*") + genres = Counter(ax=1, bx=2, ay=3, by=4) + result = tag_filter.filter(genres) + self.assertEqual([], list(result.items()))
