New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Array#shuffle! after shifting #1527
Merged
Merged
Conversation
This file contains 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
shuffle! ignored a shifted start of the array, so the following code would sometimes result in a nil getting swapped into the array: a = [0,1,2]; a.shift; a.shuffle! Fix it by adding the proper offset.
Could you please also add a spec for this issue? Probably can be tricky though since it involves randomness, but maybe it's possible to create a spec in such a way that there is always a nil somewhere and assert on that? |
Maybe by stubbing Kernel.rand? |
brixen
added a commit
that referenced
this pull request
Mar 30, 2016
RubyGems 2.6.2 installed === 2.6.2 / 2016-03-12 Bug fixes: * Fix wrong version of gem activation for bin stub. Pull request #1527 by Aaron Patterson. * Speed up gem activation failures. Pull request #1539 by Aaron Patterson. * Fix platform sorting in the resolver. Pull request #1542 by Samuel E. Giddins. * Ensure we unlock the monitor even if try_activate throws. Pull request #1538 by Charles Oliver Nutter. === 2.6.1 / 2016-02-28 Bug fixes: * Ensure `default_path` and `home` are set for paths. Pull request #1513 by Aaron Patterson. * Restore but deprecate support for Array values on `Gem.paths=`. Pull request #1514 by Aaron Patterson. * Fix invalid gem file preventing gem install from working. Pull request #1499 by Luis Sagastume. === 2.6.0 / 2016-02-26 Minor enhancements: * RubyGems now defaults the `gem push` to the gem's "allowed_push_host" metadata setting. Pull request #1486 by Josh Lane. * Update bundled Molinillo to 0.4.3. Pull request #1493 by Samuel E. Giddins. * Add version option to gem open command. Pull request #1483 by Hrvoje Šimić. * Feature/add silent flag. Pull request #1455 by Luis Sagastume. * Allow specifying gem requirements via env variables. Pull request #1472 by Samuel E. Giddins. Bug fixes: * RubyGems now stores `gem push` credentials under the host you signed-in for. Pull request #1485 by Josh Lane. * Move `coding` location to first line. Pull request #1471 by SHIBATA Hiroshi. * [PathSupport] Handle a regexp path separator. Pull request #1469 by Samuel E. Giddins. * Clean up the PathSupport object. Pull request #1094 by Aaron Patterson. * Join with File::PATH_SEPARATOR in Gem.use_paths. Pull request #1476 by Samuel E. Giddins. * Handle when the gem home and gem path arent set in the config file. Pull request #1478 by Samuel E. Giddins. * Terminate TimeoutHandler. Pull request #1479 by Nobuyoshi Nakada. * Remove redundant cache. Pull request #1482 by Eileen M. Uchitelle. * Freeze `Gem::Version@segments` instance variable. Pull request #1487 by Ben Dean. * Gem cleanup is trying to uninstall gems outside GEM_HOME and reporting an error after it tries. Pull request #1353 by Luis Sagastume. * Avoid duplicated sources. Pull request #1489 by Luis Sagastume. * Better description for quiet flag. Pull request #1491 by Luis Sagastume. * Raise error if find_by_name returns with nil. Pull request #1494 by Zoltán Hegedüs. * Find_files only from loaded_gems when using gemdeps. Pull request #1277 by Michal Papis. === 2.5.2 / 2016-01-31 Bug fixes: * Fix memoization of Gem::Version#prerelease? Pull request #1125 by Matijs van Zuijlen. * Handle trailing colons in GEM_PATH, by Damien Robert. * Improve the Gemfile `gemspec` method, fixing #1204 and #1033. Pull request #1276 by Michael Papis. * Warn only once when a gemspec license is invalid. Pull request #1414 by Samuel E. Giddins. * Check for exact constants before using them, fixing Ruby bug #11940. Pull request #1438 by Nobuyoshi Nakada. * Fix building C extensions on Ruby 1.9.x on Windows. Pull request #1453 by Marie Markwell. * Handle symlinks containing ".." correctly. Pull request #1457 by Samuel E. Giddins. Minor enhancements: * Add `--no-rc` flag, which skips loading `.gemrc`. Pull request #1329 by Luis Sagastume. * Allow basic auth to be excluded from `allowed_push_host`. By Josh Lane. * Add `gem list --exact`, which finds gems by string match instead of regex. Pull request #1344 by Luis Sagastume. * Suggest alternatives when gem license is unknown. Pull request #1443 by Samuel E. Giddins. * Print a useful error if a binstub expects a newer version of a gem than is installed. Pull request #1407 by Samuel E. Giddins. * Allow the (supported) s3:// scheme to be used with `--source`. Pull request #1416 by Dave Adams. * Add `--[no-]post-install-message` to `install` and `update`. Pull request #1162 by Josef Šimánek. * Add `--host` option to `yank`, providing symmetry with `pull`. Pull request #1361 by Mike Virata-Stone. * Update bundled Molinillo to 0.4.1. Pull request #1452 by Samuel E. Giddins. * Allow calling `build` without '.gemspec'. Pull request #1454 by Stephen Blackstone. * Add support for `source` option on gems in Gemfile. Pull request #1355 by Michael Papis. * Function correctly when string literals are frozen on Ruby 2.3. Pull request #1408 by Samuel E. Giddins. === 2.5.1 / 2015-12-10 Bug fixes: * Ensure platform sorting only uses strings. Affected binary installs on Windows. Issue #1369 reported by Ryan Atball (among others). Pull request #1375 by Samuel E. Giddins. * Revert PR #1332. Unable to reproduce, and nil should be impossible. * Gem::Specification#to_fullpath now returns .rb extensions when such a file exists. Pull request #1114 by y-yagi. * RubyGems now handles Net::HTTPFatalError instead of crashing. Pull request #1314 by Samuel E. Giddins. * Updated bundled Molinillo to 0.4.0. Pull request #1322, #1396 by Samuel E. Giddins. * Improved performance of spec loading by reducing likelihood of loading the complete specification. Pull request #1373 by Aaron Patterson. * Improved caching of requirable files Pull request #1377 by Aaron Patterson. * Fixed activation of gems with development dependencies. Pull request #1388 by Samuel E. Giddins. * RubyGems now uses the same Molinillo vendoring strategy as Bundler. Pull request #1397 by Samuel E. Giddins. * Fixed documentation of Gem::Requirement.parse. Pull request #1398 by Juanito Fatas. * RubyGems no longer warns when a prerelease gem has prerelease dependencies. Pull request #1399 by Samuel E. Giddins. * Fixed Gem::Version documentation example. Pull request #1401 by Guilherme Goettems Schneider. * Updated documentation links to https://. Pull request #1404 by Suriyaa Kudo. * Fixed double word typo. Pull request #1411 by Jake Worth. ------------------------------------------------------------------------------
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.
shuffle! ignored a shifted start of the array, so the following code
would sometimes result in a nil getting swapped into the array:
a = [0,1,2]; a.shift; a.shuffle!
Fix it by adding the proper offset.