Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Missing or uninitialized constant: Bundler::Deprecate when installing a bundle with Rubinius #6163

Closed
philr opened this issue Nov 9, 2017 · 5 comments

Comments

@philr
Copy link

philr commented Nov 9, 2017

Running bundle install with Bundler version 1.16.0 on Rubinius can fail with a 'Missing or uninitialized constant: Bundler::Deprecate' error.

The error only occurs when the Gemfile references gems that are not already installed (or when forcing gems to be installed with bundle install --force).

I encounter the error with clean installs of Rubinius versions 3.82 and 3.86 using both RubyGems versions 2.6.14 and 2.7.2.

Running bundle install --force with Bundler version 1.15.4 works correctly on Rubinius 3.82 and 3.86.

This issue appears to have been caused by commit f9599c7.

Backtrace

NameError: Missing or uninitialized constant: Bundler::Deprecate
  core/module.rb:548:in `const_missing'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/deprecate.rb:22:in `__script__'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/deprecate.rb:10:in `__script__'
  core/code_loader.rb:233:in `require'
  core/kernel.rb:851:in `gem_original_require (require)'
  /home/philr/.rbenv/versions/rbx-3.86/site/rubygems/core_ext/kernel_require.rb:55:in `require'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/psyched_yaml.rb:30:in `__script__'
  core/code_loader.rb:233:in `require'
  core/kernel.rb:851:in `gem_original_require (require)'
  /home/philr/.rbenv/versions/rbx-3.86/site/rubygems/core_ext/kernel_require.rb:55:in `require'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/rubygems_integration.rb:115:in `configuration'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/fetcher.rb:242:in `connection'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/fetcher.rb:85:in `initialize'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/source/rubygems.rb:251:in `fetchers'
  core/array.rb:93:in `map'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/source/rubygems.rb:249:in `fetchers'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/source/rubygems.rb:383:in `remote_specs'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/index.rb:11:in `build'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/source/rubygems.rb:382:in `remote_specs'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/source/rubygems.rb:89:in `specs'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/lazy_specification.rb:76:in `__materialize__'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/spec_set.rb:85:in `materialize'
  core/array.rb:113:in `map!'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/spec_set.rb:82:in `materialize'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/definition.rb:170:in `specs'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/definition.rb:158:in `resolve_remotely!'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/installer.rb:279:in `resolve_if_needed'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/installer.rb:83:in `run'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/process_lock.rb:12:in `lock'
  core/io.rb:1391:in `open'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/process_lock.rb:9:in `lock'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/installer.rb:72:in `run'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/installer.rb:25:in `install'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/cli/install.rb:65:in `run'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/cli.rb:224:in `install'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/settings.rb:136:in `temporary'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/cli.rb:223:in `install'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/cli.rb:27:in `dispatch'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/cli.rb:18:in `start'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/exe/bundle:30:in `__script__'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
  /home/philr/.rbenv/versions/rbx-3.86/gems/gems/bundler-1.16.0/exe/bundle:22:in `__script__'
  core/kernel.rb:572:in `load'
  /home/philr/.rbenv/versions/rbx-3.86/bin/bundle:23:in `__script__'
  core/code_loader.rb:505:in `load_script'
  core/code_loader.rb:590:in `load_script'
  core/loader.rb:679:in `script'
  core/loader.rb:861:in `main'

Environment

Bundler       1.16.0
  Platforms   ruby, x86_64-linux, x86_64-rubinius-3.86
Ruby          2.3.1p0 (2017-09-27 revision 0) [x86_64-linux-gnu]
  Full Path   /home/philr/.rbenv/versions/rbx-3.86/bin/rbx
  Config Dir  /home/philr/.rbenv/versions/rbx-3.86/etc
RubyGems      2.6.14
  Gem Home    /home/philr/.rbenv/versions/rbx-3.86/gems
  Gem Path    /home/philr/.rbenv/versions/rbx-3.86/gems:/home/philr/.gem/rbx/2.3
  User Path   /home/philr/.gem/rbx/2.3
  Bin Dir     /home/philr/.rbenv/versions/rbx-3.86/gems/bin
OpenSSL
  Compiled    OpenSSL 1.0.2g  1 Mar 2016
  Loaded      OpenSSL 1.0.2g  1 Mar 2016
  Cert File   /usr/lib/ssl/cert.pem
  Cert Dir    /usr/lib/ssl/certs
Tools
  Git         2.15.0
  RVM         not installed
  rbenv       rbenv 1.1.1-6-g2d7cefe
  chruby      not installed

Bundler Build Metadata

Built At          2017-10-31
Git SHA           10f20fa33
Released Version  true

Gemfile

Gemfile

source "https://rubygems.org"

gem 'tzinfo'

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    thread_safe (0.3.6)
    tzinfo (1.2.4)
      thread_safe (~> 0.1)

PLATFORMS
  ruby

DEPENDENCIES
  tzinfo

BUNDLED WITH
   1.15.4
@akhramov
Copy link
Contributor

@segiddins defined? Bundler::Deprecate always returns true on Rubinius due to autoloading differences with MRI (rubinius/rubinius#3769)

Also, as bundler uses autoloading to load Bundler::Deprecate constant, I'm wondering if it's necessary to require bundler/deprecate:
https://github.com/bundler/bundler/blob/f9599c7e8c6775bb4044ad2b4809a957ef8fadea/lib/bundler/psyched_yaml.rb#L30-L37

@segiddins
Copy link
Member

It’s necessary in case that file is required before “bundler”, which is what declares the autoload

@mach-kernel
Copy link

I am having this same issue with rubinius 3.84 (2.3.1 3970f17d 2017-08-02 5.0.0) [x86_64-darwin16.7.0]

@brixen
Copy link
Contributor

brixen commented Jan 20, 2018

The Bundler::Deprecate issue is fixed in Rubinius 3.93 (thanks to @akhramov for opening the issue and providing an initial repro). This issue can be close.

There is a concurrency issue with Bundler 1.16.1 that is being tracked here rubinius/rubinius#3781.

berkos added a commit to berkos/appraisal that referenced this issue Jan 21, 2018
berkos added a commit to berkos/appraisal that referenced this issue Jan 21, 2018
@segiddins
Copy link
Member

The Bundler::Deprecate issue is fixed in Rubinius 3.93

Thanks @brixen ! I hope to be able to look into #6274 soon, but life has been very hectic recently

kolen added a commit to kolen/redcarpet that referenced this issue Feb 28, 2018
kamui pushed a commit to kamui/retriable that referenced this issue Jun 8, 2018
…or the array form of :on (#62)

* Switch to rspec

* Move the srand setting into the global rspec config

* check the exception message; remove jruby from allowable failures

* Address some hounds; move test exceptions to support file

* Address some hound comments

* Appease some hounds

* More rpsec styley

* get rid of minitest altogether

* README

* Make tests more rspec-y

* hound

* Even more DRYing up of spec code

* rspec switch

* Add .rspec file

* Fix warning; some rspec style

* Reorganize some specs

* Rename TestError to NonStandardError for clarity; simplify the default methods for raising errors in specs

* Add a spec for array :on parameter; use the be_a rspec matcher

* refactor 0 rand factor section into context

* refactor 0 rand factor section into context

* DRYify

* even more DRY

* Hound

* use described_class where appropriate

* Use standard args for standard specs

* Fix rspec gemspec dependency (not sure how this ever worked)

* rename spec variable

* better invalid options spec

* better spec description

* check error message on bad argument exception

* hound

* update the rubinius version so that the travis build doesn't fail: rubygems/bundler#6163

* try rubinius 3.99

* try formatting the rspec output to see wtf rubinius doesn't agree with

* always run rspec with full formatting

* always run rspec with full formatting

* update travis ruby matrix to latest bugfixed releases

* Update ruby version test matrix

* update rubocop.yml with latest cop names
kimburgess added a commit to cotag/uv-rays that referenced this issue Aug 24, 2018
eregon added a commit to eregon/bundler that referenced this issue Sep 9, 2018
* Otherwise, it should be defined by this file.
* The issue is bundler/deprecate.rb checks `defined? Bundler::Deprecate`
  and this would normally return true since an autoload is defined for
  that constant. But since the autoload file is #require-d explicitly
  (by bundler/psyched_yaml and bundler/shared_helpers), MRI makes it
  undefined to save this pattern. This however requires a complex
  autoload implementation and is confusing to debug, so let's simplify.
* Related to rubygems#6163 and
  rubinius/rubinius#3769.
bundlerbot added a commit that referenced this issue Sep 10, 2018
…egiddins

Check that Bundler::Deprecate is not an autoload constant

* Otherwise, it should be defined by this file.
* The issue is bundler/deprecate.rb checks `defined? Bundler::Deprecate`
  and this would normally return true since an autoload is defined for
  that constant. But since the autoload file is #require-d explicitly
  (by bundler/psyched_yaml and bundler/shared_helpers), MRI makes it
  undefined to save this pattern. This however requires a complex
  autoload implementation and is confusing to debug, so let's simplify.
* Related to #6163 and rubinius/rubinius#3769.

### What was the end-user problem that led to this PR?

Bundler fails in TruffleRuby without this change.
We plan to fix this case in TruffleRuby, but since at least 2 Ruby implementations did not expect such a corner case, we should make the code simpler since it's easy enough in this case.

### What was your diagnosis of the problem?

See above.

### Why did you choose this fix out of the possible options?

It's simple and does not break if an extra `require "bundler/deprecate"` is later added in the codebase.
colby-swandale pushed a commit that referenced this issue Sep 14, 2018
…egiddins

Check that Bundler::Deprecate is not an autoload constant

* Otherwise, it should be defined by this file.
* The issue is bundler/deprecate.rb checks `defined? Bundler::Deprecate`
  and this would normally return true since an autoload is defined for
  that constant. But since the autoload file is #require-d explicitly
  (by bundler/psyched_yaml and bundler/shared_helpers), MRI makes it
  undefined to save this pattern. This however requires a complex
  autoload implementation and is confusing to debug, so let's simplify.
* Related to #6163 and rubinius/rubinius#3769.

### What was the end-user problem that led to this PR?

Bundler fails in TruffleRuby without this change.
We plan to fix this case in TruffleRuby, but since at least 2 Ruby implementations did not expect such a corner case, we should make the code simpler since it's easy enough in this case.

### What was your diagnosis of the problem?

See above.

### Why did you choose this fix out of the possible options?

It's simple and does not break if an extra `require "bundler/deprecate"` is later added in the codebase.

(cherry picked from commit 02af3c2)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Sep 23, 2018
## 1.16.5 (2018-09-18)

Changes:

  - Add support for TruffleRuby (@eregon)

Bugfixes:

  - Avoid printing git errors when checking the version on incorrectly packaged versions of Bundler ([#6453](rubygems/bundler#6453), @greysteil)
  - Fix issue where Bundler does not check the given class when comparing equality in DepProxy (@ChrisBr)
  - Handle `RangeNotSatisfiable` error in Compact Index (@MaxLap)
  - Check for initialized `search` variable in `LazySpecification` (@voxik)
  - Fix LoadError occurring in nested bundle exec calls ([#6537](rubygems/bundler#6537), @colby-swandale)
  - Check that Bundler::Deprecate is not an autoload constant ([#6163](rubygems/bundler#6163), @eregon)
  - Prefer non-pre-release versions when performing a `bundle update --patch` ([#6684](rubygems/bundler#6684), @segiddins)

## 1.16.4 (2017-08-17)

Changes:

  - Welcome new members to the Bundler core team (@indirect)
  - Don't mutate original error trees when determining version_conflict_message (@greysteil)
  - Update vendored Molinillo to 0.6.6 (@segiddins)

Bugfixes:

  - Reword bundle update regression message to be more clear to the user when a gem's version is downgraded ([#6584](rubygems/bundler#6584), @ralphbolo)
  - Respect --conservative flag when updating a dependency group ([#6560](rubygems/bundler#6560), @greysteil)
  - Fix issue where a pre-release version was not being selected when it's specified in the Gemfile ([#6449](rubygems/bundler#6449), @akihiro17)
  - Fix issue where `Etc` was not loaded when getting the user's home dir ([#6640](rubygems/bundler#6640), @colby-swandale)
  - Use UTF-8 for reading files including Gemfile ([#6660](rubygems/bundler#6660), @eregon)
  - Remove unnecessary `while` loop in path resolver helper (@ojab)

Documentation:

  - Document that `bundle show [--paths]` sorts results by name (@kemitchell)

## 1.16.3 (2018-07-17)

Features:

  - Support URI::File of Ruby 2.6 (@hsbt)

Bugfixes:

  - Expand symlinks during setup to allow Bundler to load correctly when using symlinks in $GEM_HOME ([#6465](rubygems/bundler#6465), @ojab, @indirect)
  - Dont let Bundler create temporary folders for gem installs which are owned by root ([#6258](rubygems/bundler#6258), @colby-swandale)
  - Don't fallback to using temporary directories when needed directories already exist ([#6546](rubygems/bundler#6546), @brodock)
  - Use SharedHelpers.filesystem_access when reading a Gemfile so friendly error messages can be given to the user ([#6541](rubygems/bundler#6541), @segiddins)
  - Check if source responds to `#remotes` before printing gem install error message ([#6211](rubygems/bundler#6211), @colby-swandale)
  - Handle Errno::ENOTSUP in the Bundler Process Lock to prevent exceptions when using NFS mounts ([#6566](rubygems/bundler#6566), @colby-swandale)
  - Respect encodings when reading gemspecs ([#6598](rubygems/bundler#6598), @deivid-rodriguez)

Documentation:

  - Fix links between manual pages (@BanzaiMan)
  - Add warning to Gemfile documentation for the use of the `source` option when declaring gems ([#6280](rubygems/bundler#6280), @forestgagnon)

## 1.16.2 (2018-04-20)

Changes:

  - Include the gem's source in the gem install error message when available (@papanikge)
  - Remove unnecessary executable bit from gem template (@voxik)
  - Dont add the timestamp comment with gems added to the Gemfile via `bundle add` ([#6193](rubygems/bundler#6193), @cpgo)
  - Improve yanked gem error message (@alyssais)
  - Use `Bundler.rubygems.inflate` instead of the Gem::Util method directly (@segiddins)
  - Remove unused instance variable (@segiddins)

Bugfixes:

  - Only trap INT signal and have Ruby's signal default handler be invoked (@shayonj)
  - Fix warning about the use of `__FILE__` in RubyGems integration testing (@MSP-Greg)
  - Skip the outdated bundler check when MD5 is not available ([#6032](rubygems/bundler#6032), @segiddins)
  - Fallback to the original error if the friendly message raises (@segiddins)
  - Rename Bundler.frozen? to avoid Object method conflict ([#6252](rubygems/bundler#6252), @segiddins)
  - Ensure the bindir exists before installing gems (@segiddins)
  - Handle gzip corruption errors in the compact index client ([#6261](rubygems/bundler#6261), @colby-swandale)
  - Check if the current directory is writeable when writing files in `bundle gem` ([#6219](rubygems/bundler#6219), @nilsding)
  - Fix hang when gemspec has incompatible encoding (@deivid-rodriguez)
  - Gracefully handle when the lockfile is missing spec entries for the current platform ([#6079](rubygems/bundler#6079), @segiddins)
  - Use Gem::Util.inflate instead of Gem.inflate (@hsbt)
  - Update binstub generator to use new ERB.new arity in Ruby 2.6 (@koic)
  - Fix `source_location` call in rubygems integration (@MSP-Greg)
  - Use `filesystem_access` when copying files in Compact Index Updater ([#6289](rubygems/bundler#6289), @segiddins)
  - Fail gracefully when resetting git gems to the given revision fails ([#6324](rubygems/bundler#6324), @segiddins)
  - Handle exceptions that do not have a backtrace ([#6342](rubygems/bundler#6342), @nesaulov)
  - Check if stderr was closed before writing to it (@shime)
  - Handle updating a specific gem for a non-local platform ([#6350](rubygems/bundler#6350), @greysteil)
  - Bump the `bundle_binstub` check-length to 300 characters (@tduffield)
  - Fix specifying alterntive Lockfile with `bundle lock` when default gemfile is present  ([#6460](rubygems/bundler#6460), @agrim123)
  - Allow installing dependencies when the path is set to `.`  ([#6475](rubygems/bundler#6475), @segiddins)
  - Support Bundler installing on a readonly filesystem without a home directory ([#6461](rubygems/bundler#6461), @grosser)
  - Filter git uri credentials in source description (@segiddins)

Documentation:

  - Correct typos in `bundle binstubs` man page (@erikj, @samueloph)
  - Update links in `bundle gem` command documentation to use https (@KrauseFx)
  - Fix broken links between bundler man pages (@segiddins)
  - Add man page for the `bundle doctor` command ([#6243](rubygems/bundler#6243), @nholden)
  - Document `# frozen_string_literal` in `bundle init` Gemfile (@315tky)
  - Explain the gemspec files attribute in `bundle gem` template and print a link to bundler.io guides when running `bundle gem` ([#6246](rubygems/bundler#6246), @nesaulov)
  - Small copy tweaks & removed redundant phrasing in the bundler man page (@rubymorillo)
  - Improve the documentation of the settings load order in Bundler (@rubymorillo)
  - Added license info to main README (@rubymorillo)
  - Document parameters and return value of Injector#inject (@tobias-grasse)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants