[#99856] [Ruby master Feature#17143] Improve support for warning categories — merch-redmine@...

Issue #17143 has been reported by jeremyevans0 (Jeremy Evans).

16 messages 2020/09/03

[#99868] [Ruby master Bug#17144] Tempfile.open { ... } does not unlink the file — eregontp@...

Issue #17144 has been reported by Eregon (Benoit Daloze).

15 messages 2020/09/03

[#99885] [Ruby master Feature#17145] Ractor-aware `Object#deep_freeze` — marcandre-ruby-core@...

Issue #17145 has been reported by marcandre (Marc-Andre Lafortune).

32 messages 2020/09/03

[#99903] [Ruby master Bug#17146] Queue operations are allowed after it is frozen — eregontp@...

Issue #17146 has been reported by Eregon (Benoit Daloze).

16 messages 2020/09/03

[#100016] [Ruby master Feature#17171] Why is the visibility of constants not affected by `private`? — marcandre-ruby-core@...

Issue #17171 has been reported by marcandre (Marc-Andre Lafortune).

10 messages 2020/09/15

[#100024] [Ruby master Bug#17175] Ruby 2.5: OpenSSL related test failures — jaruga@...

Issue #17175 has been reported by jaruga (Jun Aruga).

10 messages 2020/09/16

[#100025] [Ruby master Feature#17176] GC.enable_autocompact / GC.disable_autocompact — tenderlove@...

Issue #17176 has been reported by tenderlovemaking (Aaron Patterson).

11 messages 2020/09/16

[#100099] [Ruby master Bug#17184] No stdlib function to perform simple string replacement — sheerun@...

Issue #17184 has been reported by sheerun (Adam Stankiewicz).

18 messages 2020/09/24

[#100192] [Ruby master Bug#17197] Some Hash methods still have arity 2 instead of 1 — marcandre-ruby-core@...

Issue #17197 has been reported by marcandre (Marc-Andre Lafortune).

14 messages 2020/09/28

[#100200] [Ruby master Misc#17199] id outputed by inspect and to_s output does not allow to find actual object_id and vice-versa — baptiste.courtois@...

Issue #17199 has been reported by Annih (Baptiste Courtois).

7 messages 2020/09/28

[#100206] [Ruby master Misc#17200] DevelopersMeeting20201026Japan — mame@...

Issue #17200 has been reported by mame (Yusuke Endoh).

18 messages 2020/09/28

[#100239] [Ruby master Feature#17206] Introduce new Regexp option to avoid MatchData allocation — fatkodima123@...

Issue #17206 has been reported by fatkodima (Dima Fatko).

8 messages 2020/09/30

[ruby-core:99964] [Ruby master Bug#17160] Wrong exception backtrace

From: mame@...
Date: 2020-09-07 15:08:34 UTC
List: ruby-core #99964
Issue #17160 has been updated by mame (Yusuke Endoh).

Status changed from Open to Rejected

It is confusing, but I think there is nothing wrong.  There are two points.

The first point is that the location for a method written in C is represented by its caller's location.
This is an example: `Integer#times` is implemented in C, so its location is represented as `t.rb:2`.

```
1: def foo
2:   1.times do
3:     raise
4:   end
5: end
6: 
7: foo
```

```
$ ./miniruby t.rb
t.rb:3:in `block in foo': unhandled exception
        from t.rb:2:in `times'                   # <== See this line
        from t.rb:2:in `foo'
        from t.rb:7:in `<main>'
```

Note that there is no `t.rb:1` location in the backtrace.  A backtrace location represents where the interpreter is executing, so usually, the first line of a method body tend not to be included in a backtrace (unless an exception occurs during evaluation of optional arguments, for example).

The second point is that a rescue clause for a method body is considered as if the clause is called from the first line of the method body. This is exceptional, and may be confusing; it reflects the implementation detail.  But currently it is at least intentional, I think.
This is an example: `t.rb:4` is virtually called from `t.rb:1` which is the first line of the method body.

```
def foo
  raise
rescue
  raise "foo", cause: nil
end

foo
```

```
$ ./miniruby t.rb
t.rb:4:in `rescue in foo': foo (RuntimeError)
        from t.rb:1:in `foo'                   # <== See this line
        from t.rb:7:in `<main>'
```

So, now your example can be understood as:

```
# exc.backtrace
-e:1:in `<main>'
/builddir/t/evaluator.rb:22:in `eval' # This line is for `Binding#eval`; the method is written in C, so it shows its caller's location
/builddir/t/evaluator.rb:22:in `eval' # This line is for `WebConsole::Evaluator#eval`; the interpreter now executes Line 22, so it is correct
-e:1:in `<main>'

# caller
/builddir/t/evaluator.rb:24:in `rescue in eval'
/builddir/t/evaluator.rb:21:in `eval' # This is included for the exception of a method rescue clause
-e:1:in `<main>'
```

----------------------------------------
Bug #17160: Wrong exception backtrace
https://bugs.ruby-lang.org/issues/17160#change-87503

* Author: vo.x (Vit Ondruch)
* Status: Rejected
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Looking at web-console test results [1], there is following error reported:

~~~
WebConsole::EvaluatorTest#test_Evaluator_callers_are_cleaned_up_of_unneeded_backtraces [/home/travis/build/rails/web-console/test/web_console/evaluator_test.rb:63]:
--- expected
+++ actual
@@ -1,3 +1,3 @@
 "RuntimeError: oops
-\tfrom /home/travis/build/rails/web-console/test/web_console/evaluator_test.rb:61:in `block in <class:EvaluatorTest>'
+\tfrom (eval):1:in `block in <class:EvaluatorTest>'
 "
~~~

Trying to reproduce the issue, it seems that the exception backtrace is not correct. I have used slightly modified version of [2] included in attachment and the output is:

~~~
$ ruby -ractive_support -r./evaluator -e 'e = WebConsole::Evaluator.new(binding); puts e.eval("raise %{oops}")'
# exc.backtrace #
-e:1:in `<main>'
/builddir/t/evaluator.rb:22:in `eval'
/builddir/t/evaluator.rb:22:in `eval'
-e:1:in `<main>'
# caller #
/builddir/t/evaluator.rb:24:in `rescue in eval'
/builddir/t/evaluator.rb:21:in `eval'
-e:1:in `<main>'
RuntimeError: oops
~~~

I believe, that the `exc.backtrace` is wrong and the second line should actually be ```/builddir/t/evaluator.rb:21:in `eval'``` similarly to the output of the `caller`.


[1]: https://travis-ci.org/github/rails/web-console/jobs/719200769
[2]: https://raw.githubusercontent.com/rails/web-console/master/lib/web_console/evaluator.rb

---Files--------------------------------
evaluator.rb (1.12 KB)


-- 
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