8000 "Unresolved or ambiguous specs during Gem::Specification.reset" warning for a default gem implemented in TruffleRuby · Issue #7937 · rubygems/rubygems · GitHub
[go: up one dir, main page]

Skip to content
"Unresolved or ambiguous specs during Gem::Specification.reset" warning for a default gem implemented in TruffleRuby #7937
@andrykonchin

Description

@andrykonchin

Describe the problem as clearly as you can

We have noticed that in some cases a WARN: Unresolved or ambiguous specs during Gem::Specification.reset warning is printed on TruffleRuby. And we don't observe the same on CRuby.

Specifically some rubygems' related command print the following warning in a working directory of a bundler-audit gem:

WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
      stringio (>= 0)
      Available/installed versions of this gem:
      - 3.1.1
      - 3.0.4
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.

bundle-audit uses upgraded (so not default) versions of psych (5.1.2) and its dependency stringio (3.1.1). TruffleRuby implements stringio on its own in Ruby (in CRuby stringio is a native extension).

When the psych is explicitly required by rubygems the stringio is added into a “unresolved dependencies” list. When stringio is required in one of the psych’s files stringio is “activated” and removed from the “unresolved dependencies” list. Later all the items in this list are printed in the warning mentioned above.

On TruffleRuby the logic of activation for stringio doesn't work as expected and it isn't activated. To activate a gem - a stringio.rb (or binary file) should be found in a gem’s directory.

On my machine rubygems checks the following directories:

  • /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/lib/gems/gems/stringio-3.1.1/lib/
  • /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/lib/gems/extensions/x86_64-darwin/3.2.4.1/stringio-3.1.1/
  • /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/lib/gems/gems/stringio-3.0.4/lib
  • /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/lib/gems/extensions/x86_64-darwin/3.2.4.1/stringio-3.0.4

to find a file stringio with the following suffixes - “”, “.rb”, “.bundle”.

Both directories don’t contain native extension for installed 3.1.1 version and TruffleRuby own implementation.

So the question is the following - could you suggest a proper way to have a default gem activated in case its implemented separately and isn't located in a gem's installation directory? I suppose it's the root cause of the printing the warning mentioned above.

Did you try upgrading RubyGems?

No

Post steps to reproduce the problem

  • clone a bundler-audit gem Git repository (https://github.com/rubysec/bundler-audit) - current version is 0.9.1
  • switch to a TruffleRuby dev build
  • install dependencies with bundle install
  • run command gem info rake (or any other gem command)

Which command did you run?

$ gem info rake

What were you expecting to happen?

*** LOCAL GEMS ***

rake (13.2.1, 13.0.6, 12.3.3)
    Authors: Hiroshi SHIBATA, Eric Hodel, Jim Weirich
    Homepage: https://github.com/ruby/rake
    License: MIT
    Installed at (13.2.1): /Users/andrykonchin/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0
                 (13.0.6): /Users/andrykonchin/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0
                 (12.3.3): /Users/andrykonchin/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0

    Rake is a Make-like program implemented in Ruby

What actually happened?

WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
      stringio (>= 0)
      Available/installed versions of this gem:
      - 3.1.1
      - 3.0.4
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.

*** LOCAL GEMS ***

rake (13.2.1, 13.0.6)
    Authors: Hiroshi SHIBATA, Eric Hodel, Jim Weirich
    Homepage: https://github.com/ruby/rake
    License: MIT
    Installed at (13.2.1): /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/lib/gems
                 (13.0.6): /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/lib/gems

    Rake is a Make-like program implemented in Ruby

Run gem env and paste the output below

WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
      stringio (>= 0)
      Available/installed versions of this gem:
      - 3.1.1
      - 3.0.4
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
RubyGems Environment:
  - RUBYGEMS VERSION: 3.4.19
  - RUBY VERSION: 3.2.4 (2024-08-12 patchlevel 0) [x86_64-darwin23]
  - INSTALLATION DIRECTORY: /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/lib/gems
  - USER INSTALLATION DIRECTORY: /Users/andrykonchin/.gem/truffleruby/3.2.4.1
  - RUBY EXECUTABLE: /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/bin/truffleruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/bin
  - SPEC CACHE DIRECTORY: /Users/andrykonchin/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/darwin-amd64/TRUFFLERUBY_BOOTSTRAP_HOME/etc
  - RUBYGEMS PLATFORMS:
     - ruby
  - GEM PATHS:
     - /Users/andrykonchin/projects/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/lib/gems
     - /Users/andrykonchin/.gem/truffleruby/3.2.4.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => true
     - :bulk_threshold => 1000
     - "gem" => "--no-document"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/andrykonchin/.rbenv/versions/truffleruby-jvm/bin
     - /usr/local/Cellar/rbenv/1.2.0/libexec
     - /Users/andrykonchin/projects/truffleruby-ws/mx
     - /usr/local/Cellar/python@3.10/3.10.6_2/libexec/bin
     - /usr/local/sbin
     - /Users/andrykonchin/.rbenv/shims
     - /usr/local/bin
     - /System/Cryptexes/App/usr/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /var/run/.../bootstrap/usr/local/bin
     - /var/run/.../bootstrap/usr/bin
     - /var/run/.../bootstrap/usr/appleinternal/bin
     - /Applications/iTerm.app/Contents/Resources/utilities
     - /usr/local/Cellar/ctags/5.8_1
     - /Users/andrykonchin/go/bin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0