Bug 56503 - Ifdefine analysis and variable replacements are in wrong order
Summary: Ifdefine analysis and variable replacements are in wrong order
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.4.9
Hardware: Sun Solaris
: P2 minor (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
: 59242 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-05-08 13:43 UTC by inu
Modified: 2016-03-28 16:38 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description inu 2014-05-08 13:43:33 UTC
When a variable is not defined and surounded by a IfDefine (on this variable),
a warning is raised, which is not relevant.

This warning should not appear.
The IfDefine-section have to dropped, in front of the variable replacment. (i think)

Here a simple example.
servername_sso is not defined for this configuration.

# Config
<IfDefine servername_sso>
  <VirtualHost *:80>
    # intern
    ServerName                 ${servername_sso}
    RedirectMatch permanent    ^/$ /auth/login/ssointern
    RedirectMatch permanent    ^/auth/login$ /auth/login/ssointern
  </VirtualHost>
</IfDefine>

# ErrorMessage
[core:warn] [pid 7482] AH00111: Config variable ${servername_sso} is not defined
Comment 1 Christophe JAILLET 2014-07-26 09:41:15 UTC
Confirmed.

This is due to a call to 'ap_resolve_env' in 'ap_soak_end_container()' (config.c)
Comment 2 Edward Lu 2014-07-30 14:32:23 UTC
ap_soak_end_container() throws away anything that isn't a "<Container>" or "</Container>" directive, so the ap_resolve_env() would only have an impact if a var was defined to one of those. I'm not sure if there's any other use cases that I'm missing, but simply removing the ap_resolve_env() call doesn't seem like it would be much of an issue.

An alternative would be to ignore undefined vars in an <IfX> container, but this would require some restructuring of ap_resolve_env(), which currently doesn't have a mechanism for that.
Comment 3 Christophe JAILLET 2014-07-30 19:48:22 UTC
See https://marc.info/?l=apache-httpd-dev&m=140635726532490&w=2 on httpd-dev mailing list.

If no response within the coming weeks, I will apply the change to trunk and propose it to backport for 2.4.x
Comment 4 inu 2014-07-30 20:01:33 UTC
I will try it, this or next week, and give response.

Thanks,
Sascha
Comment 5 inu 2014-08-07 14:31:46 UTC
Ich had tested the httpd 2.4.10 with the given fix on Sparc-Solaris 2.10

Build:         fine
Running:       fine 
               (only short time, but is now in our main test-stage)
Parsed Config: fine
               is identical between 2.4.9 and 2.4.10+fix 
               (checked via info_handler output)

Thanks to team :)


Bye,
Sascha
Comment 6 Christophe JAILLET 2014-10-16 21:54:27 UTC
This has been fixed in 2.4.x in r1621603.

This will be part of 2.4.11
Comment 7 Christophe JAILLET 2016-03-28 16:38:07 UTC
*** Bug 59242 has been marked as a duplicate of this bug. ***