Backport #145
closed[Bug:1.8.7] irb fg
Description
=begin
西山和広です。
At Thu, 12 Jun 2008 17:14:00 +0900,
Kazuhiro NISHIYAMA wrote:
fgに引数を指定しなかったりjobsにない数値を指定すると
「Maybe IRB bug!!」になります。
1.8, 1.8.7, 1.8.6, 1.8.5でも同様です。
% irb18 -r irb/completion --simple-prompt
RUBY_DESCRIPTION
=> "ruby 1.8.7 (2008-06-12 patchlevel 5000) [i686-linux]"
fg
ArgumentError: wrong number of arguments (0 for 1)
from /home/kazu/opt/ruby18/lib/ruby/1.8/irb/cmd/nop.rb:20:inexecute' from /home/kazu/opt/ruby18/lib/ruby/1.8/irb/cmd/nop.rb:20:in
execute'
from (eval):3:inirb_fg' from (eval):9:in
send'
from (eval):9:infg' from (irb):2:in
irb_binding'
from /home/kazu/opt/ruby18/lib/ruby/1.8/irb/workspace.rb:52:inirb_binding' from /home/kazu/opt/ruby18/lib/ruby/1.8/irb/workspace.rb:52 Maybe IRB bug!! jobs => #0->irb on main (#<Thread:0xb7c841ac>: running) fg 1 NoMethodError: undefined method
alive?' for nil:NilClass
from /home/kazu/opt/ruby18/lib/ruby/1.8/irb/ext/multi-irb.rb:56:inswitch' from /home/kazu/opt/ruby18/lib/ruby/1.8/irb/cmd/subirb.rb:33:in
execute'
from /home/kazu/opt/ruby18/lib/ruby/1.8/irb/cmd/nop.rb:20:inexecute' from (eval):3:in
irb_fg'
from (eval):9:insend' from (eval):9:in
fg'
from (irb):4:inirb_binding' from /home/kazu/opt/ruby18/lib/ruby/1.8/irb/workspace.rb:52:in
irb_binding'
from /home/kazu/opt/ruby18/lib/ruby/1.8/irb/workspace.rb:52
Maybe IRB bug!!
--
|ZnZ(ゼット エヌ ゼット)
|西山和広(Kazuhiro NISHIYAMA)
=end
Updated by mame (Yusuke Endoh) over 16 years ago
=begin
遠藤です。
2008/06/13 12:04 石塚圭樹 keiju@ishitsuka.com:
fgに引数を指定しなかったりjobsにない数値を指定すると
「Maybe IRB bug!!」になります。1.8, 1.8.7, 1.8.6, 1.8.5でも同様です。
irb関連コマンドはエラー処理のことあまり考えてないですねぇ...
ちょっと考えてみます.
とりあえずこの問題のパッチだけ書いてみました。
どうでしょうか。
Index: lib/irb/ext/multi-irb.rb¶
--- lib/irb/ext/multi-irb.rb (revision 18754)
+++ lib/irb/ext/multi-irb.rb (working copy)
@@ -69,7 +69,7 @@
end
def search(key)
-
case key
-
@jobs[key]job = case key when Integer
when Irb
@@ -77,10 +77,10 @@
when Thread
@jobs.assoc(key)
else
- assoc = @jobs.find{|k, v| v.context.main.equal?(key)}
- IRB.fail NoSuchJob, key if assoc.nil?
- assoc
-
@jobs.find{|k, v| v.context.main.equal?(key)}
end -
IRB.fail NoSuchJob, key if job.nil?
-
job
end
def delete(key)
Index: lib/irb/extend-command.rb
===================================================================
--- lib/irb/extend-command.rb (revision 18754)
+++ lib/irb/extend-command.rb (working copy)
@@ -125,9 +125,14 @@
eval %[
def #{cmd_name}(*opts, &b)
require "#{load_file}" -
arity = ExtendCommand::#{cmd_class}.instance_method(:execute).arity
-
args = (1..arity.abs).map {|i| "arg" + i.to_s }
-
args << "*opts" if arity < 0
-
args << "&block"
-
args = args.join(", ") eval %[
-
def #{cmd_name}(*opts, &b)
-
ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b)
-
def #{cmd_name}(\#{args})
-
ExtendCommand::#{cmd_class}.execute(irb_context, \#{args}) end ] send :#{cmd_name}, *opts, &b
--
Yusuke ENDOH mame@tsg.ne.jp
=end
Updated by keiju (Keiju Ishitsuka) over 16 years ago
=begin
けいじゅ@いしつかです.
In [ruby-dev :35902 ] the message: "[ruby-dev:35902] Re:
[Bug:1.8][Bug:1.8.7] irb fg ", on Aug/21 22:06(JST) "Yusuke ENDOH"
writes:
遠藤です。
irb関連コマンドはエラー処理のことあまり考えてないですねぇ...
ちょっと考えてみます.とりあえずこの問題のパッチだけ書いてみました。
どうでしょうか。
パッチありがとうございます.
チェックインできるんでしたっけ? できるならお願いしたいのですが?
__
---------------------------------------------------->> 石塚 圭樹 <<---
---------------------------------->> e-mail: keiju@ishitsuka.com <<---
=end
Updated by shyouhei (Shyouhei Urabe) almost 16 years ago
- Assignee set to knu (Akinori MUSHA)
=begin
trunkではすでに修正済みのようです。
=end
Updated by marcandre (Marc-Andre Lafortune) over 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r24911.
=end
Updated by shyouhei (Shyouhei Urabe) about 15 years ago
- Status changed from Closed to Open
- Assignee changed from knu (Akinori MUSHA) to wyhaines (Kirk Haines)
=begin
1.8.6 also has this issue.
=end
Updated by shyouhei (Shyouhei Urabe) about 15 years ago
- Status changed from Open to Assigned
=begin
=end
Updated by wyhaines (Kirk Haines) over 14 years ago
- Status changed from Assigned to Closed
=begin
This issue was solved with changeset r27934.
, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end