thoughtbot / appraisal

A Ruby library for testing your library against different versions of dependencies.
https://thoughtbot.com
MIT License
1.25k stars 107 forks source link

Fix relativizing directory on remotes that do not represent a path #205

Closed aymeric-ledorze closed 1 year ago

aymeric-ledorze commented 1 year ago

Hi.

While using the latest version of appraisal in one of my projects running in a docker container, I noticed that I could not run the application because the lock file was corrupt. Indeed, instead of remote: https://github.com/thoughtbot/appraisal, the lock file contained remote: https://github.com/thoughtbot..raisal.

I traced the error back to the relativize method of Appraisal::Appraisal: https://github.com/thoughtbot/appraisal/blob/40956d3ae82632d211f157fcd289402e8f525335/lib/appraisal/appraisal.rb#L104-L112 It replaces an absolute path by a relative one. In my case, my app was running in a /app folder, and therefore the "/app" part of "thoughtbot/appraisal" is replaced by "..".

This PR solves this issue by replacing only the absolute paths that are preceded by a space. However, this may introduce a regression since I could not make any test of the current test suite fail when redefining the relativize method to just copy the content of the lock file without changing it. Therefore, I wonder if relativize tries to solve an issue that cannot be reproduced anymore.

nickcharlton commented 1 year ago

Wonderful, thank you for noticing this and providing a fix.

mogman1 commented 1 year ago

@nickcharlton Sorry to be a bother, but I just ran into this as well with docker. I pulled the master branch and confirmed this change fixes things for me as well. Any idea when this might be formally released?

nickcharlton commented 1 year ago

No worries — we're stuck behind some bundler compatibility issues which are showing up in setting up CI again. We're tracking that here: #204.