Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Loading `debug` gem breaks `blankslate` gem

オープン
#757 コメント 5 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
ruby
領域
devtools

調査の方向性

Reproduce the interaction using the Ruby 2.7.2 and debug 1.6.2 environment described, then inspect lib/debug/session.rb around lines 1686-1689. Compare behavior with and without requiring debug, and verify the BlankSlate example remains compatible while determining the purpose of the redefinition.

索引モデルが issue の本文から書いたものです。

説明

bug

Your environment

  • ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
  • rdbg -v: rdbg 1.6.2

Describe the bug

The debug gem undefines and redefines singleton_method_added.

The blankslate gem provides a "abstract base class with no predefined methods" except for some core Ruby builtins. "BlankSlate is useful as a base class when writing classes that depend upon method_missing (e.g. dynamic proxies)", so it only works if singleton_method_added is available. However, it hides singleton_method_added because it's redefined by the debug gem.

This problem does not occur when the debug gem is not required.

To Reproduce

require 'debug'
require 'blankslate'

BlankSlate.new.singleton_method_added

Buggy output -- the method isn't defined:

Traceback (most recent call last):
repro.rb:4:in `<main>': undefined method `singleton_method_added' for #<BlankSlate:0x000055a654b12fb0> (NoMethodError)

Expected behavior

The method is defined, but private:

Traceback (most recent call last):
repro.rb:3:in `<main>': private method `singleton_method_added' called for #<BlankSlate:0x000055d758dcd540> (NoMethodError)

Workaround

We can work around the bug by explicilty unhiding this method, or by requiring blankslate before debug:

BlankSlate.reveal(:singleton_method_added)

Additional context

The problem is caused by this code in the debug gem:

https://github.com/ruby/debug/blob/19b4dde3308f532943e4234d1588d4fa26c52345/lib/debug/session.rb#L1686-L1689

Why does the debug gem redefine this method?

主要言語
Ruby
スター
1.3k
フォーク
146
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ruby/debug のほかの issue

ruby/debug の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。