summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* libtracker-sparql: Fix some printf format stringsSam Thursfield2022-12-062-2/+2
| | | | | The size of GSize varies between 64bit and 32bit systems so always use G_GSIZE_FORMAT instead of `%ld`.
* core: Drop tracker_sparql_reset_state()Carlos Garnacho2022-12-051-6/+0
| | | | | | The TrackerSparql object no longer directly contains data that needs to be dropped if rebuilding the SQL query from SPARQL. This function now does nothing, so can be removed.
* core: Move topmost TrackerContext to TrackerSparqlStateCarlos Garnacho2022-12-051-62/+63
| | | | | Now we can avoid keeping this context for long, so move this piece of data to the transient TrackerSparqlState.
* core: Move cacheable TrackerSelectContext data to TrackerSparqlCarlos Garnacho2022-12-051-4/+13
| | | | | | | | After done with query processing, we can keep just small pieces of the TrackerSelectContext data for the (possibly repeatable) query execution step. Move this data to the TrackerSparql, so we can move the TrackerSelectContext to the more transient TrackerSparqlState struct and stick to the essential data.
* core: Do not process early the SPARQL query on readonly queriesCarlos Garnacho2022-12-051-21/+2
| | | | | | | We do that, but at the same time we postpone the resulting error until tracker_sparql_execute_cursor(), we can just rely on the paths that are already there for possibly regenerating the SQL string out of the SPARQL string.
* core: Move graph/service constraint policies to TrackerSparqlStateCarlos Garnacho2022-12-051-58/+59
| | | | | We just need to track this state while parsing the SPARQL string, this can be moved to TrackerSparqlState.
* core: Rename functionCarlos Garnacho2022-12-051-8/+8
| | | | It was still using a word we agreed on avoiding.
* core: Move resulting TrackerStringBuilder buffer to TrackerSparqlStateCarlos Garnacho2022-12-051-16/+27
| | | | | | | After all the query is parsed, we can stick to the resulting SQL string as a gchar*, if/until the query needs to be entirely redone from the initial SPARQL. This means we can move the TrackerStringBuilder itself to be temporary state.
* core: Move URI base to TrackerSparqlStateCarlos Garnacho2022-12-051-8/+7
| | | | This is only needed while parsing the query, so can be moved there.
* core: Shuffle root node initializationCarlos Garnacho2022-12-051-9/+7
| | | | | | Now that we have a tracker_sparql_state_init() function to initialize the TrackerSparqlState, we can fetch the root node of the parser tree there.
* core: Move anon/named graph arrays to TrackerSparqlStateCarlos Garnacho2022-12-051-29/+29
| | | | | This is only needed while parsing the query, so can be moved to TrackerSparqlState.
* core: Move cached parameters/bindings to TrackerSparqlStateCarlos Garnacho2022-12-051-13/+10
| | | | | We just need these supporting hashtables while parsing the query, so these can be moved into TrackerSparqlState.
* core: Move prefix map to TrackerSparqlStateCarlos Garnacho2022-12-051-9/+17
| | | | | | This is not needed after query parsing, so can be pushed there. As this state needs some initialization, add a tracker_sparql_state_init() function to deal with that.
* core: Move filter clauses list to TrackerSparqlStateCarlos Garnacho2022-12-051-8/+8
| | | | | This is only used while parsing, and is not necessary to preserve with the (possibly long-lived) TrackerSparql object.
* libtracker-sparql: Add versioning macros for 3.5.xCarlos Garnacho2022-12-051-0/+20
|
* Merge branch 'wip/carlosg/stalls' into 'master'Sam Thursfield2022-11-221-48/+59
|\ | | | | | | | | | | | | libtracker-sparql: Close descriptors asynchronously in TrackerEndpointDBus Closes #386 See merge request https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/551
| * libtracker-sparql: Read updates completely asynchronouslyCarlos Garnacho2022-11-191-44/+53
| | | | | | | | | | | | | | | | | | | | | | | | Even though the updates were being read chunk by chunk asynchronously, it was still the thread/context that spawned the TrackerEndpointDBus what is driving the operation by reading the next chunk, or issuing the update after everything was read. Delegate the whole FD reading to a task in a thread, so it does not need to be driven by the (possibly main) context managing the endpoint. The update is still issued from this thread, mainly to share the FD reading bits between normal and blank node updates.
| * libtracker-sparql: Close descriptors asynchronously in TrackerEndpointDBusCarlos Garnacho2022-11-191-4/+6
| | | | | | | | | | | | | | | | | | | | The QueryRequest and UpdateRequest internal data structures may be freed from the thread that is handling endpoint requests. Avoid closing descriptors from that thread, this is esp. important with the write FDs since there might be data pending to be written and flushed, so it may be a time consuming operation, or it may even stall if the peer is busy with other things. Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/386
* | core: Handle ROWIDs turned into strings in SparqlPrintIRI()Carlos Garnacho2022-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though normally we expect ROWIDs to preserve numeric affinity when we proceed to print their IRI in the higher parts of the query, it is not guaranteed by the SQLite documentation: "Whether or not a persistent internal datatype conversion occurs is undefined and may change from one release of SQLite to the next." And this in fact changed for the core/property-paths/alternative-path-3 unit test, where it does the '|' union of text and resource (i.e. ROWIDs) properties. Since SQLite 3.40.0, the SparqlPrintIRI() happening in the topmost select will get SQLITE_TEXT affinity for all ROWID values received through the union. In order to work with both older and newer version of SQLite, attempt to force integer affinity so ROWID IRIs are correctly resolved instead of being interpreted as IRI strings. Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/387
* | core: Warn on non-absolute IRIs during insertionCarlos Garnacho2022-11-211-0/+3
| | | | | | | | | | | | | | | | | | | | The IRIs being inserted in the triple store should be ensured to be correct, full IRIs. Perform the minimal check here, and warn if the IRI does not at least contain a scheme separator. This at least will raise some warnings if invalid IRIs like <123> or <abc> are inserted by the Tracker user, it will be turned into a GError worthy condition in future versions.
* | core: Add missing break to turtle file importingCarlos Garnacho2022-11-211-0/+1
|/ | | | | | If we got an error, we want to break early of this loop, otherwise we'll reuse the already set GError and fall into further warnings that might obscure the original issue.
* Merge branch 'wip/carlosg/valgrind-fixes' into 'master'Carlos Garnacho2022-10-265-21/+16
|\ | | | | | | | | Fixes for issues detected by valgrind See merge request https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/549
| * libtracker-sparql/core: Ensure update log flushing harderCarlos Garnacho2022-10-241-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our update log is a fixed size, we (usually) try hard that it remains within it, and avoid GArray resizes which in turn result in GHashTable entries suddenly pointing to invalid memory. This however may break if many multivalued property additions on the same graph/subject/predicate happen. This is seen in valgrind as: ==477545== Invalid read of size 8 ==477545== at 0x4C67E9A: tracker_data_log_entry_equal (tracker-data-update.c:231) ==477545== by 0x48E4AF1: UnknownInlinedFun (ghash.c:495) ==477545== by 0x48E4AF1: g_hash_table_lookup (ghash.c:1540) ==477545== by 0x4C685F7: log_entry_for_single_value_property (tracker-data-update.c:768) ==477545== by 0x4C6A4A4: cache_insert_metadata_decomposed (tracker-data-update.c:2215) ==477545== by 0x4C6C1DD: tracker_data_insert_statement_with_string (tracker-data-update.c:2922) ==477545== by 0x4C6C400: tracker_data_insert_statement (tracker-data-update.c:2826) ==477545== by 0x4C8F94D: tracker_sparql_apply_quad (tracker-sparql.c:2239) ==477545== by 0x4C8FC66: translate_GraphNode (tracker-sparql.c:7466) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C82636: translate_Object (tracker-sparql.c:6537) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C89655: translate_ObjectList (tracker-sparql.c:6522) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C8C47D: translate_PropertyListNotEmpty (tracker-sparql.c:6491) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C82995: translate_TriplesSameSubject (tracker-sparql.c:6406) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84E3E: translate_TriplesTemplate (tracker-sparql.c:5206) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== Address 0x8688768 is 104 bytes inside a block of size 4,096 free'd ==477545== at 0x48466AF: realloc (vg_replace_malloc.c:1437) ==477545== by 0x49095BF: g_realloc (gmem.c:201) ==477545== by 0x48CEF52: g_array_maybe_expand (garray.c:1000) ==477545== by 0x48CF2DF: g_array_append_vals (garray.c:528) ==477545== by 0x4C68797: log_entry_for_multi_value_property (tracker-data-update.c:748) ==477545== by 0x4C6A433: cache_insert_metadata_decomposed (tracker-data-update.c:2211) ==477545== by 0x4C6BFF9: tracker_data_insert_statement_with_uri (tracker-data-update.c:2880) ==477545== by 0x4C6C497: tracker_data_insert_statement (tracker-data-update.c:2824) ==477545== by 0x4C8F94D: tracker_sparql_apply_quad (tracker-sparql.c:2239) ==477545== by 0x4C8FC66: translate_GraphNode (tracker-sparql.c:7466) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C82636: translate_Object (tracker-sparql.c:6537) ==477545== by 0x4C89769: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C89769: translate_ObjectList (tracker-sparql.c:6525) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C8C47D: translate_PropertyListNotEmpty (tracker-sparql.c:6491) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C82995: translate_TriplesSameSubject (tracker-sparql.c:6406) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84E3E: translate_TriplesTemplate (tracker-sparql.c:5206) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210) ==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805) ==477545== Block was alloc'd at ==477545== at 0x484178A: malloc (vg_replace_malloc.c:380) ==477545== by 0x484670B: realloc (vg_replace_malloc.c:1437) ==477545== by 0x49095BF: g_realloc (gmem.c:201) ==477545== by 0x48CEF52: g_array_maybe_expand (garray.c:1000) ==477545== by 0x48CF07C: g_array_sized_new (garray.c:287) ==477545== by 0x4C6C942: tracker_data_begin_transaction (tracker-data-update.c:3056) ==477545== by 0x4C6C995: tracker_data_begin_ontology_transaction (tracker-data-update.c:3081) ==477545== by 0x4C63F2E: tracker_data_manager_initable_init (tracker-data-manager.c:4317) ==477545== by 0x4C9E724: tracker_direct_connection_initable_init (tracker-direct.c:493) ==477545== by 0x4A656B7: g_initable_new_valist (ginitable.c:250) ==477545== by 0x4A657AC: g_initable_new (ginitable.c:164) ==477545== by 0x4C9F5AB: tracker_direct_connection_new (tracker-direct.c:1562) ==477545== by 0x4C47D20: tracker_sparql_connection_new (tracker-connection.c:1025) ==477545== by 0x40AF7B: setup_connection_and_endpoint (tracker-main.c:823) ==477545== by 0x40AF7B: main (tracker-main.c:1062) Ensure to flush harder, even if the resource would stay the same, this avoids the log array from growing past this fixed limit.
| * libtracker-sparql/core: Unlink TrackerDBStatement before removing from HTCarlos Garnacho2022-10-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hashtable destroy functions may result in the TrackerDBStatement being freed, so trying to access the MRU head after that will result in invalid memory access, seen in valgrind as: ==477545== Invalid write of size 8 ==477545== at 0x4C71DF9: tracker_db_statement_mru_insert (tracker-db-interface-sqlite.c:2656) ==477545== by 0x4C6AFF8: tracker_data_ensure_update_statement (tracker-data-update.c:1219) ==477545== by 0x4C6AFF8: tracker_data_flush_log (tracker-data-update.c:1242) ==477545== by 0x4C6AFF8: tracker_data_update_buffer_flush (tracker-data-update.c:1550) ==477545== by 0x4C6BA79: tracker_data_update_buffer_might_flush (tracker-data-update.c:1605) ==477545== by 0x4C6BADF: resource_buffer_switch (tracker-data-update.c:2534) ==477545== by 0x4C6BF2C: tracker_data_insert_statement_with_uri (tracker-data-update.c:2857) ==477545== by 0x4C6C497: tracker_data_insert_statement (tracker-data-update.c:2824) ==477545== by 0x4C6D897: update_resource_property (tracker-data-update.c:3489) ==477545== by 0x4C6D4C4: update_resource_single (tracker-data-update.c:3554) ==477545== by 0x4C6D847: update_resource_property (tracker-data-update.c:3442) ==477545== by 0x4C6D673: update_resource_single (tracker-data-update.c:3593) ==477545== by 0x4C6D847: update_resource_property (tracker-data-update.c:3442) ==477545== by 0x4C6D673: update_resource_single (tracker-data-update.c:3593) ==477545== by 0x4C6DA3D: tracker_data_update_resource (tracker-data-update.c:3626) ==477545== by 0x4CA0498: tracker_direct_batch_update (tracker-direct-batch.c:221) ==477545== by 0x4C9F8B4: update_thread_func (tracker-direct.c:286) ==477545== by 0x492F8A1: g_thread_pool_thread_proxy.lto_priv.0 (gthreadpool.c:352) ==477545== by 0x492A771: g_thread_proxy (gthread.c:831) ==477545== by 0x4D975B4: start_thread (pthread_create.c:442) ==477545== by 0x4E17F03: clone (clone.S:100) ==477545== Address 0xb2ccbe0 is 64 bytes inside a block of size 72 free'd ==477545== at 0x48440E4: free (vg_replace_malloc.c:872) ==477545== by 0x490584C: g_free (gmem.c:229) ==477545== by 0x491FE93: g_slice_free1 (gslice.c:1185) ==477545== by 0x4BFF63B: g_type_free_instance (gtype.c:2010) ==477545== by 0x48EC3C6: UnknownInlinedFun (ghash.c:1774) ==477545== by 0x48EC3C6: g_hash_table_remove (ghash.c:1802) ==477545== by 0x4C71DF5: tracker_db_statement_mru_insert (tracker-db-interface-sqlite.c:2655) ==477545== by 0x4C6AFF8: tracker_data_ensure_update_statement (tracker-data-update.c:1219) ==477545== by 0x4C6AFF8: tracker_data_flush_log (tracker-data-update.c:1242) ==477545== by 0x4C6AFF8: tracker_data_update_buffer_flush (tracker-data-update.c:1550) ==477545== by 0x4C6BA79: tracker_data_update_buffer_might_flush (tracker-data-update.c:1605) ==477545== by 0x4C6BADF: resource_buffer_switch (tracker-data-update.c:2534) ==477545== by 0x4C6BF2C: tracker_data_insert_statement_with_uri (tracker-data-update.c:2857) ==477545== by 0x4C6C497: tracker_data_insert_statement (tracker-data-update.c:2824) ==477545== by 0x4C6D897: update_resource_property (tracker-data-update.c:3489) ==477545== by 0x4C6D4C4: update_resource_single (tracker-data-update.c:3554) ==477545== by 0x4C6D847: update_resource_property (tracker-data-update.c:3442) ==477545== by 0x4C6D673: update_resource_single (tracker-data-update.c:3593) ==477545== by 0x4C6D847: update_resource_property (tracker-data-update.c:3442) ==477545== by 0x4C6D673: update_resource_single (tracker-data-update.c:3593) ==477545== by 0x4C6DA3D: tracker_data_update_resource (tracker-data-update.c:3626) ==477545== by 0x4CA0498: tracker_direct_batch_update (tracker-direct-batch.c:221) ==477545== by 0x4C9F8B4: update_thread_func (tracker-direct.c:286) ==477545== by 0x492F8A1: g_thread_pool_thread_proxy.lto_priv.0 (gthreadpool.c:352) ==477545== by 0x492A771: g_thread_proxy (gthread.c:831) ==477545== by 0x4D975B4: start_thread (pthread_create.c:442) ==477545== by 0x4E17F03: clone (clone.S:100) ==477545== Block was alloc'd at ==477545== at 0x484186F: malloc (vg_replace_malloc.c:381) ==477545== by 0x4909008: g_malloc (gmem.c:130) ==477545== by 0x4920865: g_slice_alloc (gslice.c:1074) ==477545== by 0x4920E9C: g_slice_alloc0 (gslice.c:1100) ==477545== by 0x4C0500B: g_type_create_instance (gtype.c:1913) ==477545== by 0x4BEAC4E: g_object_new_internal (gobject.c:2226) ==477545== by 0x4BEC247: g_object_new_with_properties (gobject.c:2387) ==477545== by 0x4BECFF0: g_object_new (gobject.c:2035) ==477545== by 0x4C71F4F: tracker_db_statement_sqlite_new (tracker-db-interface-sqlite.c:2985) ==477545== by 0x4C71F4F: tracker_db_interface_create_statement (tracker-db-interface-sqlite.c:2751) ==477545== by 0x4C72155: tracker_db_interface_create_vstatement (tracker-db-interface-sqlite.c:2784) ==477545== by 0x4C6B232: tracker_data_ensure_update_statement (tracker-data-update.c:1177) ==477545== by 0x4C6B232: tracker_data_flush_log (tracker-data-update.c:1242) ==477545== by 0x4C6B232: tracker_data_update_buffer_flush (tracker-data-update.c:1550) ==477545== by 0x4C6C6A0: tracker_data_update_statement (tracker-data-update.c:2994) ==477545== by 0x4C60363: tracker_data_ontology_process_statement (tracker-data-manager.c:2346) ==477545== by 0x4C60363: import_ontology_file (tracker-data-manager.c:2389) ==477545== by 0x4C6421D: tracker_data_manager_initable_init (tracker-data-manager.c:4398) ==477545== by 0x4C9E724: tracker_direct_connection_initable_init (tracker-direct.c:493) ==477545== by 0x4A656B7: g_initable_new_valist (ginitable.c:250) ==477545== by 0x4A657AC: g_initable_new (ginitable.c:164) ==477545== by 0x4C9F5AB: tracker_direct_connection_new (tracker-direct.c:1562) ==477545== by 0x4C47D20: tracker_sparql_connection_new (tracker-connection.c:1025) ==477545== by 0x40AF7B: setup_connection_and_endpoint (tracker-main.c:823) ==477545== by 0x40AF7B: main (tracker-main.c:1062)
| * libtracker-sparql/direct: Plug possible leaks on statement cancellationCarlos Garnacho2022-10-241-4/+2
| | | | | | | | | | | | Unref the task consistently after g_task_run_in_thread(), so it is properly disposed after the callback finishes execution. This avoids these callbacks from having to free the task on each return path, which they didn't.
| * libtracker-sparql/core: Plug leak in triples vtabCarlos Garnacho2022-10-241-7/+1
| | | | | | | | | | | | | | | | | | | | | | The TrackerTriplesVTab struct created to back the tracker_triples table up is not being properly freed. Since this is an eponymous-only table, we never drop the table, thus the xDisconnect vfunc is the right one for us. In case we ever wanted to drop the table, make the xDestroy method the same, since this virtual table creates no supporting non-virtual tables.
| * libtracker-sparql/core: Plug leakCarlos Garnacho2022-10-241-1/+3
| | | | | | | | | | If the binding was already referenced, the lookup string was not being freed.
* | libtracker-sparql/bus: Plug GTask leakCarlos Garnacho2022-10-231-0/+1
| | | | | | | | | | | | | | | | | | | | The task was not being unreferenced after dispatching, thus leaking a reference on its cursor source object, thus preventing it from being implicitly closed if the application does not do an explicit tracker_sparql_cursor_close(). Fixes: 4098bbda20 (libtracker-sparql: Reimplement all bus connection objects) Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/383
* | libtracker-sparql: Pass cancellable to D-Bus cursor writing operationsCarlos Garnacho2022-10-231-5/+11
| | | | | | | | | | | | | | | | | | | | | | If cancellation happens while the D-Bus endpoint is writing cursor contents for a D-Bus TrackerSparqlConnection client, we do not much in the way to stopping the FD writing operation from happening. This however also means the FD was closed by the other end, so they will fail anyway with an "Interrupted" error when writes start to fail. Make all things depend on the same cancellable, so the error is consistently G_IO_ERROR_CANCELLED and we bail out as soon as possible.
* | libtracker-sparql/bus: Pass cancellable to cursor_next() operationsCarlos Garnacho2022-10-231-6/+6
| | | | | | | | | | | | | | Presumably reading a row of content is not an expensive operation in most circumstances, anyhow it's still good to pass the cancellable to the FD reading operations, so we bail out as soon as possible after cancellation.
* | libtracker-sparql: Propagate error through taskCarlos Garnacho2022-10-231-6/+7
|/ | | | | We have this same piece of error handling in the caller, we can just propagate the error forward to the task, and warn there.
* core: Free the cache location on finalizing db managerIgnacy Kuchciński2022-10-061-0/+1
|
* core/docs: Fix various "variable may be uninitialized" warningsSam Thursfield2022-10-033-4/+4
| | | | | | None of the situations here look like potential bugs, just cases where the compiler can't verify that the variable will be initialized before it's used.
* Merge branch 'bjorn.lie-master-patch-63006' into 'master'Carlos Garnacho2022-10-011-2/+2
|\ | | | | | | | | bashcompletion: Replace deprecated egrep usage with grep -E See merge request GNOME/tracker!540
| * bash-completion: Replace deprecated egrep usage with grep -EBjørn Lie2022-10-011-2/+2
| |
* | portal: Make option entries array NULL-terminatedMoody2022-09-291-0/+1
| |
* | Merge branch 'wip/carlosg/prune-batch' into 'master'Sam Thursfield2022-09-271-0/+2
|\ \ | | | | | | | | | | | | libtracker-sparql/direct: Prune content of already executed batches See merge request GNOME/tracker!542
| * | libtracker-sparql/direct: Prune content of already executed batchesCarlos Garnacho2022-09-271-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | When using TrackerBatch from a garbage collected language, we have little control over the actual lifetime of a batch object, while at the same time we keep the GC unaware about how much memory does really depend on that object. This may cause RAM usage spikes when the GC hoards too many already executed batches during intensive data insertion. A TrackerBatch is a single-use object though, in order to ease this memory usage, we can dispose early of all inserted resources and SPARQL updates right after execution, so the TrackerBatch is left a husk when all that is left to do with it is freeing it.
* | ontologies: Move fts: prefix definition to base ontologyCarlos Garnacho2022-09-272-6/+6
|/ | | | | | | | | | | | | | This prefix is used in some of our base SPARQL API (e.g. fts:match and the misc functions to deal with results), but the prefix is currently defined in the Nepomuk ontology side. This makes applications that want to use FTS with custom ontologies either need to declare the prefix themselves, or help queries with `PREFIX` syntax to add the missing stock prefix. Move this prefix definition to the base ontology, so all databases inherit the builtin fts: prefix and it can be used right away in FTS queries.
* Merge branch 'wip/carlosg/iri-escape-fix' into 'master'Sam Thursfield2022-09-201-1/+1
|\ | | | | | | | | libtracker-sparql: Add missing character to IRI escape check See merge request GNOME/tracker!538
| * libtracker-sparql: Add missing character to IRI escape checkCarlos Garnacho2022-09-191-1/+1
| | | | | | | | | | | | The backslash character conversion is handled by the function, but not properly checked in the opt-out paths. This makes it fail to escape IRIs that only have \ as an invalid character.
* | libtracker-sparql: Set namespace on signal argument typeCarlos Garnacho2022-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | This may need a hint for projects that depend on this. Otherwise may fail like: tracker-sparql-3.0.vapi:253.60-253.86: error: The type name `GenericArray' could not be found 253 | public signal void events (string service, string graph, GenericArray<NotifierEvent> events); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ Compilation failed: 1 error(s), 1 warning(s)
* | libtracker-sparql: Clean up indentation in VAPIPayson Wallach2022-09-181-7/+7
| | | | | | | | Indentations using spaces are converted to tabs for consistency.
* | libtracker-sparql: Add `events` signal of `Notifier` class to VAPIPayson Wallach2022-09-181-0/+2
|/ | | | | To improve the Vala bindings, the `Notifier` class is completed with the `events` signal, as well as the `connection` property.
* libtracker-sparql: Fix off by one in checks for escaped IRIsCarlos Garnacho2022-09-041-2/+2
| | | | | | | | | | | | | The 0x20 character should also be escaped as per the SPARQL reference, and it correctly is when setting a TrackerResource IRI. Even though, the fast path check for the presence of characters that should be escaped is missing it, so it would be possible to let IRIs that only have this invalid character as valid. Since 0x20 (whitespace) is possibly the most ubiquitous character that should be escaped, it's a bit of an oversight. Fixes: 33031007c ("libtracker-sparql: Escape illegal characters in IRIREF...")
* libtracker-sparql: Escape illegal characters in IRIREF from TrackerResourceCarlos Garnacho2022-09-021-3/+51
| | | | | | | | | | | | | | | | | | | | | | | Currently, all IRIREF going through SPARQL updates will be validated for the characters being in the expected set (https://www.w3.org/TR/sparql11-query/#rIRIREF), meanwhile TrackerResource is pretty liberal in the characters used by a TrackerResource identifier or IRI reference. This disagreement causes has 2 possible outcomes: - If the resource is inserted via print_sparql_update(), print_rdf() or alike while containing illegal characters, it will find errors when handling the SPARQL update. - If the resource is directly inserted via TrackerBatch or update_resource(), the validation step will be bypassed, ending up with an IRI that contains illegal characters as per the SPARQL grammar. In order to make TrackerResource friendly to e.g. sloppy IRI composition and avoid these ugly situations when an illegal char sneaks in, make it escape the IRIs as defined by IRIREF in the SPARQL grammar definition. This way every method of insertion will succeed and be most correct with the given input. Also, add tests for this behavior, to ensure we escape what should be escaped.
* libtracker-sparql: Handle G_TYPE_UINT values in TrackerResource serializationCarlos Garnacho2022-08-301-0/+1
| | | | | | Even though the TrackerResource helper functions don't use this type internally, it may be set directly through tracker_resource_set_gvalue(). Handle this additional type, since it's used in some Tracker Miners extractors.
* core: Cast cursor variable to the right typeCarlos Garnacho2022-08-301-1/+1
| | | | | We are using TrackerSparqlCursor API here, passing a TrackerDBCursor. we should cast this subclass to the correct parent type.
* remote: Support newer soup API to pause/unpause messagesCarlos Garnacho2022-08-301-2/+18
| | | | | | There is new API scheduled for 3.2.0 to pause/unpause messages for deferred processing. Follow these API updates and handle it, without bumping to such newer version so far.
* libtracker-sparql: Avoid deprecated API usage warnings betterCarlos Garnacho2022-08-301-3/+6
| | | | | | | Or the right way. We still use at places tracker_namespace_manager_get_default() to preserve backwards compatible behavior, so these deprecated warnings should be avoided with G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS.