Skip to content

Use expand_path logic for Dir.glob base path#6084

Merged
headius merged 2 commits intojruby:masterfrom
headius:dir_glob_base_url
Feb 19, 2020
Merged

Use expand_path logic for Dir.glob base path#6084
headius merged 2 commits intojruby:masterfrom
headius:dir_glob_base_url

Conversation

@headius
Copy link
Member

@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 9.2.10.0 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.

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
Copy link
Member

@enebo enebo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@headius headius merged commit 4639e64 into jruby:master Feb 19, 2020
@headius headius deleted the dir_glob_base_url branch February 19, 2020 18:52
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

Labels

None yet

Projects

None yet

2 participants