[ruby-core:85603] [Ruby trunk Bug#13505] circular require prints the backtrace directly to stderr

From: nagachika00@...
Date: 2018-02-16 15:26:29 UTC
List: ruby-core #85603
Issue #13505 has been updated by nagachika (Tomoyuki Chikanaga).

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.

----------------------------------------
Bug #13505: circular require prints the backtrace directly to stderr
https://bugs.ruby-lang.org/issues/13505#change-70399

* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 2.5
* ruby -v: 
* Backport: 2.3: DONTNEED, 2.4: REQUIRED, 2.5: DONTNEED
----------------------------------------
The "loading in progress, circular require considered harmful" warning prints the caller backtrace directly to stderr:

~~~ c
    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.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next