From cf4b03d701f4e6b51caa875353b1699010152387 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 24 Dec 2015 12:36:14 -0800 Subject: [PATCH] core: do not convert drive letters to UNC paths [GH-6598] --- CHANGELOG.md | 2 ++ lib/vagrant/util/platform.rb | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b52a3b6..f6373384c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ BUG FIXES: - core: Don't create ".bundle" directory in pwd [GH-6717] - core: Fix exception on installing VirtualBox [GH-6713] + - core: Do not convert standalone drive letters such as "D:" to + UNC paths [GH-6598] - commands/up: Smarter logic about what provider to install, avoiding situations where VirtualBox was installed over the correct provider [GH-6731] - guests/debian: Fix Docker install [GH-6722] diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 017a6e558..9f461d835 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -65,7 +65,7 @@ module Vagrant # "Hyper-V Administrators" group. # # From: https://support.microsoft.com/en-us/kb/243330 - # SID: S-1-5-32-578 + # SID: S-1-5-32-578 # Name: BUILTIN\Hyper-V Administrators # # @return [Boolean] @@ -73,7 +73,7 @@ module Vagrant begin username = ENV["USERNAME"] process = Subprocess.execute("net", "localgroup", "Hyper-V Administrators") - output = process.stdout.chomp + output = process.stdout.chomp return output.include?(username) rescue Errors::CommandUnavailableWindows return false @@ -185,6 +185,12 @@ module Vagrant # @param [String] path Path to convert to UNC for Windows # @return [String] def windows_unc_path(path) + path = path.gsub("/", "\\") + + # If the path is just a drive letter, then return that as-is + return path if path =~ /^[a-zA-Z]:\\?$/ + + # Convert to UNC path "\\\\?\\" + path.gsub("/", "\\") end