Bug 221155 - Add collection fails on similarly named directories (seems that check is not strict enough)
Summary: Add collection fails on similarly named directories (seems that check is not ...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Setup-Collections (show other bugs)
Version: 1.0.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-03 21:27 UTC by Luka Renko
Modified: 2017-08-09 20:29 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.2.0


Attachments
screenshot of the error (22.17 KB, image/png)
2010-01-03 23:05 UTC, Luka Renko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luka Renko 2010-01-03 21:27:58 UTC
Version:            (using KDE 4.3.4)
OS:                Linux
Installed from:    Ubuntu Packages

Report from Ubuntu bug:

I have 2 collections :
- ~/Images/apn
- ~/Images/apn-reflex

If I add the apn one first, then I have an error message when adding apn-reflex : "you already added a collection which contains apn-reflex" (my own translation), while apn-reflex is not a subfolder of apn…

If I add the second first, it works…

I have reproduced the problem with digikam 1.0.0 and it seems the problem is that the function that checks the directory name wrongly identify similarly named directory as duplicate collection.
Comment 1 caulier.gilles 2010-01-03 21:55:13 UTC
Message error is this one ?

http://lxr.kde.org/source/extragear/graphics/digikam/utilities/setup/setupcollectionview.cpp#466

Gilles Caulier
Comment 2 Luka Renko 2010-01-03 23:05:59 UTC
Created attachment 39536 [details]
screenshot of the error

No, it is the error as shown in attachment.
Comment 3 Marcel Wiesweg 2010-01-21 19:17:59 UTC
rootPath = ~/Images/apn
filePath = ~/Images/apn-reflex/xyz

if (filePath.startsWith(rootPath))
{
    ...
}

That's the current code. The mistake is obvious, you already point to it above.
I want to avoid accessing the filesystem here, just compare strings.
Comment 4 Marcel Wiesweg 2010-01-21 19:23:26 UTC
SVN commit 1078190 by mwiesweg:

Add extra check to compare directories

CCBUG: 221155

 M  +7 -3      collectionmanager.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1078190
Comment 5 Marcel Wiesweg 2010-01-21 19:24:17 UTC
Luka, would you like to test?
Comment 6 Marcel Wiesweg 2010-01-26 22:27:09 UTC
*** Bug 216017 has been marked as a duplicate of this bug. ***
Comment 7 Luka Renko 2010-02-04 09:52:26 UTC
Marcel, I tested it now with 1.1, and the problem is not fixed. :-(
Comment 8 Marcel Wiesweg 2010-02-04 19:58:19 UTC
Ok I see. It does not work when you add the two collections in one go, does it? Didn't test that case. When you close the dialog in between, it works. And at least you get now a meaningful error message ;-)
Will fix this.
Or did you test another case?
Comment 9 Luka Renko 2010-02-05 09:02:00 UTC
Marcel, you are correct:
- if I add both collections in one go (same dialog) -> fail
- add first collection, close, add second connection -> OK

A side note: when adding directories of local FS (it is on dm-crypt+LVM volume), I get the following warning:
It is not possible on your system to identify the storage medium of this path. It will be added using the file path as the only identifier. This will work well for your local disk.

Since this is the local disk, I think this warning will just confuse the user...
Comment 10 doc.evans 2010-02-05 17:01:47 UTC
(In reply to comment #9)

> 
> A side note: when adding directories of local FS (it is on dm-crypt+LVM
> volume), I get the following warning:
> It is not possible on your system to identify the storage medium of this path.
> It will be added using the file path as the only identifier. This will work
> well for your local disk.
> 
> Since this is the local disk, I think this warning will just confuse the
> user...

I agree that I always find this a very odd warning. Basically it seems to say "here's a problem -- although what the problem is isn't at all obvious -- but you can ignore this message if you're using a local disk". 

I've always ignored it, but also every time I see it I wonder "what would I do if I received this message but was using a FUSE filesystem that was physically remote but appeared as a local disk to the system?" There doesn't seem to be any advice given as to what to do if you're not using a local disk. So, yes, all-in-all, the user is left with no clear idea what the message means, nor whether it really affects him, nor what to do about it. So anything you can do to improve this situation would be A Good Thing.
Comment 11 Marcel Wiesweg 2010-02-05 19:23:55 UTC
Any better suggestions for the message?
The technical background is that Solid does not provide information for such storage devices, so in fact we dont now what it is and fall back to the mount path.
This can happen is Solid/HAL does not support the local setup - as I would suspect for the LVM mentioned above. This should be fixed in HAL.
The problem can also happen when Solid is not working correctly, which is a platform or installation issue.
It also covers all other cases, which we did not expect and which I dont mention here therefore.
Comment 12 Marcel Wiesweg 2010-02-06 14:41:11 UTC
SVN commit 1086098 by mwiesweg:

Apply the same fix as for CollectionManager in the setup code as well
(this code test not-yet-added collections, which are unknown to collectionmanager)

BUG: 221155

 M  +2 -1      NEWS  
 M  +10 -5     utilities/setup/setupcollectionview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1086098