Bug #4379

[patch] eval(s, b, "(eval)", n) discards location

Added by James M. Lawrence about 3 years ago. Updated over 1 year ago.

[ruby-core:35139]
Status:Assigned
Priority:Normal
Assignee:Koichi Sasada
Category:core
Target version:next minor
ruby -v:ruby 1.9.3dev (2011-02-08 trunk 30820) [i386-darwin9.8.0] Backport:

Description

=begin
% ruby -e 'p eval("raise", nil, "(eval)", 999)'
-e:1:in eval': (eval):999:in': (RuntimeError)
from -e:1:in eval'
from -e:1:in
'

With binding, location is ignored.

% ruby -e 'p eval("raise", binding, "(eval)", 999)'
-e:1:in <main>': unhandled exception
from -e:1:in
eval'
from -e:1:in `'

source_location has a similar problem.

The patch also applies cleanly to 1.9.2.
=end

test_eval_location.patch Magnifier (762 Bytes) James M. Lawrence, 02/08/2011 03:19 AM

eval_location.patch Magnifier (1.26 KB) James M. Lawrence, 02/08/2011 03:19 AM

better_eval_location.patch Magnifier - Slightly nicer version of eval_location.patch (1.27 KB) James M. Lawrence, 02/08/2011 05:23 AM

final_eval_location.patch Magnifier - This passes rubyspec while the above does not. Ensures __FILE__ == eval("__FILE__", binding) (4.11 KB) James M. Lawrence, 02/09/2011 06:57 AM


Related issues

Related to ruby-trunk - Bug #4352: [patch] Fix eval(s, b) backtrace; make eval(s, b) consist... Assigned 02/01/2011

History

#1 Updated by James M. Lawrence about 3 years ago

=begin

=end

#2 Updated by James M. Lawrence about 3 years ago

=begin

=end

#3 Updated by Yui NARUSE almost 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to Yukihiro Matsumoto

Matz, how do you think, 1.8's result is:

% ruby -ve 'p eval("raise", binding, "(eval)", 999)'
ruby 1.8.7 (2010-08-16 patchlevel 302) [amd64-freebsd8]
-e:1:in `eval': (eval):999: (RuntimeError)
from -e:1

#4 Updated by Koichi Sasada almost 2 years ago

  • Assignee changed from Yukihiro Matsumoto to Koichi Sasada

#5 Updated by Koichi Sasada over 1 year ago

  • Target version changed from 2.0.0 to next minor

Are there any applications that this problem is critical for?

Also available in: Atom PDF