Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Report permission errors from bundle clean - #9772

Merged
hsbt merged 6 commits into
ruby:masterfrom
alloutflo:agent/issue-9396-clean-permission-errors
Nov 9, 2026
Merged

hsbt merged 6 commits into
ruby:masterfrom
alloutflo:agent/issue-9396-clean-permission-errors

Conversation

@alloutflo

@alloutflo alloutflo commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

What was the end-user or developer problem that led to this PR?

bundle clean could report that it removed an unused gem and exit successfully even when filesystem permissions prevented deletion. That left files behind without telling the user which paths needed attention.

Fixes #9396.

What is your fix for the problem, implemented in this PR?

bundle clean removes the paths it can, runs the configured cache pruning, and reports filesystem access failures together with exit status 44. This covers unused gem directories and files, Git caches, and extension directories. If a path disappeared after the scan, it counts as already removed.

When cleaning runs as part of a successful bundle install or bundle update, Bundler reports leftover paths as a warning and preserves the install or update result.

Verification

  • Regression coverage checks partial cleanup, aggregated permission errors and exit status 44, disappearing directories, Git cache failures, install/update warnings, and cache pruning after a partial failure.
  • All 114 GitHub checks passed for afe037fb.

Make sure the following tasks are checked

  • Describe the problem / feature
  • Write tests for the bug fix
  • Write code to solve the problem
  • Follow the current code style and use a meaningful commit message without tags

AI disclosure: I used an AI coding assistant to investigate the issue, implement the initial patch, and run its local checks. Follow-up commits from hsbt extend the behavior and regression coverage described above.

@hsbt

hsbt commented Oct 30, 2026

Copy link
Copy Markdown
Member

I pushed four commits on top of yours. bundle clean now keeps going past paths it cannot remove and lists them at the end, covers git caches and extension directories too, counts a directory that vanished as removed, and only warns when it runs after bundle install or bundle update.

alloutflo and others added 6 commits October 30, 2026 17:31
FileUtils.rm_rf ignored a directory another process had already deleted, but rm_r raises ENOENT, which reached the user as an unexpected error report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Raising on the first failure left later gem directories, gemspecs and binstubs behind, so the gemspec of a gem whose directory was already removed stayed installed. Now everything removable is removed, only those paths are reported as removed, and the rest are listed together before exiting with an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They were still removed with FileUtils.rm_rf, which ignores the same permission errors that unused gem directories now report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the clean setting enabled, a gem that could not be removed made a successful bundle install or bundle update exit with an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The prune setting was skipped once clean raised, though everything removable is gone by then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hsbt
hsbt force-pushed the agent/issue-9396-clean-permission-errors branch from 91a2b38 to afe037f Compare October 30, 2026 08:37
@hsbt
hsbt merged commit 5695805 into ruby:master Nov 9, 2026
114 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permissions errors are silently swallowed in bundle clean

2 participants