Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installed gems when running gem install command #7437

Open
taichi-ishitani opened this issue Jan 30, 2024 · 1 comment
Open

Update installed gems when running gem install command #7437

taichi-ishitani opened this issue Jan 30, 2024 · 1 comment
Labels

Comments

@taichi-ishitani
Copy link

Describe the problem as clearly as you can

For case below

  • gem foo
    • depends on gem bar and baz
    • not yet installed
  • gem bar, baz
    • depen on gem qux
    • not yet installed
  • gem qux
    • already installed
    • but not latest

When running gem install foo command to install foo gem, the command also install the latest qux gem.
On the other hand, when installing bar or baz gem, the qux gem is not updated.

Which behavior is correct behavior?

Did you try upgrading RubyGems?

Yes, I got source files from this repository and tested this problem.

Post steps to reproduce the problem

  • rggen-spreadsheet-loader
    • depends on spreadsheet and spreadbase gems
  • spreadsheet
    • depends on bigdecimal gem
    • not yet installed
  • spreadbase
    • depends on bigdecimal gem
    • not yet installed
  • bigdecimal
    • already installed as an default gem

When installing the rggen-spreadsheet-loader gem the bigdecimal gem is also updated.
Run the command below then you can see this behavior:

$ docker build --progress plain -t test -<<EOF
> FROM ruby:3.3-alpine
> RUN gem install --explain rggen-spreadsheet-loader
> EOF

The bigdecimal-3.1.6 is listed even though the bigdecimal-3.1.5 is installed.

#6 [2/2] RUN gem install --explain rggen-spreadsheet-loader
#6 1.029 Gems to install:
#6 1.029   ruby-ole-1.2.12.2
#6 1.029   bigdecimal-3.1.6
#6 1.029   spreadsheet-1.3.1
#6 1.029   rubyzip-2.3.2
#6 1.029   rexml-3.2.6
#6 1.029   spreadbase-0.6.0
#6 1.029   racc-1.7.3
#6 1.029   nokogiri-1.16.0-x86_64-linux
#6 1.029   simple_xlsx_reader-5.0.0
#6 1.029   csv-3.2.8
#6 1.029   rggen-spreadsheet-loader-0.25.2
#6 DONE 1.1s

When installing spreadbase gem bigdecimal gem is not updated.
Run the command below then you can see this behavior:

$ docker build --progress plain -t test -<<EOF
FROM ruby:3.3-alpine
RUN gem install --explain spreadbase
EOF

The bigdecimal-3.1.5 gem is listed instead of bigdecimal-3.1.6.

#6 [2/2] RUN gem install --explain spreadbase
#6 1.007 Gems to install:
#6 1.007   rubyzip-2.3.2
#6 1.007   rexml-3.2.6
#6 1.007   bigdecimal-3.1.5
#6 1.007   spreadbase-0.6.0
#6 DONE 1.0s

What were you expecting to happen?

I'm not sure which behavior is valid behavior.

Run gem env and paste the output below

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.5.5
  - RUBY VERSION: 3.3.0 (2023-12-25 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY: /opt/rbenv/versions/3.3.0/lib/ruby/gems/3.3.0
  - USER INSTALLATION DIRECTORY: /home/taichi/.local/share/gem/ruby/3.3.0
  - RUBY EXECUTABLE: /opt/rbenv/versions/3.3.0/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /opt/rbenv/versions/3.3.0/bin
  - SPEC CACHE DIRECTORY: /home/taichi/.cache/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /opt/rbenv/versions/3.3.0/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-linux
  - GEM PATHS:
     - /opt/rbenv/versions/3.3.0/lib/ruby/gems/3.3.0
     - /home/taichi/.local/share/gem/ruby/3.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => true
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /opt/rbenv/versions/3.3.0/bin
     - /opt/rbenv/libexec
     - /opt/rbenv/plugins/ruby-build/bin
     - /opt/rbenv/plugins/rbenv-update/bin
     - /home/taichi/.cargo/bin
     - /opt/rust/bin
     - /opt/rbenv/shims
     - /opt/rbenv/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
     - /usr/lib/wsl/lib
     - /mnt/c/WINDOWS/system32
     - /mnt/c/WINDOWS
     - /mnt/c/WINDOWS/System32/Wbem
     - /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/
     - /mnt/c/WINDOWS/System32/OpenSSH/
     - /mnt/c/Program Files/Microsoft VS Code/bin
     - /mnt/c/Program Files (x86)/Common Files/Sony Shared/FeliCaLibrary
     - /mnt/c/Program Files/Common Files/Sony Shared/FeliCaLibrary
     - /Docker/host/bin
     - /mnt/c/Users/taichi/AppData/Local/Microsoft/WindowsApps
     - /snap/bin
@taichi-ishitani
Copy link
Author

During installing rggen-spreadsheet-loader gem, bigdecimal gem is actived twice.

$ DEBUG_RESOLVER=true gem install --explain  rggen-spreadsheet-loader | grep bigdecimal
:   2: Requiring nested dependencies (ruby-ole (>= 0), bigdecimal (>= 0))
:   7: Requiring nested dependencies (rubyzip (>= 2.3.0), rexml (>= 3.2.4), bigdecimal (>= 3.0.0))
:   8: Creating possibility state for bigdecimal (>= 3.0.0) (1 remaining)
:   9: Attempting to activate [bigdecimal-3.0.0, bigdecimal-3.0.2, bigdecimal-3.1.0, bigdecimal-3.1.1, bigdecimal-3.1.2, bigdecimal-3.1.3, bigdecimal-3.1.4, bigdecimal-3.1.5, bigdecimal-3.1.6, bigdecimal-3.1.5]
:   9: Activated bigdecimal at [bigdecimal-3.0.0, bigdecimal-3.0.2, bigdecimal-3.1.0, bigdecimal-3.1.1, bigdecimal-3.1.2, bigdecimal-3.1.3, bigdecimal-3.1.4, bigdecimal-3.1.5,bigdecimal-3.1.6, bigdecimal-3.1.5]
:   9: Creating possibility state for bigdecimal (>= 0) (1 remaining)
:  10: Attempting to activate [bigdecimal-1.1.0, bigdecimal-1.2.0, bigdecimal-1.2.1, bigdecimal-1.2.2, bigdecimal-1.2.3, bigdecimal-1.2.4, bigdecimal-1.2.5, bigdecimal-1.2.6, bigdecimal-1.2.7, bigdecimal-1.3.0, bigdecimal-1.3.1, bigdecimal-1.3.2, bigdecimal-1.3.3, bigdecimal-1.3.4, bigdecimal-1.3.5, bigdecimal-1.4.0, bigdecimal-1.4.1, bigdecimal-1.4.2, bigdecimal-1.4.3, bigdecimal-1.4.4, bigdecimal-2.0.0, bigdecimal-2.0.2, bigdecimal-2.0.3, bigdecimal-3.0.0, bigdecimal-3.0.2, bigdecimal-3.1.0, bigdecimal-3.1.1, bigdecimal-3.1.2, bigdecimal-3.1.3, bigdecimal-3.1.4, bigdecimal-3.1.5, bigdecimal-3.1.6, bigdecimal-3.1.5]
:  10: Found existing spec ([bigdecimal-3.0.0, bigdecimal-3.0.2, bigdecimal-3.1.0, bigdecimal-3.1.1, bigdecimal-3.1.2, bigdecimal-3.1.3, bigdecimal-3.1.4, bigdecimal-3.1.5, bigdecimal-3.1.6, bigdecimal-3.1.5])
:   0: Activated: rggen-spreadsheet-loader, spreadsheet, spreadbase, simple_xlsx_reader, csv, ruby-ole, bigdecimal, rubyzip, nokogiri, racc, mini_portile2, rexml
  bigdecimal-3.1.6

After 2nd activation, attempt_to_filter_existing_spec is called and then possibilities are uniquefied.
Because of this, bigdecimal gem is updated during installing rggen-spreadsheet-loader gem.

On the other hand, bigdecimal gem is activated once during installing spreadbas gem.

$ DEBUG_RESOLVER=true gem install --explain spreadbase | grep bigdecimal
:   1: Requiring nested dependencies (rubyzip (>= 2.3.0), rexml (>= 3.2.4), bigdecimal (>= 3.0.0))
:   2: Creating possibility state for bigdecimal (>= 3.0.0) (1 remaining)
:   3: Attempting to activate [bigdecimal-3.0.0, bigdecimal-3.0.2, bigdecimal-3.1.0, bigdecimal-3.1.1, bigdecimal-3.1.2, bigdecimal-3.1.3, bigdecimal-3.1.4, bigdecimal-3.1.5, bigdecimal-3.1.6, bigdecimal-3.1.5]
:   3: Activated bigdecimal at [bigdecimal-3.0.0, bigdecimal-3.0.2, bigdecimal-3.1.0, bigdecimal-3.1.1, bigdecimal-3.1.2, bigdecimal-3.1.3, bigdecimal-3.1.4, bigdecimal-3.1.5,bigdecimal-3.1.6, bigdecimal-3.1.5]
:   0: Activated: spreadbase, rubyzip, rexml, bigdecimal
  bigdecimal-3.1.5

possibilities are not uniquefied because attempt_to_filter_existing_spec method is not called so bigdecimal gem is not updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant