From 583fb3c787e7b5c417cd53ebacaa5a21a82094d7 Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Wed, 14 Jun 2017 12:57:10 -0400 Subject: [PATCH] Clear POSIXLY_CORRECT when using optparse In case a user (perhaps inadvertently, or for particular reasons) has POSIXLY_CORRECT set in their environment, make sure to clear it before calling optparse.optparse!() since we don't really want POSIXLY_CORRECT argument parsing. --- lib/vagrant/plugin/v2/command.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/vagrant/plugin/v2/command.rb b/lib/vagrant/plugin/v2/command.rb index f0b6c4415..94e554dc5 100644 --- a/lib/vagrant/plugin/v2/command.rb +++ b/lib/vagrant/plugin/v2/command.rb @@ -43,6 +43,9 @@ module Vagrant # If this method returns `nil`, then you should assume that help # was printed and parsing failed. def parse_options(opts=nil) + # make sure optparse doesn't use POSIXLY_CORRECT parsing + ENV["POSIXLY_CORRECT"] = nil + # Creating a shallow copy of the arguments so the OptionParser # doesn't destroy the originals. argv = @argv.dup