-
-
Notifications
You must be signed in to change notification settings - Fork 2k
bundle lock
does not activate gems for current platform if it was activated under a different platform for a separate dependency
#4896
Comments
Have you tried this against #4836 ? I believe it should fix the issue. Also, you might want to look into using |
I'll try #4836 I did try |
That's expected, since I think #4836 fixes it by introducing the |
Ugh just confirmed the bug still exists, I'll see if I can dig into why |
Oh that does fix the issue. Very awesome! I didn't use |
I have a fix, will add it to the existing PR which ought to ship in 1.14 |
The |
In that case, you might also find #4895 interesting! |
[Resolver] Ensure all platforms are activated for the activated spec group Closes #4896
[Resolver] Ensure all platforms are activated for the activated spec group Closes #4896
As part of our build process we
bundle lock
againstruby
and then again againstx86-mingw32
and commit a unified lock file with aggregate gem requirements. This works well for us in most cases. However there is a specific edge case where this breaks.Assume this minimal Gemfile:
Now if I
bundle lock
separately on linux and windows, each platform generates an acceptable lockfile. However, if I have a windows generated lock file that looks like this:Then I run
bundle lock
on linux, I get:The key error here is the ommision of
ffi (1.9.14)
. I'm left with only the windows variant butgssapi
should be activating one for theruby
platform.First, I realize there is work going into 1.13 to improve platform related issues. I have tried this scenario with 1.13.0.RC.1 and this problem is still present. Second I have looked through bundler source and "think" I understand the issue and have a fix that remedies the problem. However as I'll discuss shortly, its probably not the right fix.
So this is definitely an edge case and with different requirements I get expected results. For example, if my Gemfile only had
gssapi
and did not includemixlib-shellout
, I'd end up with bothffi
platforms. Here is why the a Gemfile withmixlib-shellout
(and I'm sure there are others) produces unexpected results.mixlib-shellout
has two separate gemspecs - a second windows specific one. Only its windows gemspec takes a dependency onwin32-process
which in turn takes a dependency onffi
. So the resolver resolvesmixlib-shellout
and rightly so activates noffi
on linux but does activate it forwindows
given a lock file with a mingw dependency. Later when it resolvesgssapi
on linux, the resolver produces aSpecGroup
forffi
with an activatedruby
platform. However, when theResolution
attempts to activate thepossibility
:Here
existing_node
points to the previously activated windows dependency and the rubypossibility
is thrown away.Changing:
to:
fixes this and ensures if the current possibility contains active platforms not included in the existing possibiity, it will be activated. This produces the
ffi (>= 1.0.1)
requirement previously missing and preventscorrupted Gemfile.lock
errors on linux.Now I think this is possibly not the "right" change since it is in the vendored
Molinillo
library. I'm honestly not familiar enough with these code bases to know if I should submit a PR and tests to that repo or if something should be changed in the way bundler consumes it. Like maybe keying off of something other thanname
(if thats even controlled on the bundler side).Would really appretiate thoughts on this. Thanks!!
The text was updated successfully, but these errors were encountered: