NFS exports with single quotes now work properly [GH-1166]

This commit is contained in:
Mitchell Hashimoto 2013-07-16 16:23:33 -07:00
parent 0dfc6455ae
commit 608bc7c0eb
3 changed files with 8 additions and 3 deletions

View File

@ -30,6 +30,7 @@ BUG FIXES:
- SSH channel is closed after the exit status is received, potentially
eliminating any SSH hangs. [GH-603]
- Fix regression where VirtualBox detection wasn't working anymore. [GH-1918]
- NFS shared folders with single quotes in their name now work properly. [GH-1166]
## 1.2.3 (July 9, 2013)

View File

@ -16,7 +16,9 @@ module VagrantPlugins
machine.communicate.sudo("mkdir -p #{expanded_guest_path}")
# Mount
mount_command = "mount -o vers=#{opts[:nfs_version]} #{ip}:'#{opts[:hostpath]}' #{expanded_guest_path}"
hostpath = opts[:hostpath].dup
hostpath.gsub!("'", "'\\\\''")
mount_command = "mount -o vers=#{opts[:nfs_version]} #{ip}:'#{hostpath}' #{expanded_guest_path}"
retryable(:on => Vagrant::Errors::LinuxNFSMountFailed, :tries => 5, :sleep => 2) do
machine.communicate.sudo(mount_command,

View File

@ -46,7 +46,8 @@ module VagrantPlugins
@logger.debug("Compiling map of sub-directories for NFS exports...")
dirmap = {}
folders.each do |_, opts|
hostpath = opts[:hostpath]
hostpath = opts[:hostpath].dup
hostpath.gsub!('"', '\"')
found = false
dirmap.each do |dirs, diropts|
@ -95,7 +96,8 @@ module VagrantPlugins
# Output the rendered template into the exports
output.split("\n").each do |line|
line = line.gsub('"', '\"')
line.gsub!('"', '\"')
line.gsub!("'", "'\\\\''")
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
end