hook_requirements('install') called on unintended modules during Drupal install

cpliakas - September 30, 2009 - 16:07
Project:Drupal
Version:7.x-dev
Component:install system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I found a strange issue during Drupal install where hook_requirements('install') is called on seemingly random modules. After looking into the code, it seems that the problem lies within the drupal_get_install_functions() function in includes/install.inc. The function is passed a list of required modules (the modules getting installed as part of the profile), for example node, user, block, etc. and then tries to find .install files for the modules using the following pattern: '/' . $module . '.install$/'. As the pattern reads, the install files for all modules whose name matches or ends with the names of the required modules get called. For example, hook_requirements('install') will get invoked on the modules "mymodule_node" and "mymodulenode" even if they aren't being installed simply because they end with the word "node". This very small patch alters the $mask parameter so that it exactly matches the list of required modules. As a side note, a similar issue exists in D5 and D6 as well, and it has bit some users of the Search Lucene API module because it has a bundled contrib that is named "luceneapi_node".

Thanks,
Chris

AttachmentSizeStatusTest resultOperations
hook-requirements-fix.patch424 bytesIdlePassed: 14684 passes, 0 fails, 0 exceptionsView details | Re-test

#1

cpliakas - October 1, 2009 - 02:47

Amendment to the above post. I stated that the problem lies within the drupal_get_install_functions() function, but what I meant to type was drupal_get_install_files(). Also, I just noticed that drupal_get_install_files() gets called when a module is installed via the system modules form, so the bug is not limited Drupal installation as I first thought. I see that preg_match() has been used in place of ereg() in file_scan_directory(), so the revised patch makes use of preg_quote() function to properly escape the "." in the $mask parameter ensuring that it is an exact match.

AttachmentSizeStatusTest resultOperations
hook-requirements-fix-01.patch446 bytesIdleFailed: 13659 passes, 1 fail, 0 exceptionsView details | Re-test

#2

System Message - October 7, 2009 - 21:30
Status:needs review» needs work

The last submitted patch failed testing.

#3

cpliakas - October 30, 2009 - 02:17
Status:needs work» needs review

Refreshed patch with HEAD.

AttachmentSizeStatusTest resultOperations
install-592182-3.patch471 bytesIdlePassed on all environments.View details | Re-test

#4

System Message - December 5, 2009 - 14:07

ddorian requested that failed test be re-tested.

 
 

Drupal is a registered trademark of Dries Buytaert.