From 225c21b90fb9dc8b6a72bb547ea0b66b2cec71c7 Mon Sep 17 00:00:00 2001 From: Skia Date: Fri, 4 Apr 2025 17:16:16 +0200 Subject: [PATCH 1/2] plugins/thumbnails: fix FFI with GIO on s390x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using the correct function signature for g_file_new_for_path fixes the tests on s390x. I do not have the full story on why this failed consistently only on s390x, but I guess the big endian might have something to play with this. Here is how the tests were failing: ``` 169s ___________________________ ThumbnailsTest.test_uri ____________________________ 169s 169s self = 169s 169s def test_uri(self): 169s gio = GioURI() 169s if not gio.available: 169s self.skipTest("GIO library not found") 169s 169s > assert gio.uri("/foo") == "file:///" # silent fail 169s E AssertionError: assert '' == 'file:///' 169s E 169s E - file:/// 169s 169s test/plugins/test_thumbnails.py:268: AssertionError ``` You can see a full log here [1] and a history of consistent failure here [2]. Both links are bound to expire at some point, sorry future archeologist 🤷. [1]: https://autopkgtest.ubuntu.com/results/autopkgtest-plucky/plucky/s390x/b/beets/20250403_162414_5d1da@/log.gz#S5 [2]: https://autopkgtest.ubuntu.com/packages/beets/plucky/s390x --- beetsplug/thumbnails.py | 2 +- docs/changelog.rst | 2 ++ test/plugins/test_thumbnails.py | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/beetsplug/thumbnails.py b/beetsplug/thumbnails.py index 3f88248e0..44ffd12de 100644 --- a/beetsplug/thumbnails.py +++ b/beetsplug/thumbnails.py @@ -246,7 +246,7 @@ class GioURI(URIGetter): if self.available: self.libgio.g_type_init() # for glib < 2.36 - self.libgio.g_file_get_uri.argtypes = [ctypes.c_char_p] + self.libgio.g_file_new_for_path.argtypes = [ctypes.c_char_p] self.libgio.g_file_new_for_path.restype = ctypes.c_void_p self.libgio.g_file_get_uri.argtypes = [ctypes.c_void_p] diff --git a/docs/changelog.rst b/docs/changelog.rst index 88d87e32f..47cd6106d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -24,6 +24,8 @@ New features: Bug fixes: +* Fix API call to GIO on big endian architectures (like s390x) in thumbnails plugin. + :bug:`5708` * :doc:`plugins/listenbrainz`: Fix rST formatting for URLs of Listenbrainz API Key documentation and config.yaml. * :doc:`plugins/listenbrainz`: Fix ``UnboundLocalError`` in cases where 'mbid' is not defined. * :doc:`plugins/fetchart`: Fix fetchart bug where a tempfile could not be deleted due to never being diff --git a/test/plugins/test_thumbnails.py b/test/plugins/test_thumbnails.py index 3eb36cd25..00cd545d4 100644 --- a/test/plugins/test_thumbnails.py +++ b/test/plugins/test_thumbnails.py @@ -265,7 +265,10 @@ class ThumbnailsTest(BeetsTestCase): if not gio.available: self.skipTest("GIO library not found") - assert gio.uri("/foo") == "file:///" # silent fail + import ctypes + + with pytest.raises(ctypes.ArgumentError): + gio.uri("/foo") assert gio.uri(b"/foo") == "file:///foo" assert gio.uri(b"/foo!") == "file:///foo!" assert ( From f4de44f610eb9afb2ef42c81872ee3af67fa6f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Mon, 14 Apr 2025 02:18:38 +0100 Subject: [PATCH 2/2] Add plugin prefix in changelog note --- docs/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 47cd6106d..183fa006e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -24,7 +24,8 @@ New features: Bug fixes: -* Fix API call to GIO on big endian architectures (like s390x) in thumbnails plugin. +* :doc:`plugins/thumbnails`: Fix API call to GIO on big endian architectures + (like s390x) in thumbnails plugin. :bug:`5708` * :doc:`plugins/listenbrainz`: Fix rST formatting for URLs of Listenbrainz API Key documentation and config.yaml. * :doc:`plugins/listenbrainz`: Fix ``UnboundLocalError`` in cases where 'mbid' is not defined.