From a53d569656a75776bac3081e50d22f5c9e018941 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 8 Feb 2013 16:18:57 -0800 Subject: [PATCH] When cleaning NFS, properly escape certain characters --- plugins/hosts/bsd/host.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/hosts/bsd/host.rb b/plugins/hosts/bsd/host.rb index 5921901c4..0aee78f48 100644 --- a/plugins/hosts/bsd/host.rb +++ b/plugins/hosts/bsd/host.rb @@ -89,6 +89,10 @@ module VagrantPlugins def nfs_cleanup(id) return if !File.exist?("/etc/exports") + # Escape sed-sensitive characters: + id = id.gsub("/", "\\/") + id = id.gsub(".", "\\.") + # Use sed to just strip out the block of code which was inserted # by Vagrant, and restart NFS. system("sudo sed -e '/^# VAGRANT-BEGIN: #{id}/,/^# VAGRANT-END: #{id}/ d' -ibak /etc/exports")