Hello,

> cat eval_me1.rb
>  ¨Βφαμ¨Ζιμε®ςεα䨧εφαμίνε²®ςβ§©βιξδιξη¬ Ζιμε®εψπαξδίπατ訧®―εφαμίνε²®ςβ§©©
> cat eval_me2.rb
>  ¨Βερυιςείςεματιφ§εφαμίνε±®ςβ>  ruby eval_me1.rb
>  ¨ΒΊ―δεφ―ςυβω―ζαστεςίςερυιςε―σπεγ―εφαμίνε²®ςβΊ±Ίιΰςερυιςείςεματιφε§γαξξοτ ιξζεβασεπατθ ¨ΜοαδΕςςος>  ¨ΒςοΓΊ―δεφ―ςυβω―ζαστεςίςερυιςε―σπεγ―εφαμίνε²®ςβΊ±Ίιξ ΰΌναιξΎ§
>  ¨Βςοεφαμίνε±®ςβΊ±Ίιξ ΰεφαμ§
>  ¨Βςοεφαμίνε±®ςβΊ±Ίιξ ΰΌναιξΎ§
>
> I suppose was assuming that if eval included a filename, then require_relative would work from within it. Perhaps I am mistaken?


I think your expectation is reasonable, though I personally dislike
the eval's feature to fake filepath.


The following patch makes require_relative use the given file path.
I'm afraid if I should include this patch in 1.9.3 because I can't
estimate the impact of this patch.  What do you think?


diff --git a/vm_eval.c b/vm_eval.c
index 7df7f5f..3710401 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1007,7 +1007,7 @@ eval_string_with_cref(VALUE self, VALUE src,
VALUE scope, NODE *cref, const char
 	/* make eval iseq */
 	th->parse_in_eval++;
 	th->mild_compile_error++;
-	iseqval = rb_iseq_compile(src, rb_str_new2(file), INT2FIX(line));
+	iseqval = rb_iseq_compile_with_option(src, rb_str_new2(file),
rb_str_new2(file), INT2FIX(line), Qnil);
 	th->mild_compile_error--;
 	th->parse_in_eval--;

-- 
Yusuke Endoh <mame / tsg.ne.jp>