vndr
vndr copied to clipboard
Fix versioned dependencies being removed during clone
If both a "versioned" and "non-versioned" version of a dependency exists in vendor.conf, the "longest" path should be cloned last, otherwise the versioned dependency may be deleted when cloning its non-versioned variant.
For example, with the following vendor.conf:
github.com/coreos/go-systemd/v22 v22.0.0
github.com/coreos/go-systemd v17
Running vndr would;
- recursively delete "vendor/src/github.com/coreos/go-systemd/v22:
- start cloning "github.com/coreos/go-systemd/v22"
- recursively delete "vendor/src/github.com/coreos/go-systemd"
- start cloning "github.com/coreos/go-systemd"
This would lead to a conflicting situation; step 3. will remove the dependency that was previously cloned (or in the process of being cloned).
This patch sorts the dependencies by import-path, cloning the shortest import paths first, which should prevent the race condition.
Omg, sorry, folks - Gmail ate my github label and I missed. Will review today.
@thaJeztah Do you have time to try to write (or modify existing) unit-test? Thanks!
No worries; I was able to work around the issue by changing the order of the dependencies in the vendor.conf file, so it wasn't urgent.
I'll have a look at writing / adding a test case. I was a bit in a hurry writing this patch (so didn't spend much time looking for the tests)
On 6 May 2020, at 20:53, Alexander Morozov [email protected] wrote:
@thaJeztah Do you have time to try to write (or modify existing) unit-test? Thanks!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.