Skip to content

Conversation

@schneems
Copy link
Contributor

@schneems schneems commented Dec 26, 2025

Previously: In #9218 a reproduction is shared where running bundle clean using a binstub (bin/bundle) results in bundler removing itself. This results in Ruby falling back to its default bundler version. This behavior seems to be present for as long as there has been a default version of bundler (Ruby 2.6+).

Now: Bundler will explicitly add its current version number to the specs to be preserved. This prevents bundle clean from removing the current bundler version.

close #9218

lolwut and others added 4 commits December 26, 2025 11:47
The input to this method is not guaranteed to be a string, it could be a `Gem::Version` this normalizes the comparison.
Previously: In ruby#9218 a reproduction is shared where running `bundle clean` using a binstub (`bin/bundle`) results in bundler removing itself. This results in Ruby falling back to its default bundler version. This behavior seems to be present for as long as there has been a default version of bundler (Ruby 2.6+). 


Now: Bundler will explicitly add its current version number to the specs to be preserved. This prevents `bundle clean` from removing the current bundler version.

close ruby#9218
@schneems schneems force-pushed the schneems/no-clean-self branch from 94e170e to e3f0167 Compare December 27, 2025 02:05
@schneems schneems changed the title WIP Retain current bundler version on bundle clean Dec 27, 2025
@pboling
Copy link
Contributor

pboling commented Dec 27, 2025

As an aside - bundler isn't supposed to use a binstub for itself anymore.

Bundler itself does not use binstubs because its version is selected by RubyGems

@schneems
Copy link
Contributor Author

Thanks, I saw that. #9218 links to #8345. I'm also genuinely now sure what in the code prevents bundler from deleting itself when it's NOT using a binstub. I'm also genuinely surprised that this behavior has existed for this long and I just now found out about it.

@schneems schneems marked this pull request as ready for review December 27, 2025 03:07
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.

Bundler with binstub and bundle clean uses wrong bundler version

2 participants