Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Gem binary paths with spaces create a problem for bundle exec #4230

Closed
bfad opened this issue Jan 24, 2016 · 2 comments
Closed

Gem binary paths with spaces create a problem for bundle exec #4230

bfad opened this issue Jan 24, 2016 · 2 comments
Assignees

Comments

@bfad
Copy link

bfad commented Jan 24, 2016

If the path to your project has a space in it and you keep your gems in your project, then bundle exec fails when trying to run any binaries. Below is a zsh script that shows the issue. (It looks like it also happens with bash.)

#!/bin/zsh

mkdir -p '/tmp/sp ace/project/'
cd '/tmp/sp ace/project/'
mkdir 'spec/'

cat > Gemfile <<EOF
source 'http://rubygems.org'
gem 'rspec'
EOF

bundle install --path vendor

# Expected behavior: should work
# Observed behavior: errors with rspec not executable
bundle exec rspec

# If you execute the following, you'll see the space isn't escaped
#bundle exec env | grep PATH

Here is my bundle env

Environment

    Bundler   1.11.2
    Rubygems  2.4.5.1
    Ruby      2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
    GEM_HOME  /Users/username/.gem/ruby/2.2.3
    GEM_PATH  /Users/username/.gem/ruby/2.2.3:/Users/username/.rubies/ruby-2.2.3/lib/ruby/gems/2.2.0
    Git       2.5.1

Bundler settings

    gem.coc
      Set for the current user (/Users/username/.bundle/config): "true"
    gem.mit
      Set for the current user (/Users/username/.bundle/config): "false"
    gem.test
      Set for the current user (/Users/username/.bundle/config): "rspec"
    build.nokogiri
      Set for the current user (/Users/username/.bundle/config): "--use-system-libraries"
    path
      Set for your local app (/private/tmp/sp ace/project/.bundle/config): "vendor"
    disable_shared_gems
      Set for your local app (/private/tmp/sp ace/project/.bundle/config): "1"

Gemfile

    source 'http://rubygems.org'
    gem 'rspec'

Gemfile.lock

    GEM
      remote: http://rubygems.org/
      specs:
        diff-lcs (1.2.5)
        rspec (3.4.0)
          rspec-core (~> 3.4.0)
          rspec-expectations (~> 3.4.0)
          rspec-mocks (~> 3.4.0)
        rspec-core (3.4.1)
          rspec-support (~> 3.4.0)
        rspec-expectations (3.4.0)
          diff-lcs (>= 1.2.0, < 2.0)
          rspec-support (~> 3.4.0)
        rspec-mocks (3.4.1)
          diff-lcs (>= 1.2.0, < 2.0)
          rspec-support (~> 3.4.0)
        rspec-support (3.4.1)

    PLATFORMS
      ruby

    DEPENDENCIES
      rspec

    BUNDLED WITH
       1.11.2
@segiddins
Copy link
Member

This is only an issue when bundle exec is trying to run a command without any additional arguments -- I'm looking into a fix right now :)

@bfad
Copy link
Author

bfad commented Jan 24, 2016

I can verify that if I run bundle exec rspec spec then it runs as expected. Thanks for the quick response.

@segiddins segiddins self-assigned this Jan 24, 2016
homu added a commit that referenced this issue Jan 28, 2016
[Exec] Fix exec-ing with 0 args in a directory with spaces

Closes #4230 by forcing `Kernel.exec` to never use a shell
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants