| Summary: | Wrong free disk space displayed when directory beginn with the same name | ||
|---|---|---|---|
| Product: | [Applications] dolphin | Reporter: | Thomas Thym <ungethym> |
| Component: | bars: status | Assignee: | Dolphin Bug Assignee <dolphin-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | adaptee |
| Priority: | NOR | Keywords: | investigated, triaged |
| Version First Reported In: | 2.1 | ||
| Target Milestone: | --- | ||
| Platform: | openSUSE | ||
| OS: | Linux | ||
| Latest Commit: | http://commits.kde.org/kdelibs/4f2ecbabfa5bec07985175798ea20d90bdca9f82 | Version Fixed/Implemented In: | 4.10.3 |
| Sentry Crash Report: | |||
|
Description
Thomas Thym
2009-05-19 23:50:25 UTC
Still reproducing using dolphin 2.1 . To make the report clear, the two folders are "~/Videos"(the mount point) and "~/Videos-Home" . Actually, the same problem can be reproduced using "~/book" ( the mount point) and "~/books" (a empty folder) . This is actually a bug of kdelibs.
in kdelibs/kio/kfile/kdiskfreespaceinfo.cpp
KDiskFreeSpaceInfo KDiskFreeSpaceInfo::freeSpaceInfo( const QString& path )
{
...
KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByPath( path );
...
}
in kdelibs/kdecore/io/kmountpoint.cpp
KMountPoint::Ptr KMountPoint::List::findByPath(const QString& path) const
{
...
int max = 0;
KMountPoint::Ptr result;
for (const_iterator it = begin(); it != end(); ++it) {
const QString mountpoint = (*it)->d->mountPoint;
const int length = mountpoint.length();
if (realname.startsWith(mountpoint) && length > max) {
max = length;
result = *it;
// keep iterating to check for a better match (bigger max)
}
}
}
So if "/home/myself/book" is a mount point, "/home/myself/books" will be seen as
belonging to the partition mounted at "/home/myself/book", which is clearly wrong.
Resetting assignee to default as per bug #305719 Good investigation, Jekyll! Maybe one could solve this by using KUrl::isParentOf(const KUrl&), rather than QString:.startsWith(const QString&)? Git commit 4f2ecbabfa5bec07985175798ea20d90bdca9f82 by Frank Reininghaus. Committed on 28/04/2013 at 22:19. Pushed by freininghaus into branch 'KDE/4.10'. Fix KMountPoint::List::findByPath(): /books is not a child of /book Thanks to Jekyll Wu for the analysis and to David Faure for pointing out another problem which I had missed. FIXED-IN: 4.10.3 REVIEW: 110225 M +20 -1 kdecore/io/kmountpoint.cpp http://commits.kde.org/kdelibs/4f2ecbabfa5bec07985175798ea20d90bdca9f82 |