Bug #13505
closedcircular require prints the backtrace directly to stderr
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.
Updated by Eregon (Benoit Daloze) over 7 years ago
- Tracker changed from Bug to Feature
Updated by nobu (Nobuyoshi Nakada) over 7 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 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) almost 7 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) almost 7 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.