Bug 433116 - Baloo looses filename after rename
Summary: Baloo looses filename after rename
Status: RESOLVED FIXED
Alias: None
Product: frameworks-baloo
Classification: Frameworks and Libraries
Component: Engine (show other bugs)
Version: 5.78.0
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Stefan Brüns
URL:
Keywords:
: 392793 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-02-17 20:55 UTC by GreggB
Modified: 2023-07-10 16:05 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.81


Attachments
console log of test (458 bytes, text/x-log)
2021-02-17 20:55 UTC, GreggB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description GreggB 2021-02-17 20:55:29 UTC
Created attachment 135792 [details]
console log of test

SUMMARY
When a file is renamed, Baloo is unable to find the file under the new (or old) name.

STEPS TO REPRODUCE
1. Create an empty file
2. Baloosearch filename to confirm indexed.
3. Rename file.
4. Baloosearch new filename.

OBSERVED RESULT

After the file is renamed, baloosearch returns no results.

EXPECTED RESULT

Baloosearch for new filename should return that filename.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

This may be a repeat of 392793 But bug 392793 involves Dolphin which complicates the issue, since Dolphin seems to exhibit different behaviour when a file is renamed.
Comment 1 tagwerk19 2021-02-17 22:44:36 UTC
See the same behaviour.

Can add that before the file is moved, balooshow gives:

    balooshow -x zwzwzw.txt
    4535846241893377 64513 1056084 zwzwzw.txt [/home/test/Documents/zwzwzw.txt]
            Mtime: 1613600991 2021-02-17T23:29:51
            Ctime: 1613600991 2021-02-17T23:29:51

    Internal Info
    Terms: Mapplication Mx Mzerosize
    File Name Terms: Ftxt Fzwzwzw
    XAttr Terms: 

whereas after:

    balooshow -x zwzwz.txt
    4535846241893377 64513 1056084 zwzwz.txt [/home/test/Documents/zwzwz.txt]
            Mtime: 1613600991 2021-02-17T23:29:51
            Ctime: 1613600991 2021-02-17T23:29:51

    Internal Info
    Terms: Mapplication Mx Mzerosize
    File Name Terms:
    XAttr Terms: 

That is, without the "File Name Terms".

It seems not to matter if the file is empty or a text file. Baloo does pick up the details if the file is touched

    touch zwzwz.txt

    balooshow -x zwzwz.txt
    4535846241893377 64513 1056084 zwzwz.txt [/home/test/Documents/zwzwz.txt]
            Mtime: 1613601583 2021-02-17T23:39:43
            Ctime: 1613601583 2021-02-17T23:39:43

    Internal Info
    Terms: Mapplication Mx Mzerosize
    File Name Terms: Ftxt Fzwzwz
    XAttr Terms: 

SYSTEM INFORMATION

    Neon Testing
    Plasma : 5.21.0
    Frameworks : 5.79.0
    Qt : 5.15.2
Comment 2 tagwerk19 2021-03-08 17:40:40 UTC
Looked at some older systems...

Fedora 32 (baloo 5.73)

    I did not see baloo "losing" the File Name Terms on a rename;
    if I mv'd a file balooshow would show the new File Name Terms
    "immediately" (or most likely faster than it would have
    taken baloo_file_extractor to read and change the details)

So the "empty" File Name Terms issue has arrived since then...
Comment 3 tagwerk19 2021-03-08 18:17:40 UTC
I can, with substantial contortions, generate multiple entries with the same filename (Baloo 5.80.0)

Check what directories baloo are indexing. Need a directory, "Test", that you can initially index, then disable indexing and finally index again. Maybe not a realistic scenario but at least it's something to test.

In "Test", create or download a test file, call it file1.txt, copy it to file2.txt, file3.txt, file4.txt, file5.txt ....

Check that baloo has indexed it, look with

    balooshow -x file1.txt
    balooshow -x file2.txt
    etc...

etc and also

    baloosearch txt

Drop "Test" from the indexed directories, do a "balooctl check" (but not a "balooctl purge").

Move a file or two:

    mv file4.txt file3.txt

Baloosearch won't see any of the changes

    baloosearch txt

    /home/test/file4.txt
    /home/test/file3.txt
    /home/test/file1.txt
    /home/test/file2.txt
    /home/test/file5.txt

Reenable indexing of "Test" and run "balooctl check" again

    baloosearch txt

now shows:

    /home/test/file3.txt
    /home/test/file3.txt
    /home/test/file1.txt
    /home/test/file2.txt
    /home/test/file5.txt

SOFTWARE/OS VERSIONS
    Neon Testing

    Baloo : 5.80.0
    Plasma : 5.21.2
    Frameworks : 5.80.0
    Qt: 5.15.2
Comment 4 tagwerk19 2021-03-08 20:17:46 UTC
Oh dear...

The above was pasted into the wrong report

Makes more sense appended to Bug 429006
Comment 5 Ignacio Serantes 2021-03-18 20:05:42 UTC
This is a duplicate bug. I wrote a fix in https://bugs.kde.org/show_bug.cgi?id=392793.
Comment 6 Nate Graham 2021-03-18 20:46:51 UTC

*** This bug has been marked as a duplicate of bug 392793 ***
Comment 7 Stefan Brüns 2021-03-27 21:34:26 UTC
Git commit f6a7845b8f3cd3188053ba58f9fe7053558aec86 by Stefan Brüns.
Committed on 27/03/2021 at 12:37.
Pushed by bruns into branch 'master'.

[MetadataMover] Update filename terms when moving/renaming file

After the removal of BasicIndexingJob::index() (bd1041ea2826e295 "Make
renames a DB only operation") the filename terms where left empty.

M  +0    -3    autotests/unit/file/metadatamovertest.cpp
M  +6    -0    src/file/metadatamover.cpp

https://invent.kde.org/frameworks/baloo/commit/f6a7845b8f3cd3188053ba58f9fe7053558aec86
Comment 8 Stefan Brüns 2021-03-27 21:34:34 UTC
Git commit 24da759545088060b863fef13496a5b22a5534d6 by Stefan Brüns.
Committed on 27/03/2021 at 12:37.
Pushed by bruns into branch 'master'.

[MetadataMover] Extend renaming test cases

Verify document terms are unchanged, and filename terms are properly set.

M  +68   -18   autotests/unit/file/metadatamovertest.cpp

https://invent.kde.org/frameworks/baloo/commit/24da759545088060b863fef13496a5b22a5534d6
Comment 9 Nate Graham 2021-03-27 23:06:11 UTC
Nice!
Comment 10 Nate Graham 2021-03-27 23:06:33 UTC
Does this mean Bug 392793 is also fixed, or is that a separate issue?
Comment 11 tagwerk19 2021-03-28 08:20:48 UTC
Checking on Neon Unstable, Baloo 5.81.0

Test as per Comment 1 now works for me. Thanks!
Comment 12 Stefan Brüns 2023-07-10 16:05:55 UTC
*** Bug 392793 has been marked as a duplicate of this bug. ***