[ruby-core:102201] [Ruby master Feature#16978] Ruby should not use realpath for __FILE__
From:
halostatue@...
Date:
2021-01-22 22:23:21 UTC
List:
ruby-core #102201
Issue #16978 has been updated by austin (Austin Ziegler). Why not put some special handling in to `require_relative` such that it checks both the pre-`realpath` and `realpath` versions (perhaps behind a `#define` flow so that Fedora and other systems integrators can do this without impacting anyone else, assuming `require_relative` is in C) so that it can handle this case? ---------------------------------------- Feature #16978: Ruby should not use realpath for __FILE__ https://bugs.ruby-lang.org/issues/16978#change-90048 * Author: vo.x (Vit Ondruch) * Status: Open * Priority: Normal ---------------------------------------- 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>