Re: [Tracker] PATCH: Fix segfault in tracker-ontologies (shows in tracker-miner-fs) when ontologies are missing



Ho Jonatan,

I don't really agree with this approach. We should not 'just' check for NULL and let the software continue as if nothing happens. Invalid ontologies means that we can't go on. So abort() is probably the only sensible way out.

Trying to accept that stuff returns NULL and then happily continuing the rest of the software isn't really an option. Either the software can do its stuff and then it does it, or it can't and then it aborts (with an appropriate error message and/or error mechanism). Trying to continue and by that further destroying data and/or corrupt databases is not good.

In this case what could also be done, if you do want to improve error-handling, is that tracker-store returns an error for each and every of its D-Bus calls. I don't consider trying to handle NULL an improvement (rather, it's worse that way as you know about the problem later in the code rather than sooner this way).

Kind regards,

Philip

Jonatan Pålsson schreef op 8/08/2013 15:42:
Hi list,

When moving the ontology directory around (I recently submitted a
patch for this functionality), I noticed that tracker-miner-fs
segfaults when the ontologies are not found. I think there should be a
check for ontology presence, and also ontology validity, but have not
yet implemented this.

I have however added some checks for the return value of the
gvdb_table_list () function, which seems to return NULL when the gvdb
files are bad. These files go bad when no ontologies are loaded.

To reproduce the segfaults, move the $PREFIX/share/tracker/ontologies
directory temporarily, so that it cannot be found. Or apply the
previous patch which allows configuring the ontology directory path,
and mess the path up from DConf ;)

The following patch guards for NULLs when reading gvdb files during
the loading of namespaces, classes and properties. Warning messages
are printed when either of the aforementioned values are missing.

Here's the patch:
https://github.com/Pelagicore/tracker-ivi/commit/d643bbfe0442d43c83124aebc0c55470f5675117




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]