Hi all!I am posting to the list to confirm a bug I just noticed while developing modules for Apache.
Apparently pre_config hooks are not ordered when ap_run_pre_config is called. I noticed and verified one issue and I noticed another one (syntactically only) while reading through the code.
First issue (verified):While during the first configuration pass pre_config hooks seem to be ordered for prelinked modules during the second one hooks are not ordered (i.e. not in the order specified by APR_HOOK_FIRST...defines).
Fix:apr_hook_sort_all is called too late during second and further configuration passes.
It needs to be called before ap_run_pre_config (l.699 of server/main.c). Second issue (only noticed while reading the code):pre_config hooks might not be ordered for dynamically loaded modules even during first configuration pass.
Fix:apr_hook_sort_all needs to be called before ap_run_pre_config (l.627 of server/main.c)
I pasted a patch below to fix both issues. Any comments are welcome. Thanks --- httpd-2.2.8/server/main.c 2007-08-27 03:05:52.000000000 +0200 +++ httpd-2.2.8.new/server/main.c 2008-05-25 22:29:00.000000000 +0200 @@ -625,6 +625,9 @@ destroy_and_exit_process(process, 1); } + /* sort hooks again for dynamically loaded modules */ + apr_hook_sort_all(); + if (ap_run_pre_config(pconf, plog, ptemp) != OK) { ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0, NULL, "Pre-configuration failed"); @@ -636,7 +639,6 @@ if (rv == OK) { ap_fixup_virtual_hosts(pconf, server_conf); ap_fini_vhost_config(pconf, server_conf); - apr_hook_sort_all(); if (configtestonly) { ap_run_test_config(pconf, server_conf); @@ -696,6 +698,8 @@ destroy_and_exit_process(process, 1); } + apr_hook_sort_all(); + if (ap_run_pre_config(pconf, plog, ptemp) != OK) { ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0, NULL, "Pre-configuration failed"); @@ -708,7 +712,6 @@ } ap_fixup_virtual_hosts(pconf, server_conf); ap_fini_vhost_config(pconf, server_conf); - apr_hook_sort_all(); apr_pool_clear(plog); if (ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) { ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx