Resolve globbed entries literally in Gem::Util.glob_files_in_dir - #9802
Merged
Conversation
Matched entries were resolved with File.expand_path, so an entry starting with `~` was expanded into the home directory. A cache directory named `~` made `bundle cache` pruning delete files under `$HOME`, and an entry like `~foo` raised `ArgumentError`. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
`gem contents`, `gem stale` and the `gem setup` old-doc cleanup returned no matches when the install path contains glob metacharacters. For `--lib-only`, glob `raw_require_paths`, which stay relative to `full_gem_path`, rather than `require_paths`, which prepends the absolute `extension_dir` and would escape the glob base. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bundler runs against whatever RubyGems the host provides, so calling `Gem::Util.glob_files_in_dir` left `bundle cache` pruning able to resolve a cache entry named `~` to the real home directory and hand it to `FileUtils.rm_rf` on every RubyGems older than that fix. Move the helper into `SharedHelpers`. This also covers `bundle doctor`, which previously found no `.bundle` files under an install path containing glob metacharacters. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hsbt
force-pushed
the
claude/practical-wu-64037b
branch
from
August 24, 2026 08:08
636c234 to
4d79dce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #9687.
Gem::Util.glob_files_in_dirresolved matched entries withFile.expand_path, so an entry starting with~was expanded into the home directory. A cache directory named~madebundle cachepruning delete files under$HOME, and an entry like~userraisedArgumentError. Matched entries are now joined literally to the base path.This also migrates the remaining call sites that still interpolated install paths into glob patterns (
gem contents,gem stale, thegem setupold-doc cleanup, andbundle doctor), which returned no matches when the install path contains glob metacharacters, and routessetup_manpaththrough the shared helper for consistency.Generated with Claude Code