• Martin Kampas's avatar
    miner-fs: Fix handling files moved soon after creating · 7902523b
    Martin Kampas authored
    Noticed this when executing functional tests for write-back:
    
    (tracker-miner-fs:21288): Tracker-CRITICAL **: Could not execute sparql:
     Subject `(null)' is not in domain `nfo:FileDataObject' of property
     `nfo:fileName'
    
    This warning happens in item_move() when the source just didn't have
    time to be indexed. One example:
    
    copy ("file.txt", "temp_XYZ.file.txt")
     - received G_FILE_MONITOR_EVENT_CREATED ("temp.file.txt")
     - received G_FILE_MONITOR_EVENT_CHANGED ("temp.file.txt")
     - received G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT ("temp.file.txt")
    modify ("temp_XYZ.file.txt")
     - received G_FILE_MONITOR_EVENT_CHANGED ("temp.file.txt")
     - received G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT ("temp.file.txt")
    mv ("temp_XYZ.file.txt", "file.txt")
     - received G_FILE_MONITOR_EVENT_MOVED ("temp.file.txt", "file.txt")
     - emitted  ITEM_MOVED ("temp.file.txt", "file.txt")
    
    It was already handled in item_move() in past, but removed with eef0e7f3
    (libtracker-miner: Remove useless code) after previously misidentified
    as useless in scope of ee58e679 (libtracker-miner: Add compat layer for
    tracker_miner_fs_directory_*)
    
    The comment from ee58e679 """FIXME: This situation shouldn't happen from
    a TrackerFileNotifier event""" simply cannot be satisfied: no way to get
    "temp.file.txt" indexed before ITEM_MOVED is processed - the file
    disappears too fast.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678986
    7902523b
tracker-miner-fs.c 135 KB