From 8652d87865eaa79cf5ecf01b2c06de7b1cd77646 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 15 Jan 2014 11:18:19 -0800 Subject: [PATCH] core: test file writes for home dir perms Creating directories for some reason was allowed in Windows, but writes would fail later. --- CHANGELOG.md | 2 ++ lib/vagrant/environment.rb | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 613b0444b..e40a70297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,8 @@ BUG FIXES: syntax errors. - core: Plugins that fork within certain actions will no longer hang indefinitely. [GH-2756] + - core: Windows checks home directory permissions more correctly to + warn of potential issues. - commands/box: Box add `--force` works with `--provider` flag. [GH-2757] - commands/plugin: Plugin installation will fail if dependencies conflict, rather than at runtime. diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 79708cff6..dacdaa579 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -621,6 +621,17 @@ module Vagrant end end + # Attempt to write into the home directory to verify we can + begin + path = @home_path.join("perm_test") + path.open("w") do |f| + f.write("hello") + end + path.unlink + rescue Errno::EACCES + raise Errors::HomeDirectoryNotAccessible, home_path: @home_path.to_s + end + # Create the version file to mark the version of the home directory # we're using. version_file = @home_path.join("setup_version")