Skip to content

Path bug #1027

wants to merge 1 commit into from

2 participants

opsb commented Feb 9, 2011

Currently Source::Paths are only considered equal if they have the same basename. This basename is generated from either a relative or absolute path depending on how the Path was created. This fails for: => '.').should == => "/absolute/path/to/same/directory")

The basepaths are different and so the Paths are not equal.

This showed up as a bug when using a gemspec. During parsing the LockfileParser loads the source with an absolute path. The Dsl on the other hand loads it with a relative path. Definition then considers them different and gives an error like:

You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control

You have added to the Gemfile:
* source: source at /absolute/path/to/delayed_job_groups_mongoid

You have deleted from the Gemfile:
* source: source at .

You have changed in the Gemfile:
* delayed_job_groups_mongoid from `source at /absolute/path/to/delayed_job_groups_mongoid` to `no specified source`

You can replicate this bug with

$ git clone git://
$ git checkout path_bug
$ bundle install --deployment

The commit updates Path#name to always use an absolute path. This allows Path#eql? to compare absolute and relative paths correctly.

@opsb opsb Allow relative and absolute Paths to be compared
When Paths were created with relative paths they would not be considered equal to a Path
for the same location but as an absolute path.
Bundler member
indirect commented Apr 8, 2011

Pulled as 03e8223. It turns out this was fixed by a change Carl made that stopped using #name as part of the basis for comparison, but I think this is worth fixing anyway. Thanks for the patch!

@indirect indirect closed this Apr 8, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.