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

[Init] Check if the current directory is writeable #6266

Merged
merged 3 commits into from
Jan 31, 2018

Conversation

nilsding
Copy link
Contributor

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

The problem was that when running bundle init inside a directory which is not writable by the current user (e.g. / as demonstrated in #6219) Bundler prints out an EACCES error with a huge backtrace. In the mentioned PR @segiddins suggested to print out a better error message. This PR addresses that.

What was your diagnosis of the problem?

See this comment on said PR.

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

My fix is simple: adding a check whether the current directory is writeable before trying to create gems.rb/Gemfile. If that's not the case, print out an error and exit.

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

I chose this fix because... it was really simple to implement.

@ghost
Copy link

ghost commented Jan 19, 2018

Thanks for opening a pull request and helping make Bundler better! Someone from the Bundler team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality.

We use Travis CI to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of Travis CI in the PR status window below.

If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #bundler channel on Slack.

For more information about contributing to the Bundler project feel free to review our CONTRIBUTING guide

Copy link
Member

@colby-swandale colby-swandale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this PR and helping improve Bundler!

@@ -64,6 +64,22 @@
end
end

context "when the dir is not writable by the current user", :bundler => ">= 2" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be tagged with :bundler => ">= 2" because this is not testing any specific Bundler 2 functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any other 1.x release planned?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor Author

@nilsding nilsding Jan 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, alright. I’ll remove that tag there then and try to make the spec pass with Ruby 1.8

@colby-swandale
Copy link
Member

@bundlerbot r+

@bundlerbot
Copy link
Collaborator

📌 Commit 205844f has been approved by colby-swandale

@bundlerbot
Copy link
Collaborator

⌛ Testing commit 205844f with merge c4b022c...

bundlerbot added a commit that referenced this pull request Jan 30, 2018
[Init] Check if the current directory is writeable

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

The problem was that when running `bundle init` inside a directory which is not writable by the current user (e.g. `/` as demonstrated in #6219) Bundler prints out an `EACCES` error with a huge backtrace.  In the mentioned PR @segiddins suggested to print out a better error message.  This PR addresses that.

### What was your diagnosis of the problem?

See [this comment on said PR](#6219 (comment)).

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

My fix is simple: adding a check whether the current directory is writeable before trying to create `gems.rb`/`Gemfile`.  If that's not the case, print out an error and exit.

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

I chose this fix because... it was really simple to implement.
@bundlerbot
Copy link
Collaborator

☀️ Test successful - status-travis
Approved by: colby-swandale
Pushing c4b022c to master...

@bundlerbot bundlerbot merged commit 205844f into rubygems:master Jan 31, 2018
@colby-swandale colby-swandale added this to the 1.16.2 milestone Feb 4, 2018
colby-swandale pushed a commit that referenced this pull request Apr 11, 2018
[Init] Check if the current directory is writeable

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

The problem was that when running `bundle init` inside a directory which is not writable by the current user (e.g. `/` as demonstrated in #6219) Bundler prints out an `EACCES` error with a huge backtrace.  In the mentioned PR @segiddins suggested to print out a better error message.  This PR addresses that.

### What was your diagnosis of the problem?

See [this comment on said PR](#6219 (comment)).

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

My fix is simple: adding a check whether the current directory is writeable before trying to create `gems.rb`/`Gemfile`.  If that's not the case, print out an error and exit.

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

I chose this fix because... it was really simple to implement.

(cherry picked from commit c4b022c)
colby-swandale pushed a commit that referenced this pull request Apr 20, 2018
[Init] Check if the current directory is writeable

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

The problem was that when running `bundle init` inside a directory which is not writable by the current user (e.g. `/` as demonstrated in #6219) Bundler prints out an `EACCES` error with a huge backtrace.  In the mentioned PR @segiddins suggested to print out a better error message.  This PR addresses that.

### What was your diagnosis of the problem?

See [this comment on said PR](#6219 (comment)).

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

My fix is simple: adding a check whether the current directory is writeable before trying to create `gems.rb`/`Gemfile`.  If that's not the case, print out an error and exit.

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

I chose this fix because... it was really simple to implement.

(cherry picked from commit c4b022c)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants