Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 87138 invoked from network); 26 May 2008 07:21:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 May 2008 07:21:51 -0000 Received: (qmail 3374 invoked by uid 500); 26 May 2008 07:21:45 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 3279 invoked by uid 500); 26 May 2008 07:21:45 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 3268 invoked by uid 99); 26 May 2008 07:21:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 May 2008 00:21:45 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [212.27.42.64] (HELO smtp7-g19.free.fr) (212.27.42.64) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 May 2008 07:20:57 +0000 Received: from smtp7-g19.free.fr (localhost [127.0.0.1]) by smtp7-g19.free.fr (Postfix) with ESMTP id C2BBD322829 for ; Mon, 26 May 2008 09:21:12 +0200 (CEST) Received: from [192.168.23.101] (can06-2-82-244-131-149.fbx.proxad.net [82.244.131.149]) by smtp7-g19.free.fr (Postfix) with ESMTP id 587C13227F9 for ; Mon, 26 May 2008 09:21:12 +0200 (CEST) Message-ID: <483A64E5.70201@free.fr> Date: Mon, 26 May 2008 09:21:09 +0200 From: MENEAULT Maxime User-Agent: Icedove 1.5.0.14pre (X11/20071018) MIME-Version: 1.0 To: dev@httpd.apache.org Subject: [BUG] : pre_config_hook issues Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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. Should I fill-in a bug report? 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,