GNOME Bugzilla – Bug 771431
trashwatcher.c: symlinks in the path to $HOME
Last modified: 2016-12-12 13:48:04 UTC
[ Was mentioned in passing in 771384 ] If, for example, /home is a symlink to /mnt/nvfsvolume/home, and the users's $HOME is /home/someuser, then the code in gvfs/daemon/trashlib/trashwatcher.c won't correctly recognize that $HOME is on NFS. find_mount_entry_for_file() just walks up the path literally removing trailing components, so it will look at /home/someuser, /home, and /, find the mount at /, and decide that $HOME is local.
Created attachment 335701 [details] [review] trash: Correctly determine filesystem type for paths containing symlinks If, for example, "/home" is a symlink to "/mnt/home", and the users's $HOME is "/home/user", then the code won't correctly recognize unix mount, because it just walks up the path removing trailing components. Consequently, "/" is used to determine filesystem type instead of "/mnt/home". It will cause problems if "/mnt/home" is e.g. NFS, which is handled differently than local filesystem.
So, I have proposed patch to fix this, which uses copy-and-pasted functions from GLib, which are used in g_local_file_trash among others. Maybe would be good to provide some GLib API for it instead of copying, e.g. g_unix_mount_for (path), will discuss it...
Created attachment 336491 [details] [review] trash: Correctly determine filesystem type for paths containing symlinks If, for example, "/home" is a symlink to "/mnt/home", and the users's $HOME is "/home/user", then the code won't correctly recognize unix mount, because it just walks up the path removing trailing components. Consequently, "/" is used to determine filesystem type instead of "/mnt/home". It will cause problems if "/mnt/home" is e.g. NFS, which is handled differently than local filesystem.
Created attachment 337693 [details] [review] trash: Correctly determine fs type for paths with symlinks If, for example, "/home" is a symlink to "/mnt/home", and the users's $HOME is "/home/user", then the code won't correctly recognize unix mount, because it just walks up the path removing trailing components. Consequently, "/" is used to determine filesystem type instead of "/mnt/home". It will cause problems if "/mnt/home" is e.g. NFS, which is handled differently than local filesystem. It uses newly added g_unix_mount_for. Bump GLib dependency accordingly.
Attachment 337693 [details] pushed as 6c0adcc - trash: Correctly determine fs type for paths with symlinks
Comment on attachment 337693 [details] [review] trash: Correctly determine fs type for paths with symlinks I reverted the commit before 1.31.1 release, because I realized that it doesn't work correctly if the home trash folder doesn't exist yet... The proper fix involves changes in GLib...
Created attachment 338384 [details] [review] trash: Correctly determine fs type for paths with symlinks If, for example, "/home" is a symlink to "/mnt/home", and the users's $HOME is "/home/user", then the code won't correctly recognize unix mount, because it just walks up the path removing trailing components. Consequently, "/" is used to determine filesystem type instead of "/mnt/home". It will cause problems if "/mnt/home" is e.g. NFS, which is handled differently than local filesystem. It uses newly added g_unix_mount_for. Bump GLib dependency accordingly.
Attachment 338384 [details] pushed as 63b4509 - trash: Correctly determine fs type for paths with symlinks The glib dependency has been already pushed, so push this also..