Dependencies version constraints not applied when installing a new extension in an interactive request
Describe the bug Drush pm:install doesn't take into account dependencies version restrictions of the extension to be installed.
To Reproduce In a fresh Drupal 10.3.1 installation (minimal profile) I created a new custom module named "test" with just the .info file as follows:
name: 'Test'
type: module
description: 'Just a test.'
package: Custom
core_version_requirement: ^10 || ^11
dependencies:
- drupal:system (>=14.0)
It must not be possible to install since it requires a (not yet) existing version of Drupal core. From the extend administration UI I can not install it:
But drush allows me to do so:
# drush pm:install test
[success] Successfully enabled: test
Expected behavior Drush shouldn't complete the Test module installation since its dependency on system >= 14.0 can not be satisfied.
Actual behavior As described.
Workaround Install extension throw the UI, but unfortunatelly extension installation is a common process where the UI is not involved (CI/CD ...)
System Configuration
| Q | A |
|---|---|
| Drush version? | 12.5.2.0 |
| Drupal version? | 10.3.1 |
| PHP version | 8.2.15 |
| OS? | Linux |
Additional information Add any other context about the problem here.
I think this only throws the error for interactive requests. Non interactive are allowed to proceed. This went in at https://github.com/drush-ops/drush/pull/4733/files. Discussed at. https://github.com/drush-ops/drush/issues/6006#issue-2295751716
It seems to happen regardless the session is interactive or not:
Interactive (inside docker container launched with docker exec --interactive --tty ...):
Non-interactive:
ok, perhaps someone can debug why interactive is not sufficient.
I was trying to address this. I'm not familiar with Drush internals, so this is an initial attempt. I worked in 12.x that matches my testing environment, it should moved into 13.x when done.
https://github.com/drush-ops/drush/compare/12.x...manueladan-nttdata:drush:6073-dependencies_version_constraints?expand=1
Output with this change:
Help wanted, here.