Skip to content

Changing username breaks bundler plugins #3340

@JackMc

Description

@JackMc

The issue

I changed my username on my Mac from jackmccracken to jackmc. This seems to have confused bundler's plugin index which stores the absolute path for each plugin:

[jackmc@jackbook ~/some/project] % cat ~/.bundle/plugin/index 
---
commands:
hooks:
  after-install:
  - "extended_bundler-errors"
  before-install-all:
  - "extended_bundler-errors"
load_paths:
  extended_bundler-errors:
  - "/Users/jackmccracken/.bundle/plugin/gems/extended_bundler-errors-0.3.1/lib"
plugin_paths:
  extended_bundler-errors: "/Users/jackmccracken/.bundle/plugin/gems/extended_bundler-errors-0.3.1"
sources:

Note /Users/jackmccracken (my old username). This index should probably be invalidated if bundler realizes that its .bundle directory location has changed.

Steps to reproduce (and workaround)

  1. Install some bundler plugin (for example https://github.com/jules2689/extended_bundler-errors)
  2. Run bundle install in some project and observe that it works
  3. Change your username on macOS (not sure if this happens on other platforms): https://support.apple.com/en-ca/HT201548
  4. Run bundle install in any project, observe the following error (substituting your old username for jackmccracken: /opt/rubies/2.5.3/lib/ruby/site_ruby/2.5.0/bundler/plugin.rb:271:in 'load': cannot load such file -- /Users/jackmccracken/.bundle/plugin/gems/extended_bundler-errors-0.3.1/plugins.rb (LoadError)
  5. Edit ~/.bundle/plugin/index, swapping out the old username for the new one
  6. bundle install again, observe that it works again

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions