Bug 2120562

Summary: Bundled "debug" gem should have hard dependency on "irb"
Product: [Fedora] Fedora Reporter: Vít Ondruch <vondruch>
Component: rubyAssignee: Jun Aruga <jaruga>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jaruga, jprokop, mo, mtasaka, pvalena, ruby-packagers-sig, s, strzibny, vanmeeuwen+fedora, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ruby-3.1.2-168.fc38 ruby-3.1.2-169.fc37 ruby-3.1.2-169.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-01 20:27:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vít Ondruch 2022-08-23 08:59:34 UTC
Description of problem:
Working on updated version of rubygem-shoulda-matchers, I face following test erros:

~~~
      bundler: failed to load command: rake (/usr/bin/rake)
       /usr/share/gems/gems/bundler-2.3.7/lib/bundler/resolver.rb:57:in `rescue in start': Bundler could not find compatible versions for gem "irb": (Bundler::VersionConflict)
         In Gemfile:
           debug was resolved to 1.4.0, which depends on
             irb (>= 1.3.6)

       Could not find gem 'irb (>= 1.3.6)', which is required by gem 'debug', in any of the sources.

... snip ...
~~~

And clearly, debug gem has hard dependency on IRB:

https://github.com/ruby/debug/blob/2cb44483c681f6806bf6843a8f996d3a10d0e42c/debug.gemspec#L30

Version-Release number of selected component (if applicable):
$ rpm -q ruby
ruby-3.1.2-167.fc37.x86_64


How reproducible:
Always

Steps to Reproduce:
1.

~~~
$ ruby -e 'require "debug"'
/usr/share/rubygems/rubygems/specification.rb:1401:in `rescue in block in activate_dependencies': Could not find 'irb' (>= 1.3.6) among 125 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/builddir/.local/share/gem/ruby:/usr/share/gems:/usr/local/share/gems' at: /usr/share/gems/specifications/debug-1.4.0.gemspec, execute `gem env` for more information
	from /usr/share/rubygems/rubygems/specification.rb:1398:in `block in activate_dependencies'
	from /usr/share/rubygems/rubygems/specification.rb:1387:in `each'
	from /usr/share/rubygems/rubygems/specification.rb:1387:in `activate_dependencies'
	from /usr/share/rubygems/rubygems/specification.rb:1369:in `activate'
	from /usr/share/rubygems/rubygems.rb:211:in `rescue in try_activate'
	from /usr/share/rubygems/rubygems.rb:204:in `try_activate'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:153:in `rescue in require'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:149:in `require'
	from -e:1:in `<main>'
/usr/share/rubygems/rubygems/dependency.rb:311:in `to_specs': Could not find 'irb' (>= 1.3.6) among 125 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/builddir/.local/share/gem/ruby:/usr/share/gems:/usr/local/share/gems' , execute `gem env` for more information
	from /usr/share/rubygems/rubygems/specification.rb:1399:in `block in activate_dependencies'
	from /usr/share/rubygems/rubygems/specification.rb:1387:in `each'
	from /usr/share/rubygems/rubygems/specification.rb:1387:in `activate_dependencies'
	from /usr/share/rubygems/rubygems/specification.rb:1369:in `activate'
	from /usr/share/rubygems/rubygems.rb:211:in `rescue in try_activate'
	from /usr/share/rubygems/rubygems.rb:204:in `try_activate'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:153:in `rescue in require'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:149:in `require'
	from -e:1:in `<main>'
/usr/share/rubygems/rubygems/specification.rb:1401:in `rescue in block in activate_dependencies': Could not find 'irb' (>= 1.3.6) among 125 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/builddir/.local/share/gem/ruby:/usr/share/gems:/usr/local/share/gems' at: /usr/share/gems/specifications/debug-1.4.0.gemspec, execute `gem env` for more information
	from /usr/share/rubygems/rubygems/specification.rb:1398:in `block in activate_dependencies'
	from /usr/share/rubygems/rubygems/specification.rb:1387:in `each'
	from /usr/share/rubygems/rubygems/specification.rb:1387:in `activate_dependencies'
	from /usr/share/rubygems/rubygems/specification.rb:1369:in `activate'
	from /usr/share/rubygems/rubygems.rb:205:in `try_activate'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:153:in `rescue in require'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:149:in `require'
	from -e:1:in `<main>'
/usr/share/rubygems/rubygems/dependency.rb:311:in `to_specs': Could not find 'irb' (>= 1.3.6) among 125 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/builddir/.local/share/gem/ruby:/usr/share/gems:/usr/local/share/gems' , execute `gem env` for more information
	from /usr/share/rubygems/rubygems/specification.rb:1399:in `block in activate_dependencies'
	from /usr/share/rubygems/rubygems/specification.rb:1387:in `each'
	from /usr/share/rubygems/rubygems/specification.rb:1387:in `activate_dependencies'
	from /usr/share/rubygems/rubygems/specification.rb:1369:in `activate'
	from /usr/share/rubygems/rubygems.rb:205:in `try_activate'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:153:in `rescue in require'
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:149:in `require'
	from -e:1:in `<main>'
<internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- debug (LoadError)
	from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from -e:1:in `<main>'
~~~

2.
3.

Actual results:
The bundled gems does not specify any dependency [1].


Expected results:
There should be at minimum `Recommends: rubygem(irb)`


Additional info:



[1] https://src.fedoraproject.org/rpms/ruby/blob/f93afdebdd045891fa0b723ea2330f5fcfd027b0/f/ruby.spec#_490-499

Comment 1 Jun Aruga 2022-08-24 15:50:05 UTC
> There should be at minimum `Recommends: rubygem(irb)`

I am working on it.

Comment 2 Jun Aruga 2022-08-26 13:54:21 UTC
The debug gem has the irb gem as a runtime dependency in `debug.gemspec`.
https://github.com/ruby/debug/blob/2cb44483c681f6806bf6843a8f996d3a10d0e42c/debug.gemspec#L30
https://rubygems.org/gems/debug/versions/1.6.2

The situation means `Recommends: rubygem(irb)` for ruby-bundled-gems RPM? Not `Requires: rubygem(irb)`?

Comment 3 Vít Ondruch 2022-08-26 14:18:41 UTC
(In reply to Jun Aruga from comment #2)
> The debug gem has the irb gem as a runtime dependency in `debug.gemspec`.
> https://github.com/ruby/debug/blob/2cb44483c681f6806bf6843a8f996d3a10d0e42c/
> debug.gemspec#L30
> https://rubygems.org/gems/debug/versions/1.6.2
> 
> The situation means `Recommends: rubygem(irb)` for ruby-bundled-gems RPM?
> Not `Requires: rubygem(irb)`?

If the `debug` gem was independent package, it would be `Requires` without discussion. But it is in ruby-bundled-gems package with other libraries. Therefore this is trade-off between having the dependency always satisfied vs being able to trim the dependencies. I think that `Recommends: rubygem(irb)` should do the job in most cases, because weak dependencies are respected for regular user. It won't help if `debug` gem is required during build time, but then we can add `BuildRequires: rubygem(irb)` to fix this and there won't be probably too many places where this is problem. At the end, it won't be too different from e.g. rubygems package recommending bundler, rodc and io-console.

Comment 4 Jun Aruga 2022-08-26 16:26:48 UTC
OK. Thanks for the explanation. That makes sense.

I sent the PR.
https://src.fedoraproject.org/rpms/ruby/pull-request/130

Comment 5 Fedora Update System 2022-09-01 20:23:24 UTC
FEDORA-2022-7b269a84e6 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-7b269a84e6

Comment 6 Fedora Update System 2022-09-01 20:27:37 UTC
FEDORA-2022-7b269a84e6 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2022-09-06 14:55:34 UTC
FEDORA-2022-53358fd5c8 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-53358fd5c8

Comment 8 Fedora Update System 2022-09-06 20:30:36 UTC
FEDORA-2022-53358fd5c8 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-53358fd5c8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-53358fd5c8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2022-09-14 00:20:07 UTC
FEDORA-2022-53358fd5c8 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2022-09-15 22:07:28 UTC
FEDORA-2022-9f08ba013b has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-9f08ba013b

Comment 11 Fedora Update System 2022-09-16 02:41:36 UTC
FEDORA-2022-9f08ba013b has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-9f08ba013b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-9f08ba013b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2022-09-24 01:32:00 UTC
FEDORA-2022-9f08ba013b has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.