Bug 478854 - Baloo_file ASSERT failures when creating/renaming folders
Summary: Baloo_file ASSERT failures when creating/renaming folders
Status: RESOLVED FIXED
Alias: None
Product: frameworks-baloo
Classification: Frameworks and Libraries
Component: Baloo File Daemon (show other bugs)
Version: 5.247.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: baloo-bugs-null
URL:
Keywords: qt6, regression
Depends on:
Blocks:
 
Reported: 2023-12-21 22:35 UTC by tagwerk19
Modified: 2024-03-30 05:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: Frameworks 6.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tagwerk19 2023-12-21 22:35:24 UTC
SUMMARY

    Baloo_file fails with an ASSERT when creating/renaming a folder

STEPS TO REPRODUCE

    1.  Create a test folder
         $ cd
         $ mkdir folder
         $ echo "Hello Penguin" > folder/test.txt
    2.  See that it is indexed
    3.  Rename the folder
         $ mv folder folder2

OBSERVED RESULT

    Dec 21 18:48:45 barking baloo_file[3362]: kf.baloo: "/home/test/folder/" -> "/home/test/folder2/"
    Dec 21 18:48:45 barking baloo_file[3362]: KCrash: appFilePath points to nullptr!
    Dec 21 18:48:45 barking baloo_file[3362]: KCrash: Application '<unknown>' crashing... crashRecursionCounter = 2
    Dec 21 18:48:45 barking baloo_file[3362]: ASSERT: "from[from.size()-1] != QLatin1Char('/')" in file ./src/file metadatamover.cpp, line 80
    Dec 21 18:48:45 barking systemd-coredump[3371]: Process 3362 (baloo_file) of user 1001 dumped core.

SOFTWARE/OS VERSION

    Neon Unstable
    Plasma : 5.90.90
    Frameworks: 5.247.0
    Qt: 6.6.1
    Kernel: 6.2.0-39-generic (64-bit)
    Filesystem: Ext4 or BTRFS

ADDITIONAL INFORMATION

    Possible to reproduce on a new install of Neon Unstable, works of Neon Testing.

    Also crashes when creating a folder:

        baloo_file[1237]: ASSERT: "!filePath.endsWith(QLatin1Char('/'))" in file ./src/file/newfileindexer.cpp, line 38

    but not when creating or renaming files.
Comment 1 tagwerk19 2023-12-22 13:17:53 UTC
A couple more points...

It is not related to content indexing, the crash happens immediately when the folder is created or renamed.

If baloo is not running and the folder is created, then baloo indexes it without problems when it is started.
Comment 2 tagwerk19 2024-01-02 21:26:30 UTC
(In reply to tagwerk19 from comment #0)
>  ... Possible to reproduce on a new install of Neon Unstable ...
It's there with:
    neon-unstable-20231224-1120.iso
As vanilla as I can make it: Installed as KVM guest, on AMD Ryzen 5 host, ext4 filesystem, en-US locale.
    Plasma: 5.91.90
    Frameworks: 5.248.0
    Qt: 6.6.1
    Kernel: 6.2.0-39-generic (64-bit)
    Graphics: Wayland

Sequence:
    $ xdg-user-dirs-update (for tidiness)
    $ systemctl --user restart kde-baloo
    $ mkdir folder
    $ systemctl --user status kde-baloo
shows the ASSERT in baloo_file:
    "!filePath.endsWith(QLatin1Char('/'))" in file ./src/file/newfileindexer.cpp, line 38

Renaming the folder
    $ systemctl --user restart kde-baloo
    $ mv folder folder2
    $ systemctl --user status kde-baloo
shows the ASSERT:
    "from[from.size()-1] != QLatin1Char('/')" in file ./src/file metadatamover.cpp, line 80
Comment 3 tagwerk19 2024-01-07 12:50:32 UTC
(In reply to tagwerk19 from comment #2)
> ... KVM guest, on AMD Ryzen 5 host ...
Not just. Also there on an old Intel Core I3 host...

Plus cross reference:
    https://invent.kde.org/frameworks/baloo/-/merge_requests/119#note_732995
Comment 4 tagwerk19 2024-01-07 22:39:12 UTC
Repeating with
    neon-unstable-20240107-1119.iso
    The issue is still present

Some history: There's
    Bug 435161
Where I wasn't able to replicate
    https://bugs.kde.org/show_bug.cgi?id=435161#c11
and
    https://invent.kde.org/frameworks/baloo/-/merge_requests/71

A similar, as vanilla as possible, neon-testing
    neon-testing-20240102-0250.iso
setup works for me, tried:
    mkdir folder
    mv folder folder2
    setfattr -n user.xdg.tags -v Penguin folder2
There are some debug messages but no asserts.
Comment 5 tagwerk19 2024-01-22 18:32:42 UTC
Checked with neon-unstable-20240122-1334.iso, with the same conditions and the issue is still there.

Is it possible that the assert is inverted? If the two folders given in the debug both have trailing slashes, an assert that fails if one doesn't seems strange. There are normalizeTrailingSlashes functions there in the code and they ensure that the name has a trailing slash.

    Dec 21 18:48:45 barking baloo_file[3362]: kf.baloo: "/home/test/folder/" -> "/home/test/folder2/"
    ...
    Dec 21 18:48:45 barking baloo_file[3362]: ASSERT: "from[from.size()-1] != QLatin1Char('/')" in file ./src/file metadatamover.cpp, line 80
Comment 6 Bug Janitor Service 2024-01-28 18:08:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/baloo/-/merge_requests/184
Comment 7 tagwerk19 2024-02-15 16:13:56 UTC
(In reply to Bug Janitor Service from comment #6)
> A possibly relevant merge request was started @
> https://invent.kde.org/frameworks/baloo/-/merge_requests/184
Should this have reached "Neon Unstable"?

Just tested with neon-unstable-20240211-1119.iso and I still get ASSERT failures (testing as per Comment 2)
Comment 8 tagwerk19 2024-03-23 15:20:35 UTC
(In reply to tagwerk19 from comment #7)
> Just tested with neon-unstable-20240211-1119.iso and I still get ASSERT
> failures (testing as per Comment 2)
Tried with neon-user-20240321-0715.iso, looks as if the bug (comment 2) is still with us...
Comment 9 tagwerk19 2024-03-24 06:40:54 UTC
(In reply to tagwerk19 from comment #8)
> Tried with neon-user-20240321-0715.iso, looks as if the bug (comment 2) is still with us...
I'm not sure what's happened here, I've tried:
    neon-user-20240321-0715.iso
    neon-testing-20240314-1503.iso
    neon-unstable-20240317-1117.iso
and they all fail with the Assert. That did not used to happen. 

My assumption was that Q_ASSERTS cause crashes when the code is compiled in debug mode, otherwise they were silent. Maybe someone could correct me here :-).

Could it be that Neon User is being compiled in "debug"? If that is the case, this is a regression.
Comment 10 Christoph Cullmann 2024-03-29 17:52:32 UTC
Git commit 33756dd44c4f67a7984fa4c5da61726b46aa6bc6 by Christoph Cullmann, on behalf of Méven Car.
Committed on 29/03/2024 at 17:52.
Pushed by cullmann into branch 'master'.

Some indexers need non-slash trailed path

Fix regression introduced in 73183acf, prior to this commit all path
from KInotify did not have a trailing slash, adjust in consequence.

9b61371fdefbd538938f20cdc87eed03d170fa5b adjusted BasicIndexingJob but
not the other cases.

Add some missing unit test cases, although they don't cover the bug
cases, they allow to illustrate the crash conditions.

Superseeds https://invent.kde.org/frameworks/baloo/-/merge_requests/119

cc @tagwerk19.invent @cullmann

M  +123  -0    autotests/unit/file/filewatchtest.cpp
M  +7    -2    src/file/metadatamover.cpp
M  +5    -2    src/file/modifiedfileindexer.cpp
M  +5    -2    src/file/newfileindexer.cpp
M  +5    -2    src/file/xattrindexer.cpp

https://invent.kde.org/frameworks/baloo/-/commit/33756dd44c4f67a7984fa4c5da61726b46aa6bc6