diff --git a/CHANGELOG.md b/CHANGELOG.md index a396588e2..fe3f53d23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.8.8 (unreleased) - + - Mount shared folders shortest to longest to avoid mounting + subfolders first. [GH-525] ## 0.8.7 (September 13, 2011) diff --git a/lib/vagrant/action/vm/share_folders.rb b/lib/vagrant/action/vm/share_folders.rb index c4ce6cc14..04ec62120 100644 --- a/lib/vagrant/action/vm/share_folders.rb +++ b/lib/vagrant/action/vm/share_folders.rb @@ -52,7 +52,17 @@ module Vagrant @env["vm"].ssh.execute do |ssh| # short guestpaths first, so we don't step on ourselves - shared_folders.sort_by {|name, data| data[:guestpath].length}.each do |name, data| + folders = shared_folders.sort_by do |name, data| + if data[:guestpath] + data[:guestpath].length + else + # A long enough path to just do this at the end. + 10000 + end + end + + # Go through each folder and mount + folders.each do |name, data| if data[:guestpath] # Guest path specified, so mount the folder to specified point @env.ui.info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",