Project

General

Profile

Bug #13505

circular require prints the backtrace directly to stderr

Added by Eregon (Benoit Daloze) over 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
[ruby-core:80850]

Description

The "loading in progress, circular require considered harmful" warning prints the caller backtrace directly to stderr:

    if (RTEST(ruby_verbose)) {
    rb_warning("loading in progress, circular require considered harmful - %s", ftptr);
    rb_backtrace_print_to(rb_stderr);
    }

This is suboptimal as rb_warning now eventually delegates to Warning.warn, which can handle the warning, but not the backtrace printed separetely to $stderr.
I think the backtrace should be sent together to Warning.warn so the entire warning can be treated/filtered/etc correctly in Warning.warn.

Associated revisions

Revision 5ad56e7c
Added by nobu (Nobuyoshi Nakada) over 2 years ago

load.c: backtrace of circular require

  • load.c (load_lock): print backtrace of circular require via Warning.warn [ruby-core:80850] [Bug #13505]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 58471
Added by nobu (Nobuyoshi Nakada) over 2 years ago

load.c: backtrace of circular require

  • load.c (load_lock): print backtrace of circular require via Warning.warn [ruby-core:80850] [Bug #13505]

Revision 58471
Added by nobu (Nobuyoshi Nakada) over 2 years ago

load.c: backtrace of circular require

  • load.c (load_lock): print backtrace of circular require via Warning.warn [ruby-core:80850] [Bug #13505]

Revision 58471
Added by nobu (Nobuyoshi Nakada) over 2 years ago

load.c: backtrace of circular require

  • load.c (load_lock): print backtrace of circular require via Warning.warn [ruby-core:80850] [Bug #13505]

Revision acde5520
Added by Eregon (Benoit Daloze) over 2 years ago

Send the backtrace of the circular require warning as a single String to Warning.warn

  • load.c: send as a single string.
  • error.c: expose the string formatted by rb_warning as rb_warning_string().
  • test/ruby/test_exception.rb: update tests. [ruby-core:80850] [Bug #13505]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 58493
Added by Eregon (Benoit Daloze) over 2 years ago

Send the backtrace of the circular require warning as a single String to Warning.warn

  • load.c: send as a single string.
  • error.c: expose the string formatted by rb_warning as rb_warning_string().
  • test/ruby/test_exception.rb: update tests. [ruby-core:80850] [Bug #13505]

Revision 58493
Added by Eregon (Benoit Daloze) over 2 years ago

Send the backtrace of the circular require warning as a single String to Warning.warn

  • load.c: send as a single string.
  • error.c: expose the string formatted by rb_warning as rb_warning_string().
  • test/ruby/test_exception.rb: update tests. [ruby-core:80850] [Bug #13505]

Revision 58493
Added by Eregon (Benoit Daloze) over 2 years ago

Send the backtrace of the circular require warning as a single String to Warning.warn

  • load.c: send as a single string.
  • error.c: expose the string formatted by rb_warning as rb_warning_string().
  • test/ruby/test_exception.rb: update tests. [ruby-core:80850] [Bug #13505]

Revision ac84c2ae
Added by nagachika (Tomoyuki Chikanaga) almost 2 years ago

merge revision(s) 58471,58493: [Backport #13505]

    load.c: backtrace of circular require

    * load.c (load_lock): print backtrace of circular require via
      `Warning.warn` [ruby-core:80850] [Bug #13505]

    Send the backtrace of the circular require warning as a single String to Warning.warn

    * load.c: send as a single string.
    * error.c: expose the string formatted by rb_warning as rb_warning_string().
    * test/ruby/test_exception.rb: update tests.
      [ruby-core:80850] [Bug #13505]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 62435
Added by nagachika (Tomoyuki Chikanaga) almost 2 years ago

merge revision(s) 58471,58493: [Backport #13505]

load.c: backtrace of circular require

* load.c (load_lock): print backtrace of circular require via
  `Warning.warn` [ruby-core:80850] [Bug #13505]

Send the backtrace of the circular require warning as a single String to Warning.warn

* load.c: send as a single string.
* error.c: expose the string formatted by rb_warning as rb_warning_string().
* test/ruby/test_exception.rb: update tests.
  [ruby-core:80850] [Bug #13505]

Revision 08fb5c21
Added by usa (Usaku NAKAMURA) almost 2 years ago

merge revision(s) 58471,58493,62436: [Backport #13505]

    load.c: backtrace of circular require

    * load.c (load_lock): print backtrace of circular require via
      `Warning.warn` [ruby-core:80850] [Bug #13505]

      Send the backtrace of the circular require warning as a single String to Warning.warn

    * load.c: send as a single string.
    * error.c: expose the string formatted by rb_warning as rb_warning_string().
    * test/ruby/test_exception.rb: update tests.
      [ruby-core:80850] [Bug #13505]

    fix regexp literal warning.

    * test/rubygems/test_gem_server.rb: eliminate duplicated character class warning.
      [Bug #14481]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 664b94fd
Added by usa (Usaku NAKAMURA) almost 2 years ago

merge revision(s) 58471,58493,62436: [Backport #13505]

    load.c: backtrace of circular require

    * load.c (load_lock): print backtrace of circular require via
      `Warning.warn` [ruby-core:80850] [Bug #13505]

      Send the backtrace of the circular require warning as a single String to Warning.warn

    * load.c: send as a single string.
    * error.c: expose the string formatted by rb_warning as rb_warning_string().
    * test/ruby/test_exception.rb: update tests.
      [ruby-core:80850] [Bug #13505]

    fix regexp literal warning.

    * test/rubygems/test_gem_server.rb: eliminate duplicated character class warning.
      [Bug #14481]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@62441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 62441
Added by usa (Usaku NAKAMURA) almost 2 years ago

merge revision(s) 58471,58493,62436: [Backport #13505]

load.c: backtrace of circular require

* load.c (load_lock): print backtrace of circular require via
  `Warning.warn` [ruby-core:80850] [Bug #13505]

  Send the backtrace of the circular require warning as a single String to Warning.warn

* load.c: send as a single string.
* error.c: expose the string formatted by rb_warning as rb_warning_string().
* test/ruby/test_exception.rb: update tests.
  [ruby-core:80850] [Bug #13505]

fix regexp literal warning.

* test/rubygems/test_gem_server.rb: eliminate duplicated character class warning.
  [Bug #14481]

History

#1

Updated by Eregon (Benoit Daloze) over 2 years ago

  • Tracker changed from Bug to Feature
#2

Updated by Eregon (Benoit Daloze) over 2 years ago

  • Target version set to 2.5
#3

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r58471.


load.c: backtrace of circular require

  • load.c (load_lock): print backtrace of circular require via Warning.warn [ruby-core:80850] [Bug #13505]

Updated by Eregon (Benoit Daloze) over 2 years ago

Thank you for the fix nobu.
I believe it should also send everything (message + backtrace) as a single String to Warning.warn.
I did that in r58493.

It would be nice to backport this to 2.4 for easier exception filtering,
but I guess it's not so common to backport features like this?

Updated by nagachika (Tomoyuki Chikanaga) almost 2 years ago

  • Backport set to 2.3: DONTNEED, 2.4: REQUIRED, 2.5: DONTNEED
  • Tracker changed from Feature to Bug

I believe this is a bug of Warning.warn feature in 2.4.
I will move this ticket to Bug to backport the changesets.

Updated by nagachika (Tomoyuki Chikanaga) almost 2 years ago

  • Backport changed from 2.3: DONTNEED, 2.4: REQUIRED, 2.5: DONTNEED to 2.3: DONTNEED, 2.4: DONE, 2.5: DONTNEED

ruby_2_4 r62435 merged revision(s) 58471,58493.

Also available in: Atom PDF