Bug 416782

Summary: Baloo ignores exclude folders if excluded folders is parent of a listed folder
Product: [Frameworks and Libraries] frameworks-baloo Reporter: Oded Arbel <oded>
Component: generalAssignee: Stefan Brüns <stefan.bruens>
Status: RESOLVED NOT A BUG    
Severity: normal CC: nate
Priority: NOR    
Version First Reported In: 5.66.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Oded Arbel 2020-01-26 10:53:35 UTC
SUMMARY

Using `kcm_baloofile` or manually editing `~/.config/baloofilerc` , I have added `/snap` and `/run` General->exclude folders list.

Then using `balooctl monitor` I can see that baloo does index files under `/snap` and `/run`.

Looking at the `~/.config/baloofilerc` file, I can see that `kcm_baloofile` automatically lists all mountpoints on the system in General->folders, and as I'm using snaps and have a few tmpfs and bound mounts mounted under /run, the list in "folders" includes paths under `/snap` and `/run`.

STEPS TO REPRODUCE
1. Have some mount points active under `/snap` and `/run`
2. kill all baloo processes, remove `~/.config/baloo*` and `~/.local/share/baloo`
3. Launch baloo KCM, add `/snap` and `/run` to exclude paths, and enable indexing.
4. run `balooctl monitor`

OBSERVED RESULT
The monitor shows various files under `/run` and `/snap` being indexed.

EXPECTED RESULT
No files under `/run` and `/snap` should be indexed.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.67.0
Qt Version: 5.12.4

ADDITIONAL INFORMATION
This may or may not be related to bug 362622, but I didn't completely understand that issue so I'm opening a new one.

I think there are three different use cases, when considering what is listed under "exclude folders[$e]" vs. and what is listed under "folders[$e]" (where "folders[$e]" is what `kcm_baloofile` adds automatically):
1. Excluded folder is a parent of an included folder (this issue).
2. Excluded folder matches exactly an included folder (I believe this is bug 362622).
3. Excluded folder is under an included folder (I believe this is bug 401120, which from my experience is also a problem).

BTW, running `balooctl config show excludeFolders`, as in bug 401120:

```
$ balooctl config show excludeFolders 2>/dev/null
/home/odeda//Documents/Projects/ 
/home/odeda//mnt/
```

but

```
$ grep 'exclude folders' ~/.config/baloofilerc 
exclude folders[$e]=$HOME/Documents/Projects,$HOME/mnt,/run,/snap
```

(this configuration was done exclusively using kcm_baloofile, but also using `balooctl config add excludeFolders <path>` doesn't report an error but doesn't change anything either while `balooctl config set excludefolders <anything>` just outputs an error).
Comment 1 Stefan Brüns 2020-03-20 18:49:18 UTC
Baloo uses pathes to determine is a file/folder should be indexed.

If you bind-mount some path into your home directory, it will be indexed. It does not care if it is excluded under some other name. Exclude the name of the bind mount.

Indexing an include folder which is a child of an excluded folder is intended behaviour. Vice-versa not indexing an excluded folder which is a child of an included one.