plugins/thumbnails: fix FFI with GIO on s390x (#5708)

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 = <test.plugins.test_thumbnails.ThumbnailsTest testMethod=test_uri>
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
This commit is contained in:
Šarūnas Nejus 2025-04-14 02:23:26 +01:00 committed by GitHub
commit 69b12a337f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View file

@ -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]

View file

@ -24,6 +24,9 @@ New features:
Bug fixes:
* :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.
* :doc:`plugins/fetchart`: Fix fetchart bug where a tempfile could not be deleted due to never being

View file

@ -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 (