Patch MakeMakefile for extension builds #13328
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As reported in #13322 Vagrant fails to install plugins with extensions
due to spaces in Windows paths causing errors. Further investigation
found that just quoting the paths used in the flags set by the Vagrant
launcher would not resolve the issue due to how gem authors may
be configuring the build. For example nokogiri appends environment flags
using
String#split
which improperly splits paths that include spaceseven if they are quoted.
To work around this, the MakeMakefile module needs to be patched to
properly quote any unquoted paths found within flags that may exist.
The module is required into
extconf.rb
files directly, however,thus can't be patched directly. To work around this, the
Gem.ruby
method is patched to include a custom load path. The custom load
path includes a
mkmf.rb
file that loads the realmkmf.rb
fileand then proceeds to patch all the methods needed. Finally, all the
flags the Vagrant launcher defines in the environment are automatically
added.
This results in extension
extconf.rb
files using these patched methodsand preventing unexpected breakages when a space is included within
the path (which is always on Windows since the installation location
is within Program Files).
Full fix depends on package modifications included within hashicorp/vagrant-installers#289
Fixes #13322