Ruby 4.0でrdocを追加インストールするとwarningが出るようになる

19 views Post
wakairo @wakairo

Ruby 4.0では、rdoc gemについて最新バージョンなどを追加インストールすると、gemコマンドの実行で大量のwarningが表示される状態に陥いります。

なお、開発サイドもこの状態を把握しているようですので、個人的には解決されるまで様子を見ようと思っています。

0
Raw
https://www.techtips.page/ja/comments/1172
wakairo @wakairo

Ruby 4.0の場合

Rubyの4.0系列では、bundled gemの1つとして、rdocが標準添付されています。 ここにrdocの最新バージョンをインストールするようなシチュエーションで、rdocを追加インストールするとwarningが出るようになります。

この現象は、dockerを使うと、以下のように簡単に再現できます。 ruby:4.0.3において、始めはgem -vコマンドの実行でwarningは出ませんが、 rdocをインストールすると、同じgem -vコマンドでwarningが出ていることが確認できます。

$ docker run --rm -it ruby:4.0.3 bash
root@601c809deee7:/# gem -v
4.0.6
root@601c809deee7:/# gem install rdoc -v 7.2.0
Fetching rdoc-7.2.0.gem
Successfully installed rdoc-7.2.0
1 gem installed

A new release of RubyGems is available: 4.0.6 → 4.0.11!
Run `gem update --system 4.0.11` to update your installation.

root@601c809deee7:/# gem -v
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/version.rb:8: warning: already initialized constant RDoc::VERSION
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/version.rb:8: warning: previous definition of VERSION was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc.rb:68: warning: already initialized constant RDoc::VISIBILITIES
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:68: warning: previous definition of VISIBILITIES was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc.rb:74: warning: already initialized constant RDoc::DOT_DOC_FILENAME
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:74: warning: previous definition of DOT_DOC_FILENAME was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc.rb:79: warning: already initialized constant RDoc::GENERAL_MODIFIERS
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:79: warning: previous definition of GENERAL_MODIFIERS was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc.rb:84: warning: already initialized constant RDoc::CLASS_MODIFIERS
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:84: warning: previous definition of CLASS_MODIFIERS was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc.rb:89: warning: already initialized constant RDoc::ATTR_MODIFIERS
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:89: warning: previous definition of ATTR_MODIFIERS was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc.rb:94: warning: already initialized constant RDoc::CONSTANT_MODIFIERS
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:94: warning: previous definition of CONSTANT_MODIFIERS was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc.rb:99: warning: already initialized constant RDoc::METHOD_MODIFIERS
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:99: warning: previous definition of METHOD_MODIFIERS was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown.rb:257: warning: already initialized constant RDoc::Markdown::KpegPosInfo
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/markdown.rb:257: warning: previous definition of KpegPosInfo was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown/entities.rb:5: warning: already initialized constant RDoc::Markdown::HTML_ENTITIES
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/markdown/entities.rb:5: warning: previous definition of HTML_ENTITIES was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown/literals.rb:86: warning: already initialized constant RDoc::Markdown::Literals::KpegPosInfo
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/markdown/literals.rb:86: warning: previous definition of KpegPosInfo was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown/literals.rb:446: warning: already initialized constant RDoc::Markdown::Literals::Rules
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/markdown/literals.rb:446: warning: previous definition of Rules was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown.rb:584: warning: already initialized constant RDoc::Markdown::EXTENSIONS
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/markdown.rb:584: warning: previous definition of EXTENSIONS was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown.rb:589: warning: already initialized constant RDoc::Markdown::DEFAULT_EXTENSIONS
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/markdown.rb:589: warning: previous definition of DEFAULT_EXTENSIONS was here
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown.rb:16430: warning: already initialized constant RDoc::Markdown::Rules
/usr/local/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/markdown.rb:16420: warning: previous definition of Rules was here
4.0.6
root@601c809deee7:/# gem list --exact rdoc
(同様のwarningなので省略)
*** LOCAL GEMS ***

rdoc (7.2.0, 7.0.3)
root@601c809deee7:/#
0
Raw
https://www.techtips.page/ja/comments/1173
wakairo @wakairo

Ruby 3.4の場合

Rubyの3.4系列では、default gemの1つとして、rdocが標準添付されています。 ここにrdocを追加インストールしてもwarningが出るようにはなりません。

以下はdockerを使ってこのことを確認した様子です。

$ docker run --rm -it ruby:3.4.9 bash
root@90a5523af58f:/# gem -v
3.6.9
root@90a5523af58f:/# gem install rdoc -v 7.2.0
Fetching rdoc-7.2.0.gem
Successfully installed rdoc-7.2.0
1 gem installed

A new release of RubyGems is available: 3.6.9 → 4.0.11!
Run `gem update --system 4.0.11` to update your installation.

root@90a5523af58f:/# gem -v
3.6.9
root@90a5523af58f:/# gem list --exact rdoc

*** LOCAL GEMS ***

rdoc (7.2.0, default: 6.14.0)
root@90a5523af58f:/#
0
Raw
https://www.techtips.page/ja/comments/1174