Problem/Motivation

If a module alters system info to make a module required that module's dependencies are not automatically required.

This can be tested by installing the standard profile and then using Drush to uninstall the datetime module. This is not possible in Drupal's UI because the form currently does funky processing to ensure that dependents can not be disabled.

This issue was discovered by adding a testing that enabled and uninstalls all the modules in #1808248: Add a separate module install/uninstall step to the config import process. This is critical because it allows the extreme test written in that patch to work.

Proposed resolution

Add a recursive function to ensure that all required modules dependencies are also required.

Remaining tasks

Review patch.

User interface changes

None.

API changes

None.

Comments

alexpott’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new4.37 KB
swentel’s picture

StatusFileSize
new16.68 KB

Nice catch

The only nitpick I could have on this patch is maybe trying to loose the round brackets around the module name - they feel like they are a bit redundant, as well as on command line as in the UI.

swenteldoos-2:drupal swentel$ drush pmu datetime
comment is a required module and can't be uninstalled. Reason: Field type(s) in use - see Field list                                                                      
datetime is a required module and can't be uninstalled. Reason: Dependency of required module (comment)     

Required dependency in the UI

alexpott’s picture

StatusFileSize
new778 bytes
new4.37 KB

@swentel thanks for the review.

Brackets removed.

alexpott’s picture

StatusFileSize
new649 bytes
new4.39 KB

More from @swentel in IRC

The last submitted patch, 1: 2181811.1.patch, failed testing.

The last submitted patch, 3: 2181811.3.patch, failed testing.

swentel’s picture

Status: Needs review » Reviewed & tested by the community

Yes, RTBC when green - probably tomorrow :)

catch’s picture

Status: Reviewed & tested by the community » Fixed

Nicely found. I can't find any complains so committed/pushed to 8.x, thanks!

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Fixed » Patch (to be ported)
Issue tags: +Needs backport to D7

Not quite - needs backport to 7.x too.

jeroent’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new4.14 KB

I think it should be something like this.

Drupal 7 patch attached.

Status: Needs review » Needs work

The last submitted patch, 10: 2181811-d7.10.patch, failed testing.

jeroent’s picture

Status: Needs work » Needs review
StatusFileSize
new3.24 KB
new4.2 KB

The node module is already required in Drupal 7, So i changed the test, to test it with the list module.

Patch attached.

marcingy’s picture

Issue tags: -beta blocker
fabianx’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs backport to D7

RTBC, test looks good to me, fix too.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
jeroent’s picture

Status: Needs work » Needs review
StatusFileSize
new4.35 KB
new5.53 KB
fabianx’s picture

Status: Needs review » Needs work

Neither interdiff nor patch make sense to me, patch looks identical. Wrong patch?

jeroent’s picture

StatusFileSize
new4.19 KB

Let's start again.

Created straight reroll.

jeroent’s picture

Status: Needs work » Needs review
StatusFileSize
new4.35 KB
new1.53 KB
fabianx’s picture

Status: Needs review » Reviewed & tested by the community

RTBC, thats better :). Thanks!

The last submitted patch, 18: 2181811-d7.18.patch, failed testing.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

I tried this patch and don't understand why we'd want this.

On a fresh install of Drupal core using the standard install profile, I looked at the "required by" line for the Options module on the module administration page.

Before the patch, it looks like this:

Required by: Taxonomy (enabled), Forum (disabled), List (enabled)

After the patch, it looks like this:

Required by: Drupal (Dependency of required module Taxonomy), Taxonomy (enabled), Forum (disabled), List (enabled)

That is repetitive (taxonomy listed twice) and doesn't really make any sense.

Especially given the way that e.g. field_system_info_alter() uses the concept of a "required" module as a temporary thing rather than a permanent thing, I'm not sure what we gain by marking all these other modules as required too?

I was able to reproduce the bug involving Drush:

$ drush -y dis options
taxonomy is a required module and can't be disabled. Reason: Field type(s) in use - see Field list
The following extensions will be disabled: options, list
Do you really want to continue? (y/n): y
list was disabled successfully.
options was disabled successfully. 

So it shouldn't have let me disable that at all, but it did (and on top of that, it actually wound up disabling the Taxonomy module too, although it never said so on the screen).

But why is that a bug in Drupal core? If module A depends on module B and module A can't be disabled, why isn't Drush able to detect that module B shouldn't be disabled either?

David_Rothstein’s picture

Also a minor issue, if we wind up going ahead with this:

+; Depends on the Node module to test making a module required using
+; hook_system_info_alter() and ensuring that its dependencies also become
+; required.
+dependencies[] = list (>=7.x)

The code comment should say "List" rather than "Node".

  • catch committed 8bc36db on 8.3.x
    Issue #2181811 by alexpott: System info can become inconsistent if...

  • catch committed 8bc36db on 8.3.x
    Issue #2181811 by alexpott: System info can become inconsistent if...
stefan.r’s picture

Assigned: Unassigned » alexpott

Maybe @alexpott can clarify and help us decide what to do with this :)

  • catch committed 8bc36db on 8.4.x
    Issue #2181811 by alexpott: System info can become inconsistent if...

  • catch committed 8bc36db on 8.4.x
    Issue #2181811 by alexpott: System info can become inconsistent if...
alexpott’s picture

Assigned: alexpott » Unassigned

I feel that this is part of moving the immense amount of system logic that is in the module installation forms into the API and making it consistent so the API and it's consumers like Drush don't have to repeat all the logic that is in the form.

stephencamilo’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)
hestenet’s picture

Status: Closed (won't fix) » Postponed (maintainer needs more info)

Reset issue status.

Status: Postponed (maintainer needs more info) » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.