Bug 245226 - Dolphin doesn't show free space on samba shares
Summary: Dolphin doesn't show free space on samba shares
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Unmaintained
Component: smb (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-20 15:05 UTC by karaluh
Modified: 2014-09-14 16:54 UTC (History)
7 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description karaluh 2010-07-20 15:05:51 UTC
Version:           unspecified
OS:                Linux

dolphin displays free space on the right side of the status bar. On samba shares the bar is empty with Unknown size label.

Reproducible: Didn't try




OS: Linux (i686) release 2.6.32-0206321505-generic
Compiler: cc
Comment 1 FiNeX 2010-08-02 14:15:19 UTC
@Peter: Is this information available trough the SMB protocol?
Comment 2 Peter Penz 2010-08-08 11:18:54 UTC
> @Peter: Is this information available trough the SMB protocol?

@FiNeX: I don't know :-( Dolphin uses KDiskFreeSpaceInfo for getting this information. I had a short look at the code, but I'm not sure. I guess David or Sebastian might be able to answer this question off the bat.
Comment 3 David Faure 2010-08-11 17:21:36 UTC
I don't know enough about the SMB protocol to answer this.
If SMB provides this info, then we also have to make it available as a kioslave special() command, but that's the 2nd step (which I can do). First step: how could kio_smb find out the available space on a share? Reassigning to kio_smb.
Comment 4 FiNeX 2010-08-11 20:31:57 UTC
After some googling I've found the following links:

  http://www.protocols.com/pbook/ibm.htm#SMB
  http://www.protocolbase.net/protocols/protocol_SMB.php

They talk about  "[get server info] Get total and free space for server disk."

Could this info be useful in some way?
Comment 5 Sander van Grieken 2010-10-13 12:07:36 UTC
smbclient shows the free space on remote shares (I just checked in interactive mode)

It outputs it in a bit strange way, but it's correct:

"34175 blocks of size 8388608. 2269 blocks available"

8388608 = 8192 * 1024, so each block is 8MB

I have absolutely no idea why it uses 8MB blocks, but that's not the point :)
Comment 6 Mathias Tillman 2014-01-10 13:58:11 UTC
Sorry to comment on such an old bug, but this is still not implemented in KDE 4.12. I know this can be done as I've done it myself using libsmbclient. Here is an example implementation that works just fine:
void auth_fn(const char *server, const char *share,
         char *workgroup, int wgmaxlen, char *username, int unmaxlen,
         char *password, int pwmaxlen)
{
    strcpy(username, "guest");
}

bool calculateSMBSpace(char *url, unsigned long long &spaceTotal, unsigned long long &spaceFree) {
    int err = smbc_init(auth_fn,  0);
    if (err < 0) {
        return false;
    }

    int handle = smbc_opendir(url);
    if(handle < 0) {
        return false;
    }

    struct statvfs dirStat;
    err = smbc_fstatvfs(handle, &dirStat);
    smbc_closedir(handle);

    if (err < 0) {
        return false;
    }

    spaceTotal = dirStat.f_bsize * dirStat.f_blocks;
    spaceFree = dirStat.f_bsize * dirStat.f_bavail;

    return true;
}

I would write the implementation myself, but I don't know my way around the KDE code too well and I'm not sure if libsmbclient is cross-platform which might mean that some OSes would be left out.
Comment 7 Mauro Molinari 2014-04-15 20:41:59 UTC
I really miss this information.
Comment 8 Mathias Tillman 2014-09-14 16:54:44 UTC
Git commit 7651cdccb204d6a4ae7157695bf4c925701a18c5 by Mathias Tillman.
Committed on 14/09/2014 at 16:53.
Pushed by mathiastillman into branch 'frameworks'.

Make the statusbar space info use the new KIO::fileSystemFreeSpace job.

REVIEW: 120137

M  +18   -11   dolphin/src/statusbar/mountpointobserver.cpp
M  +13   -15   dolphin/src/statusbar/mountpointobserver.h
M  +23   -18   dolphin/src/statusbar/mountpointobservercache.cpp
M  +4    -4    dolphin/src/statusbar/mountpointobservercache.h
M  +31   -35   dolphin/src/statusbar/spaceinfoobserver.cpp
M  +9    -1    dolphin/src/statusbar/spaceinfoobserver.h
M  +1    -1    dolphin/src/statusbar/statusbarspaceinfo.cpp

http://commits.kde.org/kde-baseapps/7651cdccb204d6a4ae7157695bf4c925701a18c5