Project

General

Profile

Actions

Bug #13505

closed

circular require prints the backtrace directly to stderr

Added by Eregon (Benoit Daloze) almost 7 years ago. Updated about 6 years ago.

Status:
Closed
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.

Actions #1

Updated by Eregon (Benoit Daloze) almost 7 years ago

  • Tracker changed from Bug to Feature
Actions #2

Updated by Eregon (Benoit Daloze) almost 7 years ago

  • Target version set to 2.5
Actions #3

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r58471.


load.c: backtrace of circular require

Updated by Eregon (Benoit Daloze) almost 7 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) about 6 years ago

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

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) about 6 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0