mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-26 19:11:55 +01:00
126 lines
5.5 KiB
Diff
126 lines
5.5 KiB
Diff
From 0b25059e853235dc46ffa17d1261d6e3f4d303c9 Mon Sep 17 00:00:00 2001
|
|
From: Carlos Garnacho <carlosg@gnome.org>
|
|
Date: Sat, 26 Dec 2020 12:45:39 +0100
|
|
Subject: [PATCH 1/2] libtracker-sparql: Fix out parameter in VAPI/Vala files
|
|
|
|
This argument was made nullable in commit 5ea2e77fa. While this sounds
|
|
what we want (the argument is nullable in C API and the vmethod). This
|
|
makes Vala introduce a double indirection for the out parameter, so
|
|
the argument ends up as "glong**" in the generated C code.
|
|
|
|
Of course, this breaks the interaction with C code and cursor class
|
|
definition expecting a "glong*" there, extra points for the C compiler
|
|
error being silenced. Undoing these specific changes from that commit
|
|
makes Vala and C code agree again about the levels of indirection.
|
|
|
|
This broke callers that rely on the string length being meaningful,
|
|
a glaring known broken case is the portal, as it breaks the
|
|
redirection/serialization of cursors to sandboxed apps.
|
|
|
|
Fixes: https://gitlab.gnome.org/GNOME/tracker/-/issues/282
|
|
---
|
|
src/libtracker-sparql/bus/tracker-bus-fd-cursor.vala | 2 +-
|
|
src/libtracker-sparql/remote/tracker-json-cursor.vala | 2 +-
|
|
src/libtracker-sparql/remote/tracker-xml-cursor.vala | 2 +-
|
|
src/libtracker-sparql/tracker-sparql.vapi | 2 +-
|
|
4 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/libtracker-sparql/bus/tracker-bus-fd-cursor.vala b/src/libtracker-sparql/bus/tracker-bus-fd-cursor.vala
|
|
index b0ea605ab..954ad1ec7 100644
|
|
--- a/src/libtracker-sparql/bus/tracker-bus-fd-cursor.vala
|
|
+++ b/src/libtracker-sparql/bus/tracker-bus-fd-cursor.vala
|
|
@@ -69,7 +69,7 @@ class Tracker.Bus.FDCursor : Tracker.Sparql.Cursor {
|
|
return variable_names[column];
|
|
}
|
|
|
|
- public override unowned string? get_string (int column, out long? length = null)
|
|
+ public override unowned string? get_string (int column, out long length = null)
|
|
requires (cursor_finished == false) {
|
|
unowned string str = null;
|
|
|
|
diff --git a/src/libtracker-sparql/remote/tracker-json-cursor.vala b/src/libtracker-sparql/remote/tracker-json-cursor.vala
|
|
index e85c6f459..047d47278 100644
|
|
--- a/src/libtracker-sparql/remote/tracker-json-cursor.vala
|
|
+++ b/src/libtracker-sparql/remote/tracker-json-cursor.vala
|
|
@@ -95,7 +95,7 @@ public class Tracker.Remote.JsonCursor : Tracker.Sparql.Cursor {
|
|
return _vars.get_string_element (column);
|
|
}
|
|
|
|
- public override unowned string? get_string (int column, out long? length = null) requires (_cur_row != null) {
|
|
+ public override unowned string? get_string (int column, out long length = null) requires (_cur_row != null) {
|
|
var col_node = _cur_row.get_member (get_variable_name (column));
|
|
length = 0;
|
|
|
|
diff --git a/src/libtracker-sparql/remote/tracker-xml-cursor.vala b/src/libtracker-sparql/remote/tracker-xml-cursor.vala
|
|
index 47314c960..a7a710041 100644
|
|
--- a/src/libtracker-sparql/remote/tracker-xml-cursor.vala
|
|
+++ b/src/libtracker-sparql/remote/tracker-xml-cursor.vala
|
|
@@ -144,7 +144,7 @@ public class Tracker.Remote.XmlCursor : Tracker.Sparql.Cursor {
|
|
return _vars[column];
|
|
}
|
|
|
|
- public override unowned string? get_string (int column, out long? length = null) requires (_cur_row != null) {
|
|
+ public override unowned string? get_string (int column, out long length = null) requires (_cur_row != null) {
|
|
length = 0;
|
|
|
|
var variable = _vars[column];
|
|
diff --git a/src/libtracker-sparql/tracker-sparql.vapi b/src/libtracker-sparql/tracker-sparql.vapi
|
|
index a7c758d5f..6174ff8c4 100644
|
|
--- a/src/libtracker-sparql/tracker-sparql.vapi
|
|
+++ b/src/libtracker-sparql/tracker-sparql.vapi
|
|
@@ -122,7 +122,7 @@ namespace Tracker {
|
|
public abstract Sparql.ValueType get_value_type (int column);
|
|
|
|
public abstract unowned string? get_variable_name (int column);
|
|
- public abstract unowned string? get_string (int column, out long? length = null);
|
|
+ public abstract unowned string? get_string (int column, out long length = null);
|
|
|
|
public abstract bool next (GLib.Cancellable? cancellable = null) throws GLib.Error;
|
|
public async abstract bool next_async (GLib.Cancellable? cancellable = null) throws GLib.Error;
|
|
--
|
|
GitLab
|
|
|
|
|
|
From 439e08f3d188896f391f2afb6086bcad1cd99679 Mon Sep 17 00:00:00 2001
|
|
From: Carlos Garnacho <carlosg@gnome.org>
|
|
Date: Sat, 26 Dec 2020 14:01:13 +0100
|
|
Subject: [PATCH 2/2] tests: Test that we get all expected rows and columns in
|
|
portal
|
|
|
|
This would catch the situation at
|
|
https://gitlab.gnome.org/GNOME/tracker/-/issues/282, if reverting
|
|
the previous commit.
|
|
---
|
|
tests/functional-tests/portal.py | 15 +++++++++++++++
|
|
1 file changed, 15 insertions(+)
|
|
|
|
diff --git a/tests/functional-tests/portal.py b/tests/functional-tests/portal.py
|
|
index a4e82820f..194f4e86b 100644
|
|
--- a/tests/functional-tests/portal.py
|
|
+++ b/tests/functional-tests/portal.py
|
|
@@ -57,6 +57,21 @@ class TestPortal(fixtures.TrackerPortalTest):
|
|
self.assertEqual(len(res), 1)
|
|
self.assertEqual(res[0][0], 'b')
|
|
|
|
+ def test_04_rows_cols(self):
|
|
+ self.start_service('org.freedesktop.PortalTest')
|
|
+ res = self.query(
|
|
+ 'org.freedesktop.PortalTest',
|
|
+ 'select ?a ?b { VALUES (?a ?b) { (1 2) (3 4) (5 6) } }')
|
|
+ self.assertEqual(len(res), 3)
|
|
+ self.assertEqual(res[0][0], '1')
|
|
+ self.assertEqual(res[0][1], '2')
|
|
+ self.assertEqual(len(res[0]), 2)
|
|
+ self.assertEqual(res[1][0], '3')
|
|
+ self.assertEqual(res[1][1], '4')
|
|
+ self.assertEqual(len(res[1]), 2)
|
|
+ self.assertEqual(res[2][0], '5')
|
|
+ self.assertEqual(res[2][1], '6')
|
|
+ self.assertEqual(len(res[2]), 2)
|
|
|
|
if __name__ == '__main__':
|
|
fixtures.tracker_test_main()
|
|
--
|
|
GitLab
|
|
|