Bug 396535 - Balooctl seems to assume folders with hyphens in name are subfolders
Summary: Balooctl seems to assume folders with hyphens in name are subfolders
Status: RESOLVED FIXED
Alias: None
Product: frameworks-baloo
Classification: Frameworks and Libraries
Component: balooctl (show other bugs)
Version: 5.47.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: James Ausmus
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2018-07-15 14:09 UTC by Kishore Gopalakrishnan
Modified: 2018-09-30 01:17 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.51
Sentry Crash Report:


Attachments
Fixes issue by appending path separator to parent dir check (1.94 KB, patch)
2018-08-23 05:49 UTC, James Ausmus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2018-07-15 14:09:03 UTC
Steps to reproduce:
1. Create folders '~/test1', '~/test2' and '~/test1-test'
2. Run 'balooctl config add excludeFolders ~/test1'
3. Run 'balooctl config add excludeFolders ~/test2'
4. Run 'balooctl config add excludeFolders ~/test1-test'

Observed results:
Commands in step 2 and 3 succeed, but command in step 4 fails with output 'Parent folder /home/user/test1 is already in the list of exclude folders'

Expected results:
All three commands should be able to add the respective folders to the list of excluded folders.

Baloo seems to detect folders with hyphens in name as subfolders. This should not happen. Quoting the filename and giving the full path does not seem to affect this behaviour. However, adding via the graphical settings (System settings > search > file search) works for such folders.

Sorry for the title, but I couldn't think of a proper way to describe this in that space in a more specific way.
Comment 1 James Ausmus 2018-08-23 05:15:28 UTC
It looks like the issue isn't related to the hyphen, but rather that '~/test1-test' doesn't get past the "path.startsWith(folder)" check when folder is '~/test1' - proposed patch momentarily
Comment 2 James Ausmus 2018-08-23 05:49:50 UTC
Created attachment 114556 [details]
Fixes issue by appending path separator to parent dir check
Comment 3 Christoph Feck 2018-09-13 15:39:37 UTC
Thanks James for the patch! Could you please add it to https://phabricator.kde.org/differential/diff/create/ so that developers can review it?

We have more information about Phabricator at https://community.kde.org/Infrastructure/Phabricator
Comment 4 Nate Graham 2018-09-18 02:19:52 UTC
No response from James; I have submitted the patch at https://phabricator.kde.org/D15583
Comment 5 Nate Graham 2018-09-30 01:17:44 UTC
Git commit 2452ce28193a7cf4843a8f617f3fe29c6643fd96 by Nathaniel Graham.
Committed on 30/09/2018 at 01:17.
Pushed by ngraham into branch 'master'.

[Balooctl] remove directory parent check

Summary:
`balooctl add includeFolders/excludeFolders` was checking for parent directories before allowing the user to add a subdirectory. This is unnecessary since Baloo itself supports the logic of (for example) excluding `~/foo` but including `~/foo/bar`. Removing the check solves the problem and fixes 396535.
FIXED-IN: 5.51

Test Plan:
```
mkdir ~/test1 ~/test2 ~/test1-test ~/test1-test/foo
balooctl config add excludeFolders ~/test1
balooctl config add excludeFolders ~/test2
balooctl config add excludeFolders ~/test1-test
balooctl config add includeFolders ~/test1-test/foo
```

If it worked, you don't get any errors.

Reviewers: #baloo, #dolphin, bruns, #frameworks, cfeck

Reviewed By: #baloo, bruns

Subscribers: smithjd, anthonyfieroni, kde-frameworks-devel

Tags: #frameworks, #baloo

Differential Revision: https://phabricator.kde.org/D15583

M  +0    -14   src/tools/balooctl/configcommand.cpp

https://commits.kde.org/baloo/2452ce28193a7cf4843a8f617f3fe29c6643fd96