From: daniel@...42.com Date: 2021-01-25T14:35:06+00:00 Subject: [ruby-core:102234] [Ruby master Feature#16978] Ruby should not use realpath for __FILE__ Issue #16978 has been updated by Dan0042 (Daniel DeLorme). I think this is a bug and should be fixed, but IMO the proper fix is to use realpath for `__FILE__` So in the example above when you do `require "openssl/digest"`, ruby will find `/usr/local/lib/ruby/3.0.0/openssl/digest.rb` and then it should check the realpath (`~/openssl/lib/openssl/digest.rb`) before loading the file. ---------------------------------------- Feature #16978: Ruby should not use realpath for __FILE__ https://bugs.ruby-lang.org/issues/16978#change-90084 * 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: