hashicorp / hashicorp/vagrant

When installing a plugin, its dependecies won't honor required_ruby_version

Open
#12,640 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
27.2k
Forks
4.4k
Avg merge
1m
Merged PRs (30d)
1

Description

When installing a plugin it's sub-dependencies might have been updated to only support ruby '>=3.0'

```console
$ vagrant plugin install vagrant-dns --plugin-version 2.2.1
Installing the 'vagrant-dns' plugin. This can take a few minutes...
Vagrant failed to properly resolve required dependencies. These
errors can commonly be caused by misconfigured plugin installations
or transient network issues. The reported error is:

io-event requires Ruby version >= 3.0. The current ruby version is 2.7.4.191.
```

The dependency chain looks like this:

```
- vagrant-dns 2.2.1
- rubydns 2.0.2
- async-dns 1.3.0
- async-io 1.32.2
```

until here we are fine with ruby < 3

Now, async-io depends on `async >= 0` which has:

- async 2.0.0 with ruby >= 3.1.0 and a dependency on io-event
- async 1.30.1 with ruby >= 2.5.0 and a dependency on nio4r (instead of io-event)

Now it seems to selects async 2.0.0 with ruby >= 3.1.0 instead of async 1.30.1, which would match vagrants embedded ruby version.

### Vagrant version

```console
$ vagrant -v
Vagrant 2.2.19
$ uname -v
Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64
```

### Host operating system

macOS 12.1

### Guest operating system

This is the operating system you run in the virtual machine.

### Vagrantfile

### Debug output

https://gist.github.com/fnordfish/45adaa2cecb284a51a7ab784c7e56726

### Expected behavior

Installs the plugin using dependencies matching the ruby version vagrant runs with.

### Actual behavior

Fails to install plugin when trying to install a gem with newer ruby requirements.

### Steps to reproduce

Install a plugin where it's sub-dependencies have a requirement for a newer ruby (3.1)

1. vagrant plugin install vagrant-dns --plugin-version 2.2.1

### References

BerlinVagrant/vagrant-dns#69

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with `vagrant plugin install vagrant-dns --plugin-version 2.2.1` and trace the plugin dependency resolution described in the issue. Confirm that resolution honors Vagrant's embedded Ruby version and selects a compatible dependency chain instead of `async` 2.0.0 with its Ruby 3.1 requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.