After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 669258 - Issue relating to reporting of free space
Issue relating to reporting of free space
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: webdav backend
1.11.x
Other Linux
: Normal critical
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2012-02-02 17:02 UTC by Gareth Bult
Modified: 2012-02-09 14:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a blind patch (2.45 KB, patch)
2012-02-08 17:56 UTC, Tomas Bzatek
committed Details | Review

Description Gareth Bult 2012-02-02 17:02:40 UTC
I'm using nautilus against a webdav server, and it appears to be reporting the amount of free space on the drive as the amount used, and the amount used as the amount free.

Connecting to the same server with the same account using OS/X + Lion with Finder, the user/free numbers are reported correctly.

I've tried to look at the source to find out what the code is actually doing, if someone could point me at it I'll certainly try to debug it ...
Comment 1 André Klapper 2012-02-02 19:25:56 UTC
Can you please provide more info about the WebDav server, so developers could try to reproduce? This might be lower in the stack, like in gvfs or glib's gio.
Comment 2 Gareth Bult 2012-02-02 19:33:44 UTC
Ok, I think I found the problem (?) looking at this commit;

http://mail.gnome.org/archives/commits-list/2011-May/msg05752.html

quota-available-bytes is the free space.
quota-used-bytes is the bytes used.

G_FILE_ATTRIBUTE_FILESYSTEM_FREE quota-available-bytes, not quota-bytes used.
G_FILE_ATTRIBUTE_FILESYSTEM_SIZE should be the sum of the above.

.. this this enough, given other clients work fine and looking at this code it
does sort of imply it's not a server issue ??

daemon/gvfsbackenddav.c

+          if (node_has_name (node, "quota-available-bytes"))
+            {
+              guint64 size;
+
+              if (! string_to_uint64 (text, &size))
+                continue;
+
+              g_file_info_set_attribute_uint64 (info,
+                                                G_FILE_ATTRIBUTE_FILESYSTEM_SIZE,
+                                                size);
+            }
+          else if (node_has_name (node, "quota-used-bytes"))
+            {
+              guint64 size;
+
+              if (! string_to_uint64 (text, &size))
+                continue;
+
+              g_file_info_set_attribute_uint64 (info,
+                                                G_FILE_ATTRIBUTE_FILESYSTEM_FREE,
+                                                size);
+            }
Comment 3 Gareth Bult 2012-02-05 18:00:04 UTC
As the problem appears to be with the gfs back-end, have I posted this in the wrong place?
Comment 4 Cosimo Cecchi 2012-02-06 16:37:06 UTC
Gareth, thanks for debugging this. Indeed, this bug report belongs to gvfs, changing component.

If you have a patch available for the issue, please attach it as a diff file (preferably using git diff or git format-patch) to this report. Thanks!
Comment 5 Gareth Bult 2012-02-06 16:47:13 UTC
Hi, I'm afraid I've yet to find a good howto on building and testing the entire GNOME system, so I can't submit a tested patch, however, by eye/hand;

daemon/gvfsbackenddav.c

-g_file_info_set_attribute_uint64 (info,G_FILE_ATTRIBUTE_FILESYSTEM_SIZE,size);
+g_file_info_set_attribute_uint64 (info,G_FILE_ATTRIBUTE_FILESYSTEM_FREE,size);

-g_file_info_set_attribute_uint64 (info,G_FILE_ATTRIBUTE_FILESYSTEM_FREE,size);
+g_file_info_set_attribute_uint64 (info,G_FILE_ATTRIBUTE_FILESYSTEM_USED,size);

If G_FILE_ATTRIBUTE_FILESYSTEM_SIZE is used anywhere else (?) then you'll need a
quick check but essentially it needs to be calculated from USED + FREE. If you
check the RFC it doesn't deal with 'SIZE' per say, although some of the non-
compliant clients implement a 'quote' which would equate to 'size'.
Comment 6 Gareth Bult 2012-02-06 16:48:28 UTC
Sorry, "quota" not "quote".
Comment 7 Tomas Bzatek 2012-02-08 17:56:57 UTC
Created attachment 207132 [details] [review]
a blind patch

The G_FILE_ATTRIBUTE_FILESYSTEM_USED attribute has just been introduced recently and not all applications could understand it yet. I would go the safe way and use the old properties in this case.

Gareth, could you please test this patch if possible? I don't have access to quota-aware webdav server, can't test.
Comment 8 Gareth Bult 2012-02-09 12:46:33 UTC
Erm, I'm not in a position to build nautilus, unless someone can point me at a howto that's not going to involve a week's worth of setting up. However, if you have a copy built with your patch, try;

https://xframe.metro-tek.com/
user: tomas
pass: testme99

It has a 1M quota with just a few bytes used ...
Checking here I have 0/0 from my nautilus but from the command line using the fuse module I get the correct used/free ...

#mount.davfs https://xframe.metro-tek.com/ /mnt
#df
Filesystem                      1K-blocks     Used  Available Use% Mounted onhttps://xframe.metro-tek.com/ 976560        12    976548    1%   /mnt
Comment 9 Tomas Bzatek 2012-02-09 13:50:05 UTC
Great, thanks for providing the testing space, it really helps! Just tested the patch and got the right numbers.

Before: 
>  filesystem::size: 999999977
>  filesystem::free: 23

After:
>  filesystem::size: 1000000000
>  filesystem::free: 999998623


(In reply to comment #8)
> It has a 1M quota with just a few bytes used ...
Oh, seeing 1GB quota here, is that correct?

Pushed the patch to master:

commit 99ae116200691c1dc67ea3fb74060e0d90bf482d
Author: Tomas Bzatek <tbzatek@redhat.com>
Date:   Wed Feb 8 18:53:51 2012 +0100

    dav: Fix free space reporting
    
    Based on patch by Gareth Bult
    https://bugzilla.gnome.org/show_bug.cgi?id=669258
Comment 10 Gareth Bult 2012-02-09 14:18:54 UTC
Hi, sure, sorry, mixing my M and G .. see the 1k-blocks figure from my davfs listing above ... ;)