Q:

'bundle show' results in different paths depending on user, but on same system and Gemfile.lock

I have multiple users using a CLI app on the same system. In order to use a unreleased patch, the Gemfile points to a specific commit on github of the grit gem. The app has a Gemfile.lock. All users have the same $GEM_HOME and $GEM_PATH locations set.
Now, for all but one user 'cd app; bundle show grit' shows a path like this '$GEM_HOME/bundler/gems/grit-35b71d599549' (which exists cuz I ran bundle install). But for the odd-ball, 'cd app; bundle show grit' shows a path like this '/nfs/home_dirs/odd-ball/.bundler/ruby/2.0.0/grit-35b71d599549' (which doesn't exist). A Bundler::GitError is raised for this user.
I have looked for $BUNDLE_* environment variables and for ~/.bundle* configuration. I've also verified he has permissions to the $GEM_HOME/bundler/gems.
What other reasons could account for this difference?
Thanks.

A:

I dug in and found that it came down to file permissions for this individual user. Specifically, in Bundler.requires_sudo?:
def requires_sudo?
  ...
    # if any directory is not writable, we need sudo
    dirs = [path, bin_dir] | Dir[path.join('*')]
    sudo_needed = dirs.find{|d| !File.writable?(d) }
  ...
end

This user was not in the group allowed to write to "#{path}/lib". And I'm assuming that when Bundler.requires_sudo? returns true, bundler will divert install_path to the users home dir.

