Description of problem: I saw the following error by `gem install` on my mock enviornment. ``` $ gem install gem2rpm Successfully installed gem2rpm-1.0.1 /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/generator/darkfish.rb:64: warning: already initialized constant RDoc::Generator::Darkfish::BUILTIN_STYLE_ITEMS ... /opt/rh/rh-ruby30/root/usr/share/ruby/rdoc/rdoc.rb:36: warning: previous definition of GENERATORS was here ERROR: While executing gem ... (OptionParser::InvalidArgument) invalid argument: Invalid output formatter darkfish $ echo $? 1 ``` This error comes from rdoc in ruby. When running `gem install` with the option `--no-document` not to generate the documentation, it works. ``` $ gem install gem2rpm --no-document gem2rpm Fetching gem2rpm-1.0.1.gem Successfully installed gem2rpm-1.0.1 Successfully installed gem2rpm-1.0.1 2 gems installed ``` I avoided the error by applying the following patch, because the error prevents rubygem packages from building on the ruby package. https://src.osci.redhat.com/rpms/ruby/c/b36152ff127acfdee9b4038efc64ce737611e4af?branch=rhscl-3.7-rh-ruby30-rhel-7 However this is a temporary workaround, as it has other impacts for the rubygem packages. I would like to fix it with the proper way before shipping it. The possible solution is to drop rubygem-rdoc, only manage it as a default gem, like what we did for racc, did_you_mean and (ruby-)openssl. See the following URLs for detail. * https://src.osci.redhat.com/rpms/ruby/pull-request/67#comment-16897 * https://src.osci.redhat.com/rpms/ruby/pull-request/67#comment-16966 The following `ruby -e ...` can be the minimal reproducer for this issue. It shows warnings returning the exit status 0 when the `gem install` issue exists. ``` $ ruby -e 'require "rdoc"; p RDoc::Generator::Darkfish::BUILTIN_STYLE_ITEMS' /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/generator/ri.rb:12: warning: already initialized constant RDoc::Generator::RI::DESCRIPTION ... ["css/fonts.css", "fonts/Lato-Light.ttf", "fonts/Lato-LightItalic.ttf", "fonts/Lato-Regular.ttf", "fonts/Lato-RegularItalic.ttf", "fonts/SourceCodePro-Bold.ttf", "fonts/SourceCodePro-Regular.ttf", "css/rdoc.css"] $ echo $? 0 ``` See https://src.osci.redhat.com/rpms/ruby/pull-request/67#comment-16875 for detail. By the way, where the following lines causing the error, which exist on SCL ruby, but does not exist on Fedora ruby come from? ``` %install ... # Below rdoc symbolic links' change is only on SCL. Not on Fedora. ln -s %{gem_dir}/gems/rdoc-%{rdoc_version}/lib/rdoc.rb %{buildroot}%{ruby_libdir}/rdoc.rb ln -s %{gem_dir}/gems/rdoc-%{rdoc_version}/lib/rdoc %{buildroot}%{ruby_libdir}/rdoc ... %files ... # Add rdoc symbolic links whose change is only on SCL. Not on Fedora. %{ruby_libdir}/rdoc* ... ``` I find the lines come from an old commit 369e65c9d41c413ddf96c62dc0 on rhscl-2.4-ruby193-rhel-7 branch in 2012, https://src.osci.redhat.com/rpms/ruby/c/369e65c9d41c413ddf96c62dc080dbeebc920b8a?branch=rhscl-2.4-ruby193-rhel-7 . Version-Release number of selected component (if applicable): rh-ruby30-ruby-3.0.0-144.el7 How reproducible: Steps to Reproduce: 1. rhpkg co ruby 2. cd ruby 3. git checkout rhscl-3.7-rh-ruby30-rhel-7 4. git revert b36152ff127acfdee9b4038efc64ce737611e4af 5. rhpkg srpm 6. mock -r rhscl-rh-ruby30-rhel-7-x86-64 --no-bootstrap-chroot --shell 7. scl enable rh-ruby30 bash 8. gem install gem2rpm Actual results: ``` $ gem install gem2rpm Fetching gem2rpm-1.0.1.gem Successfully installed gem2rpm-1.0.1 /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/generator/darkfish.rb:64: warning: already initialized constant RDoc::Generator::Darkfish::BUILTIN_STYLE_ITEMS /opt/rh/rh-ruby30/root/usr/share/ruby/rdoc/generator/darkfish.rb:64: warning: previous definition of BUILTIN_STYLE_ITEMS was here /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/generator/darkfish.rb:80: warning: already initialized constant RDoc::Generator::Darkfish::GENERATOR_DIR /opt/rh/rh-ruby30/root/usr/share/ruby/rdoc/generator/darkfish.rb:80: warning: previous definition of GENERATOR_DIR was here /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/generator/darkfish.rb:85: warning: already initialized constant RDoc::Generator::Darkfish::VERSION /opt/rh/rh-ruby30/root/usr/share/ruby/rdoc/generator/darkfish.rb:85: warning: previous definition of VERSION was here /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/generator/darkfish.rb:90: warning: already initialized constant RDoc::Generator::Darkfish::DESCRIPTION /opt/rh/rh-ruby30/root/usr/share/ruby/rdoc/generator/darkfish.rb:90: warning: previous definition of DESCRIPTION was here /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/generator/darkfish.rb:637: warning: already initialized constant RDoc::Generator::Darkfish::SVNID_PATTERN /opt/rh/rh-ruby30/root/usr/share/ruby/rdoc/generator/darkfish.rb:637: warning: previous definition of SVNID_PATTERN was here /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/generator/ri.rb:12: warning: already initialized constant RDoc::Generator::RI::DESCRIPTION /opt/rh/rh-ruby30/root/usr/share/ruby/rdoc/generator/ri.rb:12: warning: previous definition of DESCRIPTION was here /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/generator/pot.rb:63: warning: already initialized constant RDoc::Generator::POT::DESCRIPTION /opt/rh/rh-ruby30/root/usr/share/ruby/rdoc/generator/pot.rb:63: warning: previous definition of DESCRIPTION was here /opt/rh/rh-ruby30/root/usr/share/gems/gems/rdoc-6.3.0/lib/rdoc/rdoc.rb:36: warning: already initialized constant RDoc::RDoc::GENERATORS /opt/rh/rh-ruby30/root/usr/share/ruby/rdoc/rdoc.rb:36: warning: previous definition of GENERATORS was here ERROR: While executing gem ... (OptionParser::InvalidArgument) invalid argument: Invalid output formatter darkfish ``` Expected results: ``` $ gem install gem2rpm Fetching gem2rpm-1.0.1.gem Successfully installed gem2rpm-1.0.1 Parsing documentation for gem2rpm-1.0.1 Installing ri documentation for gem2rpm-1.0.1 Done installing documentation for gem2rpm after 0 seconds 1 gem installed ``` Additional info:
(In reply to Jun Aruga from comment #0) > By the way, where the following lines causing the error, which exist on SCL > ruby, but does not exist on Fedora ruby come from? > > ``` > %install > ... > # Below rdoc symbolic links' change is only on SCL. Not on Fedora. > ln -s %{gem_dir}/gems/rdoc-%{rdoc_version}/lib/rdoc.rb > %{buildroot}%{ruby_libdir}/rdoc.rb > ln -s %{gem_dir}/gems/rdoc-%{rdoc_version}/lib/rdoc > %{buildroot}%{ruby_libdir}/rdoc > ... > %files > ... > # Add rdoc symbolic links whose change is only on SCL. Not on Fedora. > %{ruby_libdir}/rdoc* > > ... > ``` > > I find the lines come from an old commit 369e65c9d41c413ddf96c62dc0 on > rhscl-2.4-ruby193-rhel-7 branch in 2012, > https://src.osci.redhat.com/rpms/ruby/c/ > 369e65c9d41c413ddf96c62dc080dbeebc920b8a?branch=rhscl-2.4-ruby193-rhel-7 . Yes, this is correct. The symlinks were introduced to keep `ruby --disable-gems -e 'require "rdoc"' working. I guess that can be also issues running the `rdoc` command under certain circumstances, such as (not tested) `$ RUBYOPT=--disable-gems rdoc`.
QA team, the way to check if this issue is fixed is that `gem install <gem name>` works without error.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (new packages: rh-ruby30), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2021:2220