Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

--standalone generates file in incorrect PWD #2048

Closed
ismell opened this Issue Aug 8, 2012 · 15 comments

Comments

Projects
None yet
8 participants

ismell commented Aug 8, 2012

Hello,
I ran the following

bundle install --gemfile=src/main/webapp/WEB-INF/Gemfile --path ./target/bundler/ --standalone

and it generated the setup file in the following location target/bundler/bundler/setup.rb while it installed the gems in src/main/webapp/WEB-INF/target/bundler/. So it assumed that the --path was relative to the Gemfile instead of the PWD. It also created the .bundle/config in the WEB-INF folder.

Personally I think the --path option should be relative to the PWD but it seems to be relative to the Gemfile. So I think we should just make the bundler/setup.rb also relative to the Gemfile's path.

Owner

indirect commented Aug 8, 2012

Yeah, I think you're right, and the --path should be relative to the CWD when you invoke the Bundle command. Sounds like standalone makes the right assumption, but the general install code doesn't. Thanks for reporting this!

ismell commented Aug 9, 2012

Cool, I also think --path should be relative to CWD. I think the .bundle folder should also be created in the CWD instead of next to the Gemfile. The reason for this is that the .bundle/config has the --path writen into it so it has to be relative to where it was ran.
Raul

Contributor

xaviershay commented Aug 12, 2013

Still an issue.

Member

andremedeiros commented May 13, 2014

Reopening this one.

My attempted fix broke the specs, which is an indicator that it might break in production as well.

@andremedeiros andremedeiros reopened this May 13, 2014

Contributor

xaviershay commented Jun 27, 2014

Just hit this, admittedly I'm doing something weird: bundle install --standalone in a subdirectory from the Gemfile, expecting the bundle directory to be created inside that subdirectory - instead getting a split.

Trying to get a standalone repro together, but also hitting nil pointer errors so trying to figure out wtf is going on.

Contributor

xaviershay commented Jun 27, 2014

nil error happens on 1.6.3 with this repro, but is fixed on master. Master still displays the split install problem:

#!/bin/bash

set -ex

REPRO_DIR=/tmp/repro-2048

rm -Rf $REPRO_DIR
mkdir -p $REPRO_DIR
cd $REPRO_DIR

bundle env

cat > Gemfile <<RUBY
source "https://rubygems.org"

gem 'O_o'
RUBY

mkdir test
cd test
bundle install --standalone

!(test -e ../bundle) && test -e bundle/ruby
Member

andremedeiros commented Sep 12, 2014

@indirect what do you say we add the new behaviour back?

Owner

indirect commented Sep 12, 2014

If we can do it without breaking specs, let's do it! If not, we should do this in 2.0.

@lynncyrin lynncyrin added this to the 2.0 milestone Apr 24, 2016

Member

lynncyrin commented Apr 24, 2016

So it looks like this commit 1447f0f still needs to be added to the 2.0 branch https://github.com/bundler/bundler/tree/2-0-dev

Member

lynncyrin commented May 18, 2016 edited

which should wait until 2.0 is brought back up to date with master #4564

Member

lynncyrin commented Jun 12, 2016 edited

Alright this one is ready for someone to take 👍

@agis agis added a commit to agis/bundler that referenced this issue Oct 23, 2016

@agis agis Make `install --path` relative to the cwd
Fixes #2048.
1da8a70
Contributor

denniss commented Apr 28, 2017

@agis are you going to open a pull request for this fix?

Member

agis commented Apr 28, 2017

@denniss Nope, I hadn't had the time to work on this. Feel free to take a stab.

Owner

segiddins commented Jun 4, 2017

This should probably be implemented with a feature flag against master, if anyone is interested in tackling this!

Owner

indirect commented Sep 10, 2017

Closed by #5803.

@indirect indirect closed this Sep 10, 2017

@bundlerbot bundlerbot added a commit that referenced this issue Sep 10, 2017

@bundlerbot bundlerbot Auto merge of #5803 - igorbozato:path_relative_to_pwd, r=indirect
Make `install --path` relative to the pwd

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

> I ran the following
>
> bundle install --gemfile=src/main/webapp/WEB-INF/Gemfile --path ./target/bundler/ --standalone
> and it generated the setup file in the following location target/bundler/bundler/setup.rb while it installed the gems in src/main/webapp/WEB-INF/target/bundler/. So it assumed that the --path was relative to the Gemfile instead of the PWD. It also created the .bundle/config in the WEB-INF folder.

Closes #2048

### Was was your diagnosis of the problem?

As discussed on the issue, the path is currently being relative to the Gemfile instead of the cwd.

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

Making the path relative to the cwd if the new feature flag `path_relative_to_cwd` is set t true.

### Why did you choose this fix out of the possible options?

This work was started by @agis (agis@1da8a70).
406cdc4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment