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

Use expand_path logic for Dir.glob base path #6084

merged 2 commits into from Feb 19, 2020


Copy link

@headius headius commented Feb 19, 2020

This should fix issues reported with RubyGems 3.0.6 and jarred resources.

Fixes #6060
Fixes #6082
Fixes #6083

I have reverted the tests we disabled in but a more direct test of this behavior (i.e. passing a base: URI to Dir.glob) would be useful to make sure we don't regress.

headius added 2 commits Feb 19, 2020
Dir.glob was treating any passed-in `base` path as a normal file
path, which cause it to treat URIs as a relative path. The logic
then proceeded to prepend the cwd to this URI, producing a
nonsense path.

This patch uses File.expand_path logic to acquire the base path,
which keeps it a URI and allows the rest of glob to handle it
as if the glob and base were expanded before calling Dir.glob.

The change means that the two following Dir.glob calls work the
same, fixing the issues discovered in jruby#6060. It will very likely
also fix the issues reported in jruby#6082 and jruby#6083.

Fixes jruby#6060
Fixes jruby#6082
Fixes jruby#6083
enebo approved these changes Feb 19, 2020
Copy link

@enebo enebo left a comment

We may have something which uses fsenc for 9.3 but this looks like less of a semantic gamble for

@headius headius merged commit 4639e64 into jruby:master Feb 19, 2020
1 check passed
@headius headius deleted the dir_glob_base_url branch Feb 19, 2020
headius added a commit that referenced this pull request Feb 19, 2020
Use expand_path logic for Dir.glob base path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
2 participants