Skip to content

Commit

Permalink
sshfs_forward_mount: properly check mounts that are sym links
Browse files Browse the repository at this point in the history
i.e. if /home -> /var/home and we try to mount something onto
/home/vagrant/sharedfolder then it will show up in /proc/mounts as:

    :/sharedfolder /var/home/vagrant/sharedfolder fuse.sshfs ........

With this commit we properly find the absolute path and check for
that instead.

Fixes #44
  • Loading branch information
dustymabe committed Nov 12, 2016
1 parent a4abb8a commit d120bbf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ class MountSSHFS

def self.sshfs_forward_is_folder_mounted(machine, opts)
mounted = false
# expand the guest path so we can handle things like "~/vagrant"
expanded_guest_path = machine.guest.capability(
:shell_expand_guest_path, opts[:guestpath])
# find the absolute path so that we can properly check if it is mounted
# https://github.com/dustymabe/vagrant-sshfs/issues/44
absolute_guest_path = machine.guest.capability(
:sshfs_get_absolute_path, opts[:guestpath])
machine.communicate.execute("cat /proc/mounts") do |type, data|
if type == :stdout
data.each_line do |line|
if line.split()[1] == expanded_guest_path
if line.split()[1] == absolute_guest_path
mounted = true
break
end
Expand Down

0 comments on commit d120bbf

Please sign in to comment.