From 41381792071413c7ed08ee55fc024e6f10b8b559 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 29 Aug 2014 12:16:40 -0700 Subject: [PATCH] commands/plugin: error if windows with space in dir [GH-4351] --- lib/vagrant/errors.rb | 4 ++++ plugins/commands/plugin/action/install_gem.rb | 9 +++++++++ templates/locales/en.yml | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index c1d8d8fb0..8995f6505 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -528,6 +528,10 @@ module Vagrant error_key(:plugin_install_license_not_found) end + class PluginInstallSpace < VagrantError + error_key(:plugin_install_space) + end + class PluginInstallVersionConflict < VagrantError error_key(:plugin_install_version_conflict) end diff --git a/plugins/commands/plugin/action/install_gem.rb b/plugins/commands/plugin/action/install_gem.rb index 842945423..eea66e04a 100644 --- a/plugins/commands/plugin/action/install_gem.rb +++ b/plugins/commands/plugin/action/install_gem.rb @@ -1,5 +1,6 @@ require "log4r" require "vagrant/plugin/manager" +require "vagrant/util/platform" module VagrantPlugins module CommandPlugin @@ -18,6 +19,14 @@ module VagrantPlugins sources = env[:plugin_sources] version = env[:plugin_version] + # If we're on Windows and the user data path has a space in it, + # then things won't work because of a Ruby bug. + if Vagrant::Util::Platform.windows? + if Vagrant.user_data_path.to_s.include?(" ") + raise Vagrant::Errors::PluginInstallSpace + end + end + # Install the gem plugin_name_label = plugin_name plugin_name_label += " --version '#{version}'" if version diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 94a801337..36037d6c0 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -867,6 +867,11 @@ en: The license file to install could not be found. Please verify the path you gave is correct. The path to the license file given was: '%{path}' + plugin_install_space: |- + The directory where plugins are installed (the Vagrant home directory) + has a space in it. On Windows, there is a bug in Ruby when compiling + plugins into directories with spaces. Please move your Vagrant home + directory to a path without spaces and try again. plugin_install_version_conflict: |- The plugin(s) can't be installed due to the version conflicts below. This means that the plugins depend on a library version that conflicts