Project

General

Profile

Bug #13505

circular require prints the backtrace directly to stderr

Added by Eregon (Benoit Daloze) over 3 years ago. Updated over 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.

#1

Updated by Eregon (Benoit Daloze) over 3 years ago

  • Tracker changed from Bug to Feature
#2

Updated by Eregon (Benoit Daloze) over 3 years ago

  • Target version set to 2.5
#3

Updated by nobu (Nobuyoshi Nakada) over 3 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 3 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) over 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) over 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