Skip to content

Commit

Permalink
[tracker] Disable metadata writes from MTP to tracker. Fixes JB#51156
Browse files Browse the repository at this point in the history
When files are transferred onto the device via MTP, clients can optionally
supply metadata for those files. This data is written directly to
Tracker's database, creating entries that would normally be created
by tracker-miner-fs and tracker-extract. There is code intended to tell
Tracker not to index the new files, but it has never been enabled in
Sailfish, it if it ever was.

With the new Tracker upgrade to 2.3.4, this behaviour has caused problems:
 - There are several errors and inconsistencies with tracker in the
 supplied data and how it is stored. This code has been unmaintained for
 several years.
 - Tracker tries to write its own data, but doesn't recognize the
 MTP sourced data because it intentionally ignores anything it's not
 the source for. This causes uniqueness errors in the backend which breaks
 indexing and further updates.

This commit disables the storage of metadata by MTP, but does not remove
the code. Tracker data is still read and made available to clients. This
leaves a lot of dead code that should be cleaned up at some point once
we're sure this is the way to go.

Signed-off-by: Andrew Branson <andrew.branson@jolla.com>
  • Loading branch information
abranson committed Sep 18, 2020
1 parent 6154180 commit 2636c4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mts/platform/storage/fsstorageplugin/fsstorageplugin.cpp
Expand Up @@ -3533,8 +3533,9 @@ MTPResponseCode FSStoragePlugin::setObjectPropertyValue( const ObjHandle &handle
}
if(true == sendObjectPropList)
{
m_tracker->setPropVals(storageItem->m_path, propValList);
#if 0
// Disable this as tracker extracts better information, and doesn't like data from other sources.
m_tracker->setPropVals(storageItem->m_path, propValList);
// Ask tracker to ignore the current file, this is because we already have
// all required metadata from the initiator.
m_tracker->ignoreNextUpdate(QStringList(m_tracker->generateIri(storageItem->m_path)));
Expand Down
7 changes: 5 additions & 2 deletions mts/platform/storage/fsstorageplugin/storagetracker.cpp
Expand Up @@ -181,7 +181,10 @@ void StorageTracker::populateFunctionMap()
m_handlerTable[MTP_OBJ_PROP_Buffer_Size] = getBufferSize;
m_handlerTable[MTP_OBJ_PROP_Encoding_Quality] = getEncodingQuality;
#endif

/* These direct settings of file properties aren't expected by tracker, and don't match what tracker
* is expecting. Disable them as they cause an error in tracker-extract when it tries to update them
*/
#if 0
// Setters
m_handlerTableUpdate[MTP_OBJ_PROP_Date_Created] = setDateCreated;
m_handlerTableUpdate[MTP_OBJ_PROP_Name] = setName;
Expand Down Expand Up @@ -210,7 +213,7 @@ void StorageTracker::populateFunctionMap()
m_handlerTableUpdate[MTP_OBJ_PROP_Use_Count] = setUseCount;
m_handlerTableUpdate[MTP_OBJ_PROP_DRM_Status] = setDRMStatus;
// We don't support the below as of now.
#if 0

m_handlerTableUpdate[MTP_OBJ_PROP_Keywords] = setKeywords;
m_handlerTableUpdate[MTP_OBJ_PROP_Subtitle] = setSubtitle;
m_handlerTableUpdate[MTP_OBJ_PROP_Hidden] = setHidden;
Expand Down

0 comments on commit 2636c4f

Please sign in to comment.