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 525866 - the user directory should not be considered as a mount to display
the user directory should not be considered as a mount to display
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.16.x
Other Linux
: Normal normal
: ---
Assigned To: Alexander Larsson
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-04-02 23:05 UTC by Sebastien Bacher
Modified: 2008-04-30 14:10 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
don't list other user mounts and the user directory (482 bytes, patch)
2008-04-03 16:31 UTC, Sebastien Bacher
none Details | Review
and a version which builds correctly (493 bytes, patch)
2008-04-03 16:37 UTC, Sebastien Bacher
none Details | Review
updated version not filtering on .gvfs which is not required (638 bytes, patch)
2008-04-03 21:45 UTC, Sebastien Bacher
committed Details | Review

Description Sebastien Bacher 2008-04-02 23:05:25 UTC
gunixmounts.c g_unix_mount_guess_should_display() uses 

      if (g_str_has_prefix (mount_path, g_get_home_dir ()))
        return TRUE;

in the case where the mount_path is the user directory it should return false though, the current behaviour is an using when using autofs for example
Comment 1 David Zeuthen (not reading bugmail) 2008-04-02 23:13:48 UTC
(In reply to comment #0)
> gunixmounts.c g_unix_mount_guess_should_display() uses 
> 
>       if (g_str_has_prefix (mount_path, g_get_home_dir ()))
>         return TRUE;
> 
> in the case where the mount_path is the user directory it should return false
> though, the current behaviour is an using when using autofs for example

No. But almost right. We still want to show mounts _inside_ the home directory [1], but we want to avoid show the home directory itself as a mount.

So you want

 if (strcmp (mount_path, g_get_home_dir ()) == 0)
         return FALSE;

just before the code you quoted.

[1] : if I'm a user I want to be able to see e.g. ~/gmail where ~/gmail is a gmailfs fuse mount. Stuff like that.
Comment 2 Sebastien Bacher 2008-04-02 23:28:17 UTC
right, that's what I mean the user directory only should be filtered which is what your change is doing (I was going to send a similar one)
Comment 3 Sebastien Bacher 2008-04-02 23:35:06 UTC
the g_str_has_prefix() comparaison should also use G_DIR_SEPARATOR after the username to avoid showing mounts from an another user (otherwise the "user86" mounts would be display for "user8" too for example)
Comment 4 David Zeuthen (not reading bugmail) 2008-04-02 23:36:41 UTC
(In reply to comment #3)
> the g_str_has_prefix() comparaison should also use G_DIR_SEPARATOR after the
> username to avoid showing mounts from an another user (otherwise the "user86"
> mounts would be display for "user8" too for example)

ACK. Nice catch!
Comment 5 Matthias Clasen 2008-04-03 04:14:07 UTC
Sebastien, do you have a patch ?
Comment 6 Sebastien Bacher 2008-04-03 16:31:16 UTC
Created attachment 108554 [details] [review]
don't list other user mounts and the user directory

suggested change to fix the issue, it'll filter the other users mounts and the user directory if it doesn't has a trailing G_DIR_SEPARATOR, do we know if that's always true or not?
Comment 7 Sebastien Bacher 2008-04-03 16:37:59 UTC
Created attachment 108556 [details] [review]
and a version which builds correctly
Comment 8 David Zeuthen (not reading bugmail) 2008-04-03 18:18:03 UTC
Seems correct to me. Did you test it?
Comment 9 Sebastien Bacher 2008-04-03 21:45:55 UTC
Created attachment 108573 [details] [review]
updated version not filtering on .gvfs which is not required 

yes, the patch has been tested by the user who had the autofs issue and he confirmed that it works correctly for him and fix the bug. an another issue has been spotted in the same function, the "if (strstr (mount_path, "/.gvfs") != NULL)" call is reversed but it's not useful anyway since g_unix_mount_is_system_internal which is called before does the same work already
Comment 10 Sebastien Bacher 2008-04-03 22:05:24 UTC
there has been some suggestions about ignoring user mounts using .directory too, not sure if there is a real need for that though
Comment 11 Matthias Clasen 2008-04-03 22:29:54 UTC
Patch looks good to me. 
Please commit to both branches.
Comment 12 Sebastien Bacher 2008-04-04 07:38:16 UTC
change commited to glib-2-16 and trunk

2008-04-04  Sebastien Bacher  <seb128@ubuntu.com>

	* gunixmounts.c: (g_unix_mount_guess_should_display):
	Don't list the user directory as a mount, fix potential issue
	when other users have a similar naming and don't special case the
	gvfs mounts there since that's not required (#525866)
Comment 13 padraig.obriain 2008-04-30 07:31:37 UTC
One of the consequences of this is that a user's Home directory does not appear in Tree Side Pane in nautilus. Is this the intended behavior?
Comment 14 Sebastien Bacher 2008-04-30 08:57:06 UTC
the user directory is special cased and displayed correctly here, what nautilus version do you use?
Comment 15 David Zeuthen (not reading bugmail) 2008-04-30 14:10:28 UTC
(In reply to comment #13)
> One of the consequences of this is that a user's Home directory does not appear
> in Tree Side Pane in nautilus. Is this the intended behavior?

If you're seeing this it's a bug in your build of Nautilus (which always shows $HOME as comment 14 points out). Even if $HOME was on a separate mount, gio shouldn't enumerate it because it's a system implementation detail and the gio policy is to only enumerate mounts that are not system implementations details. See gio/gunixmounts.c for more information.