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 629394 - Nautilus displays wrong size of "/"
Nautilus displays wrong size of "/"
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
2.27.x
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 633090 706283 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-09-12 04:41 UTC by Thibault Févry
Modified: 2013-12-08 20:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (517 bytes, patch)
2010-12-10 11:30 UTC, Ritesh Khadgaray ( irc:ritz)
none Details | Review
patch (554 bytes, patch)
2010-12-10 11:54 UTC, Ritesh Khadgaray ( irc:ritz)
none Details | Review
deep-count-one-filesystem.patch (3.04 KB, patch)
2012-07-08 03:27 UTC, Phillip Susi
needs-work Details | Review
deep-count-one-filesystem.patch (3.55 KB, patch)
2012-11-18 02:53 UTC, Phillip Susi
reviewed Details | Review
deep-count-one-filesystem.patch (3.50 KB, patch)
2012-11-20 03:38 UTC, Phillip Susi
committed Details | Review

Description Thibault Févry 2010-09-12 04:41:32 UTC
In nautilus, when you go to root and ask for the total size, it grows slowly and then suddenly goes to 128TB.

 It seems that the file causing nautilus to go to 128 TB is proc/kcore, or proc/media.

 I'm not sure this isn't Ubuntu-specific, but one comment said to report upstream.

https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/585472
Comment 1 Benn Snyder 2010-11-11 04:08:08 UTC
Confirmed on Gentoo with Gnome 2.30.2.


To reproduce:

1) Open Places->Computer.
2) Right-click File System and click Properties.

Expected:

Number after "totalling" should be cumulative size of files on file system.

Actual:

Number after "totalling" is 128.2 TB.
Comment 2 dougs1981 2010-11-11 05:07:45 UTC
I am getting the same thing and i am in 10.10 64 bit ubuntu.

I do not know what is causing mine or how to fix it nor do i know if it is important or not about this bug doing this.

can someone give me any ideas on how to fix this? i am new to linux and i never found how to fix it or what really is the cause of this bug other then /proc/kcore or /proc/media or nautilus i have no idea how to go about fixing this anyone have any ideas?
Comment 3 Cosimo Cecchi 2010-11-13 12:09:54 UTC
*** Bug 633090 has been marked as a duplicate of this bug. ***
Comment 4 Ritesh Khadgaray ( irc:ritz) 2010-12-10 11:30:27 UTC
Created attachment 176172 [details] [review]
patch

this issue stems from stat reading out the size incorrectly. 

$ stat /proc/kcore 
  File: `/proc/kcore'
  Size: 140737486266368	Blocks: 0          IO Block: 1024   regular file
Device: 3h/3d	Inode: 4026532018  Links: 1
Access: (0400/-r--------)  Uid: (    0/    root)   Gid: (    0/    root)
Context: system_u:object_r:proc_kcore_t:s0
Access: 2010-12-10 12:51:09.156401113 +0530
Modify: 2010-12-10 12:51:09.156401113 +0530
Change: 2010-12-10 12:51:09.156401113 +0530
 Birth: -

we could check st_block size, and if zero mark the file as zero size.
Comment 5 Ritesh Khadgaray ( irc:ritz) 2010-12-10 11:54:45 UTC
Created attachment 176175 [details] [review]
patch

update - this only applies to regular files, and not every other file.
Comment 6 Ritesh Khadgaray ( irc:ritz) 2011-05-10 09:05:05 UTC
(In reply to comment #5)
> Created an attachment (id=176175) [details] [review]
> patch
> 
> update - this only applies to regular files, and not every other file.

caveat : sparse file with any used block will appear larger than they are on disk
Comment 7 Phillip Susi 2011-12-27 23:32:01 UTC
Counting the file size in /proc or /sys at all is entirely nonsense.  These directories should be skipped when computing the size.

Can someone set this to confirmed please?
Comment 8 Ritesh Khadgaray ( irc:ritz) 2012-01-29 14:42:41 UTC
(In reply to comment #7)
> Counting the file size in /proc or /sys at all is entirely nonsense.  These
> directories should be skipped when computing the size.
> 
> Can someone set this to confirmed please?

Personally, I agree. wrt spare files, I believe one should display on-disk usage.
Comment 9 Phillip Susi 2012-07-08 03:27:26 UTC
Created attachment 218249 [details] [review]
deep-count-one-filesystem.patch

The problem is in nautilus, not gio.  I have patched nautilus so that it will not recurse into other filesystems when computing the total size of a directory.
Comment 10 Cosimo Cecchi 2012-07-14 05:13:10 UTC
Review of attachment 218249 [details] [review]:

Thanks for the patch! I left some comments below.

::: libnautilus-private/nautilus-directory-async.c
@@ +2687,3 @@
 		/* Record the fact that we have to descend into this directory. */
+		id = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILESYSTEM);
+		if (id && state->fs_id && strcmp (id, state->fs_id) == 0) {

You can use g_strcmp0() that does the NULL checks automatically.

@@ +2951,3 @@
+				  G_FILE_ATTRIBUTE_ID_FILESYSTEM,
+				  G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+				  NULL, NULL);

This synchronous call here is wrong...you should call g_file_query_info_async() and then deep_count_load() from the callback.
Comment 11 Cosimo Cecchi 2012-07-20 16:06:29 UTC
Mass component change due to BZ cleanup, sorry for the noise.
Comment 12 William Jon McCann 2012-09-19 15:42:16 UTC
Phillip, any chance you can update the patch?
Comment 13 Phillip Susi 2012-09-19 18:19:48 UTC
Sorry, I've been pretty busy lately with a newborn, but I will try to get around to it.
Comment 14 Phillip Susi 2012-11-18 02:53:43 UTC
Created attachment 229269 [details] [review]
deep-count-one-filesystem.patch

How's this look?
Comment 15 Cosimo Cecchi 2012-11-19 23:13:30 UTC
Review of attachment 229269 [details] [review]:

Thanks Phillip, this looks almost ready to push, just a couple of minor comments:

::: libnautilus-private/nautilus-directory-async.c
@@ +2705,3 @@
 		/* Record the fact that we have to descend into this directory. */
+		id = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILESYSTEM);
+		if (id && g_strcmp0 (id, state->fs_id) == 0) {

g_strcmp0() will already do the id != NULL check for you, no need for an additional one here.

@@ +2931,3 @@
+	if (info) {
+		id = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILESYSTEM);
+	GFile *file = (GFile *)source_object;

Coding style: Nautilus always wraps if blocks in brackets, even if it's only one line.

In this case though, there's no need for this check, as g_strdup will just return NULL when passed NULL as input.

@@ +2993,3 @@
+				 NULL,
+				 deep_count_got_info,
+				 state);

You can immediately unref the GFile here, as g_file_query_info_async() will keep the ref alive until the async callback returns.
Comment 16 Phillip Susi 2012-11-20 03:38:58 UTC
Created attachment 229439 [details] [review]
deep-count-one-filesystem.patch

How about this one?
Comment 17 Cosimo Cecchi 2012-11-20 16:24:55 UTC
Review of attachment 229439 [details] [review]:

Thanks, this looks good to me! Do you have a GNOME git account or should I push it on your behalf?
Comment 18 Phillip Susi 2012-11-20 20:22:25 UTC
You know, I do think I have one so I could work on gparted, but I think I would feel more comfortable if you pushed it.
Comment 19 Cosimo Cecchi 2012-12-17 14:13:46 UTC
Okay, I now pushed this to master.
Comment 20 Michael Catanzaro 2013-12-08 20:35:56 UTC
*** Bug 706283 has been marked as a duplicate of this bug. ***