truffleruby
truffleruby copied to clipboard
[Bug] Double loading symlinked files
Consider the same file loaded twice, with and without a symlinked path:
mkdir real_dir
ln -s real_dir symlink_dir
cat 'puts("Loaded")' > real_dir/script.rb
require_relative("./real_dir/script")
require_relative("./symlink_dir/script")
CRuby loads the script once (Output = Loaded\n
). TruffleRuby loads it twice (Output = Loaded\nLoaded\n
).
Is this a bug?
Yes, we should be compatible there. IIRC the logic CRuby in CRuby for which part of the path to expand symlinks changed quite a bit over time, possibly we don't match what latest CRuby does there.
Does this issue happen in practice? It seems a change from 3.2, so I guess it would behave the same as TruffleRuby on CRuby 3.1 and before. cc @nirvdrum
that was my experience, seemed to be a change in 3.2: https://github.com/oracle/truffleruby/pull/3189/files#diff-1be38982015c7d42487f6cb0dfd50ccb664506473122a57ec378d1f34440fcd9R407