Skip to content

Instantly share code, notes, and snippets.

@glennpratt
Last active February 3, 2016 21:12
Show Gist options
  • Save glennpratt/b039e4558875a3608419 to your computer and use it in GitHub Desktop.
Save glennpratt/b039e4558875a3608419 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -ex
# Reproduce bundler bug:
# https://github.com/bundler/bundler/issues/4144
rm -rf /tmp/bundler-GH-4144
mkdir -p /tmp/bundler-GH-4144
cd /tmp/bundler-GH-4144
cat > Gemfile <<EOF
source 'https://rubygems.org'
gem 'puma'
gem 'sequel'
EOF
# Expected:
# binstubs load path should be vendor/bundle, for example:
# binstubs/sequel:$:.unshift File.expand_path '../../vendor/bundle', __FILE__
# Result:
# binstubs load path fluctuates to a nested path - seemingly only when --jobs > 2
# For example:
# binstubs/sequel:$:.unshift File.expand_path '../../vendor/bundle/ruby/2.2.0/gems/puma-2.16.0/ext/puma_http11/vendor/bundle', __FILE__
# Run twice, usually at least one has a bad load path.
bundle install --path vendor/bundle --standalone --binstubs binstubs -j4 && grep unshift binstubs/*
bundle install --path vendor/bundle --standalone --binstubs binstubs -j4 && grep unshift binstubs/*
@jamesiarmes
Copy link

My output:

+ rm -rf /tmp/bundler-GH-4144
+ mkdir -p /tmp/bundler-GH-4144
+ cd /tmp/bundler-GH-4144
+ cat
+ bundle install --path vendor/bundle --standalone --binstubs binstubs -j4
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using bundler 1.10.6
Installing puma 2.16.0 with native extensions
Installing sequel 4.31.0
Bundle complete! 2 Gemfile dependencies, 3 gems now installed.
Bundled gems are installed into ./vendor/bundle.
+ grep unshift binstubs/puma binstubs/pumactl binstubs/sequel
binstubs/puma:$:.unshift File.expand_path '../../vendor/bundle', __FILE__                                                                                                                                                                                                      
binstubs/pumactl:$:.unshift File.expand_path '../../vendor/bundle', __FILE__                                                                                                                                                                                                   
binstubs/sequel:$:.unshift File.expand_path '../../vendor/bundle/ruby/2.2.0/gems/puma-2.16.0/ext/puma_http11/vendor/bundle', __FILE__                                                                                                                                          
+ bundle install --path vendor/bundle --standalone --binstubs binstubs -j4                                                                                                                                                                                                     
Using sequel 4.31.0                                                                                                                                                                                                                                                            
Using bundler 1.10.6                                                                                                                                                                                                                                                           
Using puma 2.16.0                                                                                                                                                                                                                                                              
Bundle complete! 2 Gemfile dependencies, 3 gems now installed.                                                                                                                                                                                                                 
Bundled gems are installed into ./vendor/bundle.                                                                                                                                                                                                                               
+ grep unshift binstubs/puma binstubs/pumactl binstubs/sequel                                                                                                                                                                                                                  
binstubs/puma:$:.unshift File.expand_path '../../vendor/bundle', __FILE__                                                                                                                                                                                                      
binstubs/pumactl:$:.unshift File.expand_path '../../vendor/bundle', __FILE__                                                                                                                                                                                                   
binstubs/sequel:$:.unshift File.expand_path '../../vendor/bundle', __FILE__  

@glennpratt
Copy link
Author

Mine for 1.11.2:

./bundler-GH-4144.sh
+ rm -rf /tmp/bundler-GH-4144
+ mkdir -p /tmp/bundler-GH-4144
+ cd /tmp/bundler-GH-4144
+ cat
+ bundle install --path vendor/bundle --standalone --binstubs binstubs -j4
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using bundler 1.11.2
Installing puma 2.16.0 with native extensions
Installing sequel 4.31.0
Bundle complete! 2 Gemfile dependencies, 3 gems now installed.
Bundled gems are installed into ./vendor/bundle.
+ grep unshift binstubs/puma binstubs/pumactl binstubs/sequel
binstubs/puma:$:.unshift File.expand_path '../../vendor/bundle', __FILE__
binstubs/pumactl:$:.unshift File.expand_path '../../vendor/bundle', __FILE__
binstubs/sequel:$:.unshift File.expand_path '../../vendor/bundle/ruby/2.2.0/gems/puma-2.16.0/ext/puma_http11/vendor/bundle', __FILE__
+ bundle install --path vendor/bundle --standalone --binstubs binstubs -j4
Using puma 2.16.0
Using bundler 1.11.2
Using sequel 4.31.0
Bundle complete! 2 Gemfile dependencies, 3 gems now installed.
Bundled gems are installed into ./vendor/bundle.
+ grep unshift binstubs/puma binstubs/pumactl binstubs/sequel
binstubs/puma:$:.unshift File.expand_path '../../vendor/bundle', __FILE__
binstubs/pumactl:$:.unshift File.expand_path '../../vendor/bundle', __FILE__
binstubs/sequel:$:.unshift File.expand_path '../../vendor/bundle', __FILE__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment