Bug 43110 - Gem::LoadError: You have already activated bundler 2.2.19, but your Gemfile requires bundler 2.1.4.
Summary: Gem::LoadError: You have already activated bundler 2.2.19, but your Gemfile r...
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: gem-bundler (show other bugs)
Version: unstable
Hardware: x86 Linux
: P5 normal
Assignee: majioa@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-30 05:33 MSK by Vitaly Chikunov
Modified: 2022-10-29 15:09 MSK (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Chikunov 2022-06-30 05:33:49 MSK
$ mkdir /tmp/xyz
$ cd /tmp/xyz
$ echo > Gemfile
$ pry
[1] pry(main)> require 'bundler/setup'
/usr/lib/ruby/gems/2.7.0/gems/stringio-0.1.0/lib/rubygems/source.rb:16: warning: already initialized constant Gem::Source::FILES
/usr/lib/ruby/rubygems/source.rb:16: warning: previous definition of FILES was here
Gem::LoadError: You have already activated bundler 2.2.19, but your Gemfile requires bundler 2.1.4. Prepending `bundle exec` to your command may solve this.
from /usr/lib/ruby/gems/2.7.0/gems/stringio-0.1.0/lib/bundler/runtime.rb:312:in `check_for_activated_spec!'
[2] pry(main)>

$ irb
irb(main):001:0> require 'bundler/setup'
Traceback (most recent call last):
       16: from /usr/bin/irb:23:in `load'
       15: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
       14: from (irb):1
       13: from /usr/lib/ruby/rubygems/core_ext/kernel_require.rb:83:in `require'
       12: from /usr/lib/ruby/rubygems/core_ext/kernel_require.rb:83:in `require'
       11: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/setup.rb:10:in `<top (required)>'
       10: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/ui/shell.rb:88:in `silence'
        9: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/ui/shell.rb:136:in `with_level'
        8: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/setup.rb:10:in `block in <top (required)>'
        7: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler.rb:149:in `setup'
        6: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/runtime.rb:26:in `setup'
        5: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/runtime.rb:26:in `map'
        4: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/spec_set.rb:147:in `each'
        3: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/spec_set.rb:147:in `each'
        2: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/runtime.rb:31:in `block in setup'
        1: from /usr/lib/ruby/gems/2.7.0/gems/reline-0.1.5/lib/bundler/runtime.rb:312:in `check_for_activated_spec!'
Gem::LoadError (You have already activated bundler 2.2.19, but your Gemfile requires bundler 2.1.4. Prepending `bundle exec` to your command may solve this.)
irb(main):002:0>

$ gem list bundler -d

*** LOCAL GEMS ***

bundler (2.2.19, 2.1.4)
    Authors: André Arko, Samuel Giddins, Colby Swandale, Hiroshi
    Shibata, David Rodríguez, Grey Baker, Stephanie Morillo, Chris
    Morris, James Wen, Tim Moore, André Medeiros, Jessica Lynn Suttles,
    Terence Lee, Carl Lerche, Yehuda Katz
    Homepage: https://bundler.io
    License: MIT
    Installed at (2.2.19): /usr/lib/ruby/gems/2.7.0
                 (2.1.4): /usr/lib/ruby/gems/2.7.0

    The best way to manage your application's dependencies

При этом в чистом ruby все работет

$ ruby <<EOF
require 'bundler/setup'
EOF
$

ps. Кроме того, какие-то варнинги если запустить bundler:

$ bundler
/usr/lib/ruby/gems/2.7.0/gems/stringio-0.1.0/lib/rubygems/installer.rb:37: warning: already initialized constant Gem::Installer::ENV_PATHS
/usr/lib/ruby/rubygems/installer.rb:37: warning: previous definition of ENV_PATHS was here
/usr/lib/ruby/gems/2.7.0/gems/stringio-0.1.0/lib/rubygems/installer.rb:42: warning: already initialized constant Gem::Installer::ExtensionBuildError
/usr/lib/ruby/rubygems/installer.rb:42: warning: previous definition of ExtensionBuildError was here
The Gemfile specifies no dependencies
Bundle complete! 0 Gemfile dependencies, 1 gem now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Comment 1 Vitaly Chikunov 2022-07-06 12:59:31 MSK
Поясняю. Bundler - базовая утилита как разработчика, так и часто необходимая конечному пользователю ruby приложений - для установки зависимостей — не работает в интерактивных шеллах irb и pry (с ошибкой что она не той версии). Но работает в голом ruby интерпретаторе (и в bundle exec), что делает проблему не фатальной. А так же сама по себе выводит многочисленные нерелевантные варнинги.

В других дистрибутивах, везде где я проверял, таких проблем ни варнингов не было.
Comment 2 Малъ Скрылевъ 2022-07-06 14:13:31 MSK
Ясно, думаю в версии рубей 3 можео бюуде и исправить оную проблему в бундлере
Comment 3 Малъ Скрылевъ 2022-09-22 22:10:24 MSK
Для версии рубинки 3х ошибка pry не воспроизводится, однако проблема с irb остаётся, хоть и другая
Comment 4 Repository Robot 2022-10-29 15:09:58 MSK
ruby-3.1.2-alt1 -> sisyphus:

 Wed Sep 21 2022 Pavel Skrylev <majioa@altlinux> 3.1.2-alt1
 - ^ 3.1.1 -> 3.1.2
 - ! fix call to irb/erb (closes #43110)
 - ! fix CVEs
  + CVE-2022-28738: Double free in Regexp compilation
  + CVE-2022-28739: Buffer overrun in String-to-Float conversion