Date: Thursday, April 15, 2021 @ 13:54:56 Author: felixonmars Revision: 412545
archrelease: copy trunk to staging-x86_64 Added: tracker/repos/staging-x86_64/ tracker/repos/staging-x86_64/0001-libtracker-data-Workaround-SQLite-3.35.x-bug.patch (from rev 412544, tracker/trunk/0001-libtracker-data-Workaround-SQLite-3.35.x-bug.patch) tracker/repos/staging-x86_64/PKGBUILD (from rev 412544, tracker/trunk/PKGBUILD) ---------------------------------------------------------+ 0001-libtracker-data-Workaround-SQLite-3.35.x-bug.patch | 56 ++++++++++++++ PKGBUILD | 50 ++++++++++++ 2 files changed, 106 insertions(+) Copied: tracker/repos/staging-x86_64/0001-libtracker-data-Workaround-SQLite-3.35.x-bug.patch (from rev 412544, tracker/trunk/0001-libtracker-data-Workaround-SQLite-3.35.x-bug.patch) =================================================================== --- staging-x86_64/0001-libtracker-data-Workaround-SQLite-3.35.x-bug.patch (rev 0) +++ staging-x86_64/0001-libtracker-data-Workaround-SQLite-3.35.x-bug.patch 2021-04-15 13:54:56 UTC (rev 412545) @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho <carl...@gnome.org> +Date: Sun, 21 Mar 2021 17:38:48 +0100 +Subject: [PATCH] libtracker-data: Workaround SQLite 3.35.x bug + +The optimization for UNION ALLs inside JOINs had another unexpected +victim: + + SELECT * { GRAPH ?g { ?a ... OPTIONAL { ?a ... } } } + +Does now break when matching the graph between both sides of the +LEFT JOIN caused by OPTIONAL, making all other values coming from +the right hand side come back empty. Make it sure this specific case +is ineligible for query flattening optimizations by adding a LIMIT +clause on the right hand side of the LEFT JOIN. This brings back +correct over fast. + +This workaround should be revisited when a SQLite fix is available. +--- + src/libtracker-data/tracker-sparql.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c +index e36d2341e..60e50c611 100644 +--- a/src/libtracker-data/tracker-sparql.c ++++ b/src/libtracker-data/tracker-sparql.c +@@ -3170,8 +3170,28 @@ translate_OptionalGraphPattern (TrackerSparql *sparql, + + _call_rule (sparql, NAMED_RULE_GroupGraphPattern, error); + +- if (do_join) ++ if (do_join) { ++ /* FIXME: This is a workaround for SQLite 3.35.x, where ++ * the optimization on UNION ALLs inside JOINs (Point 8c in ++ * the 3.35.0 release notes) break in this very specific ++ * case: ++ * ++ * SELECT * { GRAPH ?g { ?a ... OPTIONAL { ?a ... } } } ++ * ++ * This is a workaround to make this one case ineligible ++ * for query flattening optimizations, specifically make ++ * it fall through case 8 in the list at ++ * https://sqlite.org/optoverview.html#flattening, ++ * "The subquery does not use LIMIT or the outer query is not ++ * a join.", we will now meet both here. ++ * ++ * This should be evaluated again in future SQLite versions. ++ */ ++ if (tracker_token_get_variable (&sparql->current_state.graph)) ++ _append_string (sparql, "LIMIT -1 "); ++ + _append_string (sparql, ") "); ++ } + + return TRUE; + } Copied: tracker/repos/staging-x86_64/PKGBUILD (from rev 412544, tracker/trunk/PKGBUILD) =================================================================== --- staging-x86_64/PKGBUILD (rev 0) +++ staging-x86_64/PKGBUILD 2021-04-15 13:54:56 UTC (rev 412545) @@ -0,0 +1,50 @@ +# Maintainer: Jan Alexander Steffens (heftig) <hef...@archlinux.org> +# Contributor: Sergej Pupykin <pupykin.s+a...@gmail.com> +# Contributor: Alexander Fehr <pizzapunk gmail com> + +pkgname=tracker +pkgver=2.3.6+7+gb27396252 +pkgrel=2 +pkgdesc="Desktop-neutral user information store, search tool and indexer" +url="https://wiki.gnome.org/Projects/Tracker" +arch=(x86_64) +license=(GPL) +depends=(sqlite icu glib2 libffi util-linux libstemmer libseccomp libsoup + json-glib upower libnm) +makedepends=(gobject-introspection vala git bash-completion meson) +checkdepends=(python-gobject python-dbus) +provides=(libtracker-{control,miner,sparql}-2.0.so) +groups=(gnome) +_commit=b2739625209c564192b339814264084046e1cf17 # tracker-2.3 +source=("git+https://gitlab.gnome.org/GNOME/tracker.git#commit=$_commit" + 0001-libtracker-data-Workaround-SQLite-3.35.x-bug.patch) +sha256sums=('SKIP' + '00885d437f9257dbba0acad7bae0b9827c1ea09e3ff32727e3217469f3662920') + +pkgver() { + cd $pkgname + git describe --tags | sed 's/_/./g;s/-/+/g' +} + +prepare() { + cd $pkgname + + # https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/382 + git apply -3 ../0001-libtracker-data-Workaround-SQLite-3.35.x-bug.patch + + # test crashes meson: https://github.com/mesonbuild/meson/issues/8591 + sed -i '/tracker-steroids/d' tests/meson.build +} + +build() { + arch-meson $pkgname build + meson compile -C build +} + +check() { + dbus-run-session meson test -C build --print-errorlogs -t 3 +} + +package() { + DESTDIR="$pkgdir" meson install -C build +}