-
-
Notifications
You must be signed in to change notification settings - Fork 2k
bundle config build.<gem> doesn't send multiple parameters to extconf.rb correctly #6940
Comments
I'm seeing this problem with 1.17.2 as well and I was not seeing this issue with bundler 1.15.4 |
Can you please provide a Gemfile that we can use to reproduce this problem. |
I was trying to install the do_postgres gem and providing --with-pgsql-server-include and --with-pgsql-client-dir options |
Running into similar problems with bundler Used the following command to generate output:
see attached file |
Quick repro: # repro.rb
require 'bundler/inline'
system "bundle config --local build.mysql2 --with-mysql-config=mysqlconfig --example-argument"
gemfile do
source 'https://rubygems.org'
gem 'mysql2'
end Running it: $ ruby repro.rb
You are replacing the current local value of build.mysql2, which is currently nil
Traceback (most recent call last):
…snip…
/Users/jeremy/.rbenv/versions/2.6.1/lib/ruby/site_ruby/2.6.0/bundler/installer/parallel_installer.rb:201:in `handle_error': Gem::Ext::BuildError: ERROR: Failed to build gem native extension. (Bundler::InstallError)
current directory: /Users/jeremy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mysql2-0.5.2/ext/mysql2
/Users/jeremy/.rbenv/versions/2.6.1/bin/ruby -I /Users/jeremy/.rbenv/versions/2.6.1/lib/ruby/site_ruby/2.6.0 -r ./siteconf20190306-75775-1csb26z.rb extconf.rb --with-mysql-config\=mysqlconfig\ --example-argument
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
-----
Cannot find mysql_config at mysqlconfig --example-argument
…snip… Here's the escaped build config from the extconf.rb invocation: … extconf.rb --with-mysql-config\=mysqlconfig\ --example-argument (can repro on Ruby 2.5, 2.6; RubyGems 2.7.3, 3.0.3; Bundler 1.17.3, 2.0.1) |
Quick fix: require 'bundler/inline'
system "bundle config --local build.mysql2 --with-mysql-config=mysqlconfig --example-argument"
if ENV['SHELLSPLIT']
require 'bundler/installer/gem_installer'
require 'shellwords'
module ShellsplitSpecSettings
def spec_settings
if settings = super
Shellwords.shellsplit settings
end
end
end
Bundler::GemInstaller.prepend ShellsplitSpecSettings
end
gemfile do
source 'https://rubygems.org'
gem 'mysql2'
end Running it: $ SHELLSPLIT=1 ruby repro.rb
… extconf.rb --with-mysql-config\=mysqlconfig --example-argument Looks like this was introduced by shellescaping/shelljoining arguments in the RubyGems installer: https://github.com/rubygems/rubygems/pull/2441/files#diff-352b7b3f2988f0f74c3e332074f59e09R74 So shellsplitting the spec_settings fixes it. |
7023: Shellsplit build config r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was #6940. Build configurations with multiple whitepaced parameter are no longer properly handled. ### What was your diagnosis of the problem? My diagnosis was not mine, was @jeremy's: Since [shellscaping / shelljoining build arguments to the rubygems gem installer](#6940), these are no longer properly passed ### What is your fix for the problem, implemented in this PR? My fix is not mine, it's @jeremy's: shellsplit settings before passing them. ### Why did you choose this fix out of the possible options? I chose this fix because it works and it sounds like the proper followup to rubygems/rubygems#2441. Fixes #6940. Co-authored-by: David Rodríguez <[email protected]>
rubygems 3.0 introduced a bug so that no version of bundler could install the pg gem correctly. We are temporarily rolling back to rubygems 2.7 until the bug is fixed. See rubygems/bundler#6940 for more details [#164713288](https://www.pivotaltracker.com/story/show/164713288) Co-authored-by: Belinda Liu <[email protected]>
Previously ruby 2.6 was on rubygems 3.0, but 3.0 introduced a bug in bundler where build arguments were not properly used. Rolling back for now until the bug is fixed. See rubygems/bundler#6940 for more details [#164713288](https://www.pivotaltracker.com/story/show/164713288) Co-authored-by: Belinda Liu <[email protected]>
rubygems 3.0 introduced a bug so that no version of bundler could install the pg gem correctly. We are temporarily rolling back to rubygems 2.7 until the bug is fixed. See rubygems/bundler#6940 for more details [#164713288](https://www.pivotaltracker.com/story/show/164713288) Co-authored-by: Belinda Liu <[email protected]>
What works (
bundler 1.7.2
)bundle config build.<gem> --with-opt-lib=... --with-client-lib=...
, thenbundle install
This succeeds, giving the same results as:
gem install gem -v x.y.z -- --with-opt-lib=... --with-client-lib=...
.From
mkmf.log
:What happens now (tried with bundler
1.17.1
and2.0.1
)After the exact same steps as above:
Notice that the build parameters are separated by an escaped space, because
extconf.rb
is being given the build parameters as one big string. Verified this usingpry
.From
mkmf.log
:And the native extension fails to install because we can no longer find the required headers.
The text was updated successfully, but these errors were encountered: