Skip to content

Always use full logic for processing glob segments.#5378

Merged
headius merged 2 commits intojruby:masterfrom
headius:fix_dir_glob_escaping
Oct 25, 2018
Merged

Always use full logic for processing glob segments.#5378
headius merged 2 commits intojruby:masterfrom
headius:fix_dir_glob_escaping

Conversation

@headius
Copy link
Member

@headius headius commented Oct 19, 2018

This is a workaround for issues found in #5333. I discovered while
researching a fix for that bug that our glob_helper appears to
be missing "else" logic for the segment processing that handles
magic characters and unescaping. Put simply, if there's no magic
in the segment it leaves it entirely unprocessed, allowing its
contents to just get rolled into the next segment loop (which may
or may not also have magic). However this leaves escapes in place.

This "fix" basically just omits the magic check for each segment
and allows full processing.

This is a workaround for issues found in jruby#5333. I discovered while
researching a fix for that bug that our `glob_helper` appears to
be missing "else" logic for the segment processing that handles
magic characters and unescaping. Put simply, if there's no magic
in the segment it leaves it entirely unprocessed, allowing its
contents to just get rolled into the next segment loop (which may
or may not also have magic). However this leaves escapes in place.

This "fix" basically just omits the magic check for each segment
and allows full processing.
@headius headius added this to the JRuby 9.2.1.0 milestone Oct 19, 2018
@headius
Copy link
Member Author

headius commented Oct 25, 2018

This did not pass but it seems like the only failures are for jarred Ruby scripts/gems. I'll see if I can suss out why those are now failing.

@headius
Copy link
Member Author

headius commented Oct 25, 2018

It looks like limiting my change to only segments that contain \ chars will work ok.

This narrows my fix to only fire for segments with magic chars
(* and ? and the like) or backslashes in the presence of escaped
mode (i.e. not FNM_NOESCAPE). This will slow down the processing
of segments that contain only backslash escapes, but they were not
processed properly before anyway. Segments without backslashes or
magic characters are unaffected. Segments with backslashes and
magic characters are unaffected.
@headius headius merged commit 167d130 into jruby:master Oct 25, 2018
@headius headius deleted the fix_dir_glob_escaping branch October 25, 2018 20:15
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