Project

General

Profile

Actions

Feature #16978

open

Ruby should not use realpath for __FILE__

Added by vo.x (Vit Ondruch) over 4 years ago. Updated 8 months ago.

Status:
Assigned
Target version:
-
[ruby-core:98920]

Description

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__.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #10222: require_relative and require should be compatible with each other when symlinks are usedClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0