From f48a2784a01b607f50cc29fe2afb45ce30759382 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 24 Jan 2012 17:03:55 -0800 Subject: [PATCH] Regexp escape VM names when matching for them. --- CHANGELOG.md | 2 +- lib/vagrant/driver/virtualbox_4_0.rb | 2 +- lib/vagrant/driver/virtualbox_4_1.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ca12387c..a8534b3c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.9.4 (unreleased) - + - Match VM names that have parens, brackets, etc. ## 0.9.3 (January 24, 2012) diff --git a/lib/vagrant/driver/virtualbox_4_0.rb b/lib/vagrant/driver/virtualbox_4_0.rb index 166d25927..10d0f969c 100644 --- a/lib/vagrant/driver/virtualbox_4_0.rb +++ b/lib/vagrant/driver/virtualbox_4_0.rb @@ -172,7 +172,7 @@ module Vagrant end output = execute("list", "vms") - if output =~ /^"#{name}" \{(.+?)\}$/ + if output =~ /^"#{Regexp.escape(name)}" \{(.+?)\}$/ return $1.to_s end diff --git a/lib/vagrant/driver/virtualbox_4_1.rb b/lib/vagrant/driver/virtualbox_4_1.rb index 221ff389e..e63a16443 100644 --- a/lib/vagrant/driver/virtualbox_4_1.rb +++ b/lib/vagrant/driver/virtualbox_4_1.rb @@ -172,7 +172,7 @@ module Vagrant end output = execute("list", "vms") - if output =~ /^"#{name}" \{(.+?)\}$/ + if output =~ /^"#{Regexp.escape(name)}" \{(.+?)\}$/ return $1.to_s end