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

bundler assumes ~/.bundle to be at /.bundle when $HOME is foul #4778

Closed
schnittchen opened this issue Jul 9, 2016 · 5 comments
Closed

bundler assumes ~/.bundle to be at /.bundle when $HOME is foul #4778

schnittchen opened this issue Jul 9, 2016 · 5 comments

Comments

@schnittchen
Copy link

This happened to me today:

vagrant@vagrant:~$ HOME=foo bundle config --global path value
There was an error while trying to write to `/.bundle/config`. It is likely that you need to grant write permissions for that path.

I'd say that touching /.bundle is probably never a good idea, unless HOME actually is /.

@schnittchen
Copy link
Author

schnittchen commented Jul 9, 2016

I even had a situation where bundler happily created /.bundle/config without error, because during provisioning of a vagrant machine as root, then using sudo, somehow privileges for writing to / were not properly dropped. Took me hours to figure out this was happening.

This might have happened because the vagrant user is a sudoer, and I know bundler uses sudo at least when installing gems to a location owned by root.

@segiddins
Copy link
Member

Hmm, it seems like maybe we could just raise an exception when Dir.home isn't writable by the current user?

@schnittchen
Copy link
Author

Sounds reasonable to me.

@allenzhao
Copy link
Contributor

I'll work on this
@segiddins When should be proper to check the Dir.home? Right before writing to it?

@segiddins
Copy link
Member

@allenzhao honestly, on start up might be the best place? otherwise in all of the places that expand based on ~, centralized in a SharedHelpers method?

homu added a commit that referenced this issue Sep 30, 2016
Fallback to a temp dir when the home directory is not usable

Closes #4778
This is an alternative to #4886
\c @allenzhao @indirect
hsbt pushed a commit to rubygems/bundler-graph that referenced this issue Oct 19, 2021
Fallback to a temp dir when the home directory is not usable

Closes rubygems/bundler#4778
This is an alternative to rubygems/bundler#4886
\c @allenzhao @indirect
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

5 participants