[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 193298] Wrong free disk space displayed when directory beginn with the same name
From:       Jekyll Wu <adaptee () gmail ! com>
Date:       2012-08-17 12:32:25
Message-ID: bug-193298-17878-Z5Bkl9aE42 () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=193298

--- Comment #2 from Jekyll Wu <adaptee@gmail.com> ---
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.

-- 
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic