rdebug: 43dd0995 breaks catching exception message and raises exception in debug mode
ashumkin opened this issue · 3 comments
43dd099 leads to errors
Steps to reproduce:
- Make test script to simplify error reproduction:
$ cat > test.rb <<TEXT
require 'pp'
puts 1 / 0
TEXT
$ rdebug test.rb
=> 1 require 'pp'
2 puts 1 / 0
(rdb:1) catch ZeroDivisionError
gives output
Catch exception %s
this is the error, %s must be replaced with an exception name
ALSO,
the same steps but
$ rdebug --debug test.rb
give
Exception `ArgumentError' at /usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/interface.rb:82 - too many arguments for format string
INTERNAL ERROR!!! too many arguments for format string
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/interface.rb:82:in `printf'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/interface.rb:82:in `print'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:379:in `print'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/command.rb:170:in `print'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/commands/catchpoint.rb:27:in `execute'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:279:in `one_cmd'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:265:in `block (2 levels) in process_commands'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:264:in `each'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:264:in `block in process_commands'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:257:in `catch'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:257:in `process_commands'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:190:in `at_line'
(eval):5:in `block in at_line'
<internal:prelude>:10:in `synchronize'
(eval):3:in `at_line'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug-base.rb:54:in `at_line'
/home/ashu/test.rb:1:in `<top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/bin/rdebug:124:in `debug_load'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/bin/rdebug:124:in `debug_program'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/bin/rdebug:394:in `<top (required)>'
/usr/bin/rdebug:23:in `load'
/usr/bin/rdebug:23:in `<main>'Exception `ZeroDivisionError' at /home/ashu/test.rb:2 - divided by 0
Exception `ArgumentError' at /usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/interface.rb:82 - too many arguments for format string
INTERNAL ERROR!!! too many arguments for format string
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/interface.rb:82:in `printf'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/interface.rb:82:in `print'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:52:in `print'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug/processor.rb:162:in `at_catchpoint'
(eval):5:in `block in at_catchpoint'
<internal:prelude>:10:in `synchronize'
(eval):3:in `at_catchpoint'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/lib/ruby-debug-base.rb:45:in `at_catchpoint'
/home/ashu/test.rb:2:in `<top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/bin/rdebug:124:in `debug_load'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/bin/rdebug:124:in `debug_program'
/usr/lib/ruby/gems/1.9.1/gems/debugger-1.6.5/bin/rdebug:394:in `<top (required)>'
/usr/bin/rdebug:23:in `load'
/usr/bin/rdebug:23:in `<main>'/..../test.rb:2
"Reverting back" 43dd099
diff --git a/lib/ruby-debug/interface.rb b/lib/ruby-debug/interface.rb
index ba3f8a2..71bf562 100644
--- a/lib/ruby-debug/interface.rb
+++ b/lib/ruby-debug/interface.rb
@@ -36,7 +36,7 @@ module Debugger
def escape_input(args)
new_args = args.dup
- new_args.first.gsub!("%", "%%") if args.first.is_a?(String)
+ # new_args.first.gsub!("%", "%%") if args.first.is_a?(String)
new_args
end
fixes errors above BUT!
if we replace second line of test script test.rb with
puts 1 % 0
rdebug test.rb
fails with
INTERNAL ERROR!!! invalid format character - %
(that is, actually, expected)
P.S.
$ rdebug -v; ruby -v
debugger 1.6.5
ruby 1.9.3p484 (2013-11-22) [i386-cygwin]
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [i386-cygwin]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby.exe
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-cygwin
- GEM PATHS:
- /usr/lib/ruby/gems/1.9.1
- /home/ashu/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Same errors are observed on Linux Fedora 19, Ruby v1.9.3p484
Thanks for reporting your issue! This is one of my 8 active issues. Use that link to check how soon your issue will be answered. Don't forget to check your issue against this project's CONTRIBUTING.md. Cheers.
@astashov This is related to a commit you made. If you have any insight that would be great.
Seems to be straightforward fix, hopefully, let me have a look into it this weekend.