rubygems / bundler

Manage your Ruby application's gem dependencies
https://bundler.io
MIT License
4.88k stars 1.99k forks source link

Yaml Serializer incorrectly serializes empty strings #5947

Closed s0rin closed 7 years ago

s0rin commented 7 years ago

Error Report

Questions

Please fill out answers to these questions, it'll help us figure out why things are going wrong.

Backtrace

TypeError: no implicit conversion of Hash into String
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/cli/install.rb:75:in `expand_path'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/cli/install.rb:75:in `run'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/cli.rb:191:in `block in install'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/settings.rb:92:in `temporary'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/cli.rb:190:in `install'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/cli.rb:22:in `dispatch'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/cli.rb:13:in `start'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/exe/bundle:30:in `block in <top (required)>'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
  /var/www/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/bundler-1.15.3/exe/bundle:22:in `<top (required)>'
  /var/www/.rbenv/versions/2.3.0/bin/bundle:23:in `load'
  /var/www/.rbenv/versions/2.3.0/bin/bundle:23:in `<main>'
  /var/www/.rbenv/versions/2.3.0/bin/ruby_executable_hooks:15:in `eval'
  /var/www/.rbenv/versions/2.3.0/bin/ruby_executable_hooks:15:in `<main>'

Environment

Bundler   1.15.3
Rubygems  2.6.12
Ruby      2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
GEM_HOME  /var/www/konsys/{}/ruby/2.3.0
GEM_PATH
Git       1.7.9.5
Platform  x86_64-linux
OpenSSL   OpenSSL 1.0.1 14 Mar 2012

Bundler settings

build.nokogiri
  Set for the current user (/tmp/bundler/home/tuser/.bundle/config): "--use-system-libraries"
frozen
  Set for your local app (/var/www/konsys/.bundle/config): true
path
  Set for your local app (/var/www/konsys/.bundle/config): {}
disable_shared_gems
  Set for your local app (/var/www/konsys/.bundle/config): true
bin
  Set for your local app (/var/www/konsys/.bundle/config): "bin"

Gemfile

Gemfile

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.1.2'
gem 'activesupport'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2.1'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

#gem 'protected_attributes'    # no longer supported in Rails 5
gem 'ancestry'
gem 'paranoia', "~> 2.2"
gem "cocoon"

# Gems for Devise & CanCan
gem 'devise'
gem 'cancancan'
gem 'net-ldap'

gem 'jquery-turbolinks'
gem 'jquery-ui-rails'
gem 'jquery-hotkeys-rails'
#gem 'jquery-validation-rails'
#gem "jstree-rails-4"

gem 'bootstrap-sass'
#gem 'bootstrap_form'
#gem 'bootstrap-typeahead-rails'
gem 'font-awesome-sass'
gem 'rails-i18n'

gem 'sparql-client'
gem 'sru'
gem 'sunspot_rails'
gem 'rsolr'
gem 'progress_bar'
gem 'kaminari'
#gem 'handlebars_assets'

#gem 'momentjs-rails', '>= 2.9.0'
#gem 'bootstrap3-datetimepicker-rails', '~> 4.17.47'
gem 'bootstrap-datepicker-rails'
gem 'bootstrap-timepicker-rails-addon'
#gem 'validates_timeliness'
#gem 'date_validator'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.1.2)
      actionpack (= 5.1.2)
      nio4r (~> 2.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.1.2)
      actionpack (= 5.1.2)
      actionview (= 5.1.2)
      activejob (= 5.1.2)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.1.2)
      actionview (= 5.1.2)
      activesupport (= 5.1.2)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.1.2)
      activesupport (= 5.1.2)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.1.2)
      activesupport (= 5.1.2)
      globalid (>= 0.3.6)
    activemodel (5.1.2)
      activesupport (= 5.1.2)
    activerecord (5.1.2)
      activemodel (= 5.1.2)
      activesupport (= 5.1.2)
      arel (~> 8.0)
    activesupport (5.1.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    ancestry (3.0.1)
      activerecord (>= 3.2.0)
    arel (8.0.0)
    autoprefixer-rails (7.1.2.2)
      execjs
    bcrypt (3.1.11)
    bindex (0.5.0)
    bootstrap-datepicker-rails (1.6.4.1)
      railties (>= 3.0)
    bootstrap-sass (3.3.7)
      autoprefixer-rails (>= 5.2.1)
      sass (>= 3.3.4)
    bootstrap-timepicker-rails-addon (0.5.2)
      railties (>= 3.1, < 6.0)
    builder (3.2.3)
    byebug (9.0.6)
    cancancan (2.0.0)
    cocoon (1.2.10)
    coffee-rails (4.2.2)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.0.5)
    devise (4.3.0)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0, < 5.2)
      responders
      warden (~> 1.2.3)
    erubi (1.6.1)
    execjs (2.7.0)
    faraday (0.12.1)
      multipart-post (>= 1.2, < 3)
    ffi (1.9.18)
    font-awesome-sass (4.7.0)
      sass (>= 3.2)
    globalid (0.4.0)
      activesupport (>= 4.2.0)
    hamster (3.0.0)
      concurrent-ruby (~> 1.0)
    highline (1.7.8)
    i18n (0.8.6)
    jbuilder (2.7.0)
      activesupport (>= 4.2.0)
      multi_json (>= 1.2)
    jquery-hotkeys-rails (0.7.9.1)
      railties (>= 3.1)
    jquery-rails (4.3.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-turbolinks (2.1.0)
      railties (>= 3.1.0)
      turbolinks
    jquery-ui-rails (6.0.1)
      railties (>= 3.2.16)
    json (1.8.6)
    kaminari (1.0.1)
      activesupport (>= 4.1.0)
      kaminari-actionview (= 1.0.1)
      kaminari-activerecord (= 1.0.1)
      kaminari-core (= 1.0.1)
    kaminari-actionview (1.0.1)
      actionview
      kaminari-core (= 1.0.1)
    kaminari-activerecord (1.0.1)
      activerecord
      kaminari-core (= 1.0.1)
    kaminari-core (1.0.1)
    libxml-ruby (3.0.0)
    link_header (0.0.8)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.6)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.2.0)
    minitest (5.10.2)
    multi_json (1.12.1)
    multipart-post (2.0.0)
    net-http-persistent (2.9.4)
    net-ldap (0.16.0)
    nio4r (2.1.0)
    nokogiri (1.8.0)
      mini_portile2 (~> 2.2.0)
    options (2.3.2)
    orm_adapter (0.5.0)
    paranoia (2.3.1)
      activerecord (>= 4.0, < 5.2)
    pg (0.21.0)
    pr_geohash (1.0.0)
    progress_bar (1.1.0)
      highline (~> 1.6)
      options (~> 2.3.0)
    rack (2.0.3)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (5.1.2)
      actioncable (= 5.1.2)
      actionmailer (= 5.1.2)
      actionpack (= 5.1.2)
      actionview (= 5.1.2)
      activejob (= 5.1.2)
      activemodel (= 5.1.2)
      activerecord (= 5.1.2)
      activesupport (= 5.1.2)
      bundler (>= 1.3.0, < 2.0)
      railties (= 5.1.2)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails-i18n (5.0.4)
      i18n (~> 0.7)
      railties (~> 5.0)
    railties (5.1.2)
      actionpack (= 5.1.2)
      activesupport (= 5.1.2)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    rb-fsevent (0.10.2)
    rb-inotify (0.9.10)
      ffi (>= 0.5.0, < 2)
    rdf (2.2.6)
      hamster (~> 3.0)
      link_header (~> 0.0, >= 0.0.8)
    rdoc (4.3.0)
    responders (2.4.0)
      actionpack (>= 4.2.0, < 5.3)
      railties (>= 4.2.0, < 5.3)
    rsolr (2.0.2)
      builder (>= 2.1.2)
      faraday
    sass (3.5.1)
      sass-listen (~> 4.0.0)
    sass-listen (4.0.0)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sdoc (0.4.2)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    sparql-client (2.1.0)
      net-http-persistent (~> 2.9)
      rdf (~> 2.0)
    spring (2.0.2)
      activesupport (>= 4.2)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sru (0.0.9)
      libxml-ruby
    sunspot (2.2.7)
      pr_geohash (~> 1.0)
      rsolr (>= 1.1.1, < 3)
    sunspot_rails (2.2.7)
      nokogiri
      rails (>= 3)
      sunspot (= 2.2.7)
    thor (0.19.4)
    thread_safe (0.3.6)
    tilt (2.0.7)
    turbolinks (5.0.1)
      turbolinks-source (~> 5)
    turbolinks-source (5.0.3)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    uglifier (3.2.0)
      execjs (>= 0.3.0, < 3)
    warden (1.2.7)
      rack (>= 1.0)
    web-console (3.5.1)
      actionview (>= 5.0)
      activemodel (>= 5.0)
      bindex (>= 0.4.0)
      railties (>= 5.0)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)

PLATFORMS
  ruby

DEPENDENCIES
  activesupport
  ancestry
  bootstrap-datepicker-rails
  bootstrap-sass
  bootstrap-timepicker-rails-addon
  byebug
  cancancan
  cocoon
  coffee-rails (~> 4.2.1)
  devise
  font-awesome-sass
  jbuilder
  jquery-hotkeys-rails
  jquery-rails
  jquery-turbolinks
  jquery-ui-rails
  kaminari
  net-ldap
  paranoia (~> 2.2)
  pg
  progress_bar
  rails (= 5.1.2)
  rails-i18n
  rsolr
  sass-rails
  sdoc (~> 0.4.0)
  sparql-client
  spring
  sru
  sunspot_rails
  turbolinks
  uglifier
  web-console

BUNDLED WITH
   1.14.6
s0rin commented 7 years ago

This issue is already reported #5881 and 1.15.3 should fix it, but it doesn't.

segiddins commented 7 years ago

Can you share the contents of /var/www/konsys/.bundle/config? Thanks!

s0rin commented 7 years ago

As requested, here the contents of /var/www/konsys/.bundle/config:

---
BUNDLE_FROZEN: "1"
BUNDLE_PATH:
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_BIN: "bin"
segiddins commented 7 years ago

If you change the third line to BUNDLE_PATH: "", it should fix the issue, and future versions of Bundler will properly serialize the YAML

s0rin commented 7 years ago

After changing the third line as indicated, the error "TypeError: no implicit conversion of Hash into String" occured again after 'bundler install' run and surprisely BUNDLE_PATH was replaced as originally. It seems the config file is updated/rewrited during 'bundler install':

$ ls -lrt /var/www/konsys/.bundle/config
-rwxr-xr-x 1 www-data www-data 89 Aug 25 19:28 /var/www/konsys/.bundle/config
$ cat /var/www/konsys/.bundle/config
---
BUNDLE_FROZEN: "1"
BUNDLE_PATH:
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_BIN: "bin"
segiddins commented 7 years ago

And that was with Bundler 1.15.4?

s0rin commented 7 years ago

No, it was 1.15.3... But after update to 1.15.4 nothing changed, the error reoccured and the BUNDLE_PATH was again overwritten.

segiddins commented 7 years ago

Damn, ok, thanks! I'll do my best to look into this

segiddins commented 7 years ago

How had you originally set the path config setting? (I can't reproduce the issue locally)

s0rin commented 7 years ago

I am not sure about which config setting are you asking for, could you be more specific please? This issue occurs on a productive server with the intention to deploy a Rails app with Passenger.

segiddins commented 7 years ago

The path setting

s0rin commented 7 years ago

PATH=/var/www/.rbenv/shims:/var/www/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

segiddins commented 7 years ago

I mean Bundler's path setting, the BUNDLE_PATH on in the config problem that is causing problems

s0rin commented 7 years ago

Initially I haven't explicity set BUNDLE_PATH, just when you asked to change it to "" for test purposes. This attempt failed (see above). Now I've repeated the test and I set BUNDLE_PATH: "~/.bundle", then I ran bundle install and Bundle completed without errors(!).

segiddins commented 7 years ago

But it must have been set to something to have gotten into the config in the first place

s0rin commented 7 years ago

You're right, but I don't know how and what have been set. In any case I usually do not touch this file, actually I did know about its existence until you asked me to edit it.

segiddins commented 7 years ago

In that case, I'm sorry, but I don't really know how to move forward. Without a way for me to reproduce the bug locally (the generation of the invalid config file), I don't know I can fix it

s0rin commented 7 years ago

Yes, I understand you perfectly and I guess you can close this ticket, the error could be avoided by editing the config file.

Thank you for your time and energy!