Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Double loading symlinked files #3138

Open
itarato opened this issue Jun 27, 2023 · 3 comments · May be fixed by #3189
Open

[Bug] Double loading symlinked files #3138

itarato opened this issue Jun 27, 2023 · 3 comments · May be fixed by #3189

Comments

@itarato
Copy link
Collaborator

itarato commented Jun 27, 2023

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?

@eregon
Copy link
Member

eregon commented Jun 28, 2023

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.

rwstauner added a commit to Shopify/truffleruby that referenced this issue Jul 26, 2023
TODO:
- changelog
- require (not relative) specs
- other specs?

closes oracle#3138
rwstauner added a commit to Shopify/truffleruby that referenced this issue Jul 27, 2023
@rwstauner rwstauner linked a pull request Jul 27, 2023 that will close this issue
rwstauner added a commit to Shopify/truffleruby that referenced this issue Jul 27, 2023
@eregon
Copy link
Member

eregon commented Jul 28, 2023

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

@rwstauner
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants