Re: [patch] overriding per directory PerlSetEnv (including bugreport)
much more well understood this time. thank you. the developers monitor this list - so if your patch has merit, i'm sure they will either commit it or something similar. YAMAMOTO Kengo wrote: > Thank you responding. > > On Thu, 4 Oct 2001 13:48:19 -0400, > Robert Landrum <[EMAIL PROTECTED]> wrote: > > Couldn't you do the same thing by reversing the ordering of your > > Directory entries... > > On Thu, 04 Oct 2001 10:43:31 -0700, > ___cliff rayman___ <[EMAIL PROTECTED]> wrote: > > i don't think it is supposed to work this way according to the > > apache documentation. if you want the most specific (longest) one > > to take precedence, put it before the shorter one in the config file. > > Rewriting config file so takes no effect (had tested) because > Apache reorders section config with most specific to > least specific order (by ap_core_reorder_directories()) precede > merging these configs by directory_walk(). > > It seems that I had explained my intention not enough in last > mail. I had written the patch to solve following problem. > > (1) Since perl_merge_dir_config() uses ap_overlay_tables() to > merge PerlSetEnv variables, overridden variables remains in > the table as association list elements (internal > representation of Apache's table). > > (2) The table remains precedences and consistency kept while > manipulated by Apache's standard table APIs > (e.g. ap_table_get()). > > (3) Although (2), mod_perl scans through internal structure of > the table directly as association list to dumps variables > into %ENV by mod_perl_dir_env(). This causes precedence > reversed on dumped %ENV variables because the list elements > is ordered by descending precedence. > > Above process results that PerlSetEnv always activates least > specific section value. It's a real bug. > > My patch modifies (3) by reverses iterating direction on dump. > I would like the patch to be tested by someone else and included > in the mod_perl distribution. Please help! > > > YAMAMOTO Kengo wrote: > > > > > I think that per directory PerlSetEnv variable should be > > > overridden by the value that in the most specific(longest) > > > section. > > > > > > http://localhost/cgi-bin/subdir/printenv with following config > > > will generate VAR="/usr/local/apache/cgi-bin/subdir", but > > > generated result is VAR="/usr/local/apache/cgi-bin". > > > > > > > > > PerlSetEnv VAR /usr/local/apache/cgi-bin > > > > > > > > > > > > PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir > > > > > - > YAMAMOTO Kengo [EMAIL PROTECTED] -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/
Re: [patch] overriding per directory PerlSetEnv (including bugreport)
Thank you responding. On Thu, 4 Oct 2001 13:48:19 -0400, Robert Landrum <[EMAIL PROTECTED]> wrote: > Couldn't you do the same thing by reversing the ordering of your > Directory entries... On Thu, 04 Oct 2001 10:43:31 -0700, ___cliff rayman___ <[EMAIL PROTECTED]> wrote: > i don't think it is supposed to work this way according to the > apache documentation. if you want the most specific (longest) one > to take precedence, put it before the shorter one in the config file. Rewriting config file so takes no effect (had tested) because Apache reorders section config with most specific to least specific order (by ap_core_reorder_directories()) precede merging these configs by directory_walk(). It seems that I had explained my intention not enough in last mail. I had written the patch to solve following problem. (1) Since perl_merge_dir_config() uses ap_overlay_tables() to merge PerlSetEnv variables, overridden variables remains in the table as association list elements (internal representation of Apache's table). (2) The table remains precedences and consistency kept while manipulated by Apache's standard table APIs (e.g. ap_table_get()). (3) Although (2), mod_perl scans through internal structure of the table directly as association list to dumps variables into %ENV by mod_perl_dir_env(). This causes precedence reversed on dumped %ENV variables because the list elements is ordered by descending precedence. Above process results that PerlSetEnv always activates least specific section value. It's a real bug. My patch modifies (3) by reverses iterating direction on dump. I would like the patch to be tested by someone else and included in the mod_perl distribution. Please help! > YAMAMOTO Kengo wrote: > > > I think that per directory PerlSetEnv variable should be > > overridden by the value that in the most specific(longest) > > section. > > > > http://localhost/cgi-bin/subdir/printenv with following config > > will generate VAR="/usr/local/apache/cgi-bin/subdir", but > > generated result is VAR="/usr/local/apache/cgi-bin". > > > > > > PerlSetEnv VAR /usr/local/apache/cgi-bin > > > > > > > > PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir > > - YAMAMOTO Kengo [EMAIL PROTECTED]
Re: [patch] overriding per directory PerlSetEnv
Couldn't you do the same thing by reversing the ordering of your Directory entries... > >PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir > > > >PerlSetEnv VAR /usr/local/apache/cgi-bin > Rob At 1:08 AM +0900 10/5/01, YAMAMOTO Kengo wrote: >Hi, > >I rescently started to use mod_perl. It works fine, but a >strange behavior have found. I have written a patch that collect >the behavior. Please comment this. > >I think that per directory PerlSetEnv variable should be >overridden by the value that in the most specific(longest) > section. > >http://localhost/cgi-bin/subdir/printenv with following config >will generate VAR="/usr/local/apache/cgi-bin/subdir", but >generated result is VAR="/usr/local/apache/cgi-bin". > > >PerlSetEnv VAR /usr/local/apache/cgi-bin > > > >PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir > > > >Following patch corrects this behavior by modify overriding >logic. It seems work well. > > >--- mod_perl-1.26/src/modules/perl/perl_config.c.orig Thu Oct 4 >09:31:00 2001 >+++ mod_perl-1.26/src/modules/perl/perl_config.c Thu Oct 4 >09:32:04 2001 >@@ -183,7 +183,8 @@ > table_entry *elts = (table_entry *)arr->elts; > > int i; >- for (i = 0; i < arr->nelts; ++i) { >+ /* iterate in reverse order to override duplicate key properly */ >+ for (i = arr->nelts - 1; 0 <= i; --i) { > MP_TRACE_d(fprintf(stderr, "mod_perl_dir_env: %s=`%s'", >elts[i].key, elts[i].val)); > mp_setenv(elts[i].key, elts[i].val); > > >I'm not familar with mod_perl internals and community. Please >tell me relative topics, more appropriate place to send patch, >etc. > ># Make my English writing correct is also welcome :-) > >- >YAMAMOTO Kengo [EMAIL PROTECTED] -- "Only two things are infinite: The universe, and human stupidity. And I'm not sure about the former." --Albert Einstein
Re: [patch] overriding per directory PerlSetEnv
i don't think it is supposed to work this way according to the apache documentation. if you want the most specific (longest) one to take precedence, put it before the shorter one in the config file. the relevant documenation is here: http://httpd.apache.org/docs/sections.html YAMAMOTO Kengo wrote: > I think that per directory PerlSetEnv variable should be > overridden by the value that in the most specific(longest) > section. > > http://localhost/cgi-bin/subdir/printenv with following config > will generate VAR="/usr/local/apache/cgi-bin/subdir", but > generated result is VAR="/usr/local/apache/cgi-bin". > > > PerlSetEnv VAR /usr/local/apache/cgi-bin > > > > PerlSetEnv VAR /usr/local/apache/cgi-bin/subdir > > -- ___cliff [EMAIL PROTECTED]http://www.genwax.com/