GNOME Bugzilla – Bug 525866
the user directory should not be considered as a mount to display
Last modified: 2008-04-30 14:10:28 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
(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.
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)
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)
(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!
Sebastien, do you have a patch ?
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?
Created attachment 108556 [details] [review] and a version which builds correctly
Seems correct to me. Did you test it?
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
there has been some suggestions about ignoring user mounts using .directory too, not sure if there is a real need for that though
Patch looks good to me. Please commit to both branches.
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)
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?
the user directory is special cased and displayed correctly here, what nautilus version do you use?
(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.