From: retro Date: 2022-03-31T14:06:29+00:00 Subject: [ruby-core:108143] [Ruby master Feature#16978] Ruby should not use realpath for __FILE__ Issue #16978 has been updated by retro (Josef ��im��nek). We have hit this problem as well in rubygems and it is really unexpected and confusing. https://github.com/rubygems/rubygems/pull/5437 TL;DR; test passes calling `rake test`, but not using `ruby -I... test/file.rb` ---------------------------------------- Feature #16978: Ruby should not use realpath for __FILE__ https://bugs.ruby-lang.org/issues/16978#change-97119 * Author: vo.x (Vit Ondruch) * Status: Open * Priority: Normal * Assignee: nobu (Nobuyoshi Nakada) ---------------------------------------- This is the simplest test case: ~~~ $ mkdir a $ echo "puts __FILE__" > a/test.rb $ ln -s a b $ ruby -Ib -e "require 'test'" /builddir/a/test.rb ~~~ This behavior is problematic, because Ruby should not know nothing about the `a` directory. It was not instructed to use it. I should always refer to the file using the original path and do not dig into the underlying details, otherwise depending on file system setup, one might be forced to used `File.realpath` everywhere trying to use `__FILE__`. -- https://bugs.ruby-lang.org/ Unsubscribe: