Download & Extend

Required modules not installed before optional modules

Project:Drupal core
Version:7.x-dev
Component:install system
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Book module does not properly declare its dependencies. This leads to the following fatal errors when including it in an installation profile.

Reproduce error

Profile info file:

dependencies[] = block
dependencies[] = book
dependencies[] = dblog

Resulting error on install:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: http://localhost/rw/install.php?profile=myprofile&locale=en&id=1&op=do StatusText: OK ResponseText: Drupal @import url("http://localhost/rw/modules/system/system-behavior.css?0"); @import url("http://localhost/rw/modules/system/system.css?0"); @import url("http://localhost/rw/modules/system/system-messages.css?0"); @import url("http://localhost/rw/modules/system/system-menus.css?0"); @import url("http://localhost/rw/modules/user/user.css?0"); @import url("http://localhost/rw/themes/seven/reset.css?0"); @import url("http://localhost/rw/themes/seven/style.css?0"); Installation tasksChoose profile(done)Choose language(done)Verify requirements(done)Set up database(done)Install profile(active)Configure siteFinished Attempt to create a field of unknown type text_with_summary.

Profile info file:

dependencies[] = book
dependencies[] = block
dependencies[] = dblog

Resulting error on install:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: http://localhost/rw/install.php?profile=myprofile&locale=en&op=start&id=... StatusText: OK ResponseText: Fatal error: Call to undefined function field_attach_create_bundle() in /opt/local/apache2/htdocs/rw/modules/node/node.module on line 539 Call Stack: 0.0001 65012 1. {main}() /opt/local/apache2/htdocs/rw/install.php:0 0.0002 72940 2. install_drupal() /opt/local/apache2/htdocs/rw/install.php:21 0.0368 1001940 3. install_run_tasks() /opt/local/apache2/htdocs/rw/includes/install.core.inc:80 0.1688 1350220 4. install_run_task() /opt/local/apache2/htdocs/rw/includes/install.core.inc:344 0.1689 1351648 5. _batch_page() /opt/local/apache2/htdocs/rw/includes/install.core.inc:454 0.1694 1352860 6. _batch_do() /opt/local/apache2/htdocs/rw/includes/batch.inc:81 0.1694 1353148 7. _batch_process() /opt/local/apache2/htdocs/rw/includes/batch.inc:163 0.7050 1768960 8. call_user_func_array() /opt/local/apache2/htdocs/rw/includes/batch.inc:286 0.7050 1768960 9. _install_module_batch() /opt/local/apache2/htdocs/rw/includes/batch.inc:0 0.7050 1769148 10. module_enable() /opt/local/apache2/htdocs/rw/includes/install.core.inc:1529 0.8290 1781056 11. module_invoke() /opt/local/apache2/htdocs/rw/includes/module.inc:407 0.8290 1781304 12. call_user_func_array() /opt/local/apache2/htdocs/rw/includes/module.inc:728 0.8290 1781304 13. book_install() /opt/local/apache2/htdocs/rw/includes/module.inc:0 0.8290 1781304 14. _book_install_type_create() /opt/local/apache2/htdocs/rw/modules/book/book.install:14 0.8291 1781572 15. node_type_save() /opt/local/apache2/htdocs/rw/modules/book/book.install:41

Patch coming.

Comments

#1

Assigned to:alex_b» Anonymous
Status:active» needs review

This patch solves the errors reported above.

AttachmentSizeStatusTest resultOperations
898654-1_book_dependencies.patch544 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 23,317 pass(es).View details

#2

Status:needs review» needs work

Last I checked (seconds ago ;)), field and text were both required modules. So there's something messed up elsewhere; it shouldn't be required for modules to list individually required modules as dependencies. If this was the case, we'd have to add node as well.

#3

Priority:critical» major

Also, sorry, we're not holding up the release of Drupal 7 on book module. :P

#4

Title:Book module does not properly declare its dependencies» Required modules not installed before optional modules
Component:book.module» install system
Priority:major» critical

Ok, this is a problem with the installation system then. It looks like required modules are not necessarily installed before other modules, leading to the book module installed before field and text.

I'd appreciate pointers as to where in install.core.inc I should start reading up.

#5

Our comments just crossed - I do think this is a release blocker as this points to a larger problem that effectively breaks installation profiles.

#6

#833192: Installer might install modules in wrong order sounds like it would have fixed this but apparently not.

#7

The modules are installed in the correct order, but the notion of "required" module is not taken into account.

#8

I see three options here:

  • Option 1: we hardcode a dependency between all the modules that are marked as #required and all the modules that are not
  • Option 2: we force the weight of all the required modules to -1000 of their natural sort
  • Option 3: we don't do anything: required has nothing to do with dependencies but with the set of modules that are considered minimal for running Drupal

The first two options feels unnatural and break our nice dependency system. I'm leaning toward option 3.

#9

It's not even a question. add an install_required_modules to install_tasks before install_profile_modules and after install_bootstrap_full . given how few there are , u do not necessarily need to batch it, even.

#10

The required modules are in no way part of the dependency system. They are not displayed on the module pages for any modules that depend on them, they can never be disabled, if you ever write an app that disables a module and all the modules that were enabled only for that one then the required modules are not part of it again. And so 1. and 2. in #8 makes absolutely no sense.

And 3. is not exactly right, we need to do something, for that something see above.

#11

Status:needs work» needs review

In fact, #2 gave me an idea, not sure whether this is what Damien wanted but it does the job.

AttachmentSizeStatusTest resultOperations
required_modules_first.patch28.93 KBIdleFAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.View details

#12

Maybe this?

AttachmentSizeStatusTest resultOperations
898654-required-modules.patch1.48 KBIdleFAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.View details

#13

that was another patch.

AttachmentSizeStatusTest resultOperations
required_modules_first.patch554 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.View details

#14

Slight better one.

AttachmentSizeStatusTest resultOperations
898654-required-modules.patch1.34 KBIdleFAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.View details

#15

Status:needs review» reviewed & tested by the community

Totally works for me.

#16

Status:reviewed & tested by the community» needs work

The last submitted patch, 898654-required-modules.patch, failed testing.

#17

Status:needs work» needs review

The install profile module needs to be last or at least after its dependencies but that'll resolve to last. With the patch above it came before the non-required dependencies. It's only a problem for install profiles because other required modules are 'real' required modules that dont depend on non-required modules.

AttachmentSizeStatusTest resultOperations
898654-required-modules.patch1.45 KBIdlePASSED: [[SimpleTest]]: [MySQL] 23,339 pass(es).View details

#18

Status:needs review» reviewed & tested by the community

This works now. Issues reported initially are fixed.

#19

Status:reviewed & tested by the community» needs work

Just found a problem a dependency does not get installed as expected. devel depends on menu, I included devel in my installation profile, but not menu. That should not matter as dependency checking should detect menu and install it before devel is installed. Nevertheless, menu doesn't get installed and I get this error: "Call to undefined function menu_save() in ../devel.install"

I am now taking a look at whether and why the dependency tree is not formed right.

#20

Status:needs work» needs review

That's a whole different issue, you know. But, it's here to fix.

AttachmentSizeStatusTest resultOperations
898654-required-modules.patch2.01 KBIdlePASSED: [[SimpleTest]]: [MySQL] 23,316 pass(es).View details

#21

Ooopsie left in devel in minimal :)

AttachmentSizeStatusTest resultOperations
898654-required-modules.patch1.7 KBIdlePASSED: [[SimpleTest]]: [MySQL] 23,342 pass(es).View details

#22

Status:needs review» reviewed & tested by the community

This works now, excellent.

#23

#24

Status:reviewed & tested by the community» fixed

Awesome work, folks! I think that's record time between identifying and closing a critical (fingers crossed ;)).

Committed to HEAD. Thanks!!

#25

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here