Skip to content

Additional fixes for scheme-based globbing (9.4)#8980

Merged
headius merged 5 commits intojruby:jruby-9.4from
headius:glob_nonmagic_alpha_9.4
Aug 27, 2025
Merged

Additional fixes for scheme-based globbing (9.4)#8980
headius merged 5 commits intojruby:jruby-9.4from
headius:glob_nonmagic_alpha_9.4

Conversation

@headius
Copy link
Member

@headius headius commented Aug 27, 2025

This fixes one issue with the new logic to process globs without scheme. The intent of this code appears to have been to remove the scheme from the path portion, used for fnmatching and character-by- character comparisons. However in that case the scheme must always be prepended when querying the "filesystem", so that URLs and such can always use appropriate logic. The patch here does the following:

  • Fully remove the scheme from the passed-in path, since the glob_helper logic seems to assume that the path bytes provided will be the schemeless full path.
  • Prepend the scheme when checking each link in the path, so that appropriate exotic filesystem checks work correctly.

This appears to fix the issue in #8973.

Backported from #8978 for 9.4.

This fixes one issue with the new logic to process globs without
scheme. The intent of this code appears to have been to remove the
scheme from the path portion, used for fnmatching and character-by-
character comparisons. However in that case the scheme must always
be prepended when querying the "filesystem", so that URLs and such
can always use appropriate logic. The patch here does the
following:

* Fully remove the scheme from the passed-in path, since the
  glob_helper logic seems to assume that the path bytes provided
  will be the schemeless full path.
* Prepend the scheme when checking each link in the path, so that
  appropriate exotic filesystem checks work correctly.

This appears to fix the issue in jruby#8973.
@headius headius added this to the JRuby 9.4.14.0 milestone Aug 27, 2025
This tests uri:classpath: and file: URIs in Dir.glob against an
on-filesystem path. See jruby#8973.
The use of "magic" logic under macOS also appears to break the
jar:file scheme. This patch fixes it, considering both jar:file:,
the path to the jar, and the "!" to be part of the scheme.

An additional fix was required for JRubyFile.JarResource to
normalize the "." path to an empty entry, because jar:file:x.jar!.
is not a valid jar:file URI for the JDK.

Includes specs.

Relates to jruby#8973.
@headius headius changed the base branch from master to jruby-9.4 August 27, 2025 18:52
@headius headius force-pushed the glob_nonmagic_alpha_9.4 branch from f56ab13 to 8fd2b7a Compare August 27, 2025 18:52
@headius headius merged commit 8fda0ff into jruby:jruby-9.4 Aug 27, 2025
195 of 196 checks passed
@headius headius deleted the glob_nonmagic_alpha_9.4 branch August 27, 2025 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant