quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory (Grisha) Trubetskoy" <gri...@apache.org>
Subject Re: [jira] Commented: (MODPYTHON-4) Bug in setting up of config_dir from Handler directives.
Date Wed, 19 Jan 2005 22:03:42 GMT

No reason to keep it around if it's not used anywhere.

I wonder why SLASH was there in the first place... perhaps from apache 
1.3...


On Wed, 19 Jan 2005, Nicolas Lehuen (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/MODPYTHON-4?page=comments#action_57787 ]
>
> Nicolas Lehuen commented on MODPYTHON-4:
> ----------------------------------------
>
> I have checked that the SLASH and SLASH_S macros, defined in mod_python.h, are not used
elsewhere. So what I propose is that we just remove the #ifdef WIN32 block at lines 94-100
of mod_python.h and just define SLASH and SLASH_S inconditionnaly :
>
> Index: mod_python.h
> ===================================================================
> --- mod_python.h	(revision 125635)
> +++ mod_python.h	(working copy)
> @@ -91,13 +91,12 @@
> #define MODULENAME "mod_python.apache"
> #define INITFUNC "init"
> #define MAIN_INTERPRETER "main_interpreter"
> -#ifdef WIN32
> -#define SLASH '\\'
> -#define SLASH_S "\\"
> -#else
> +
> +/** Note : as Apache give POSIX paths, there is no need to
> +    differentiate here between UNIX and WIN32 path separators */
> #define SLASH '/'
> #define SLASH_S "/"
> -#endif
> +
> /* used in python_directive_handler */
> #define SILENT 0
> #define NOTSILENT 1
>
> Does everybody else agree ?
>
>
>> Bug in setting up of config_dir from Handler  directives.
>> ---------------------------------------------------------
>>
>>          Key: MODPYTHON-4
>>          URL: http://issues.apache.org/jira/browse/MODPYTHON-4
>>      Project: mod_python
>>         Type: Bug
>>     Versions: 3.1.3
>>  Environment: Win32
>>     Reporter: Graham Dumpleton
>>     Priority: Minor
>
>>
>> The problem is that mod_python doesn't seem to take into account that the
>> directory is given to it by Apache in POSIX directory naming convention.
>> Instead, because mod_python knows it is on Win32, it looks for a trailing '\'
>> and since it doesn't see one, because it is actually '/', it goes and adds a '\'.
>> The code in mod_python.c is:
>> static void *python_create_dir_config(apr_pool_t *p, char *dir)
>> {
>>
>>     py_config *conf = python_create_config(p);
>>
>>     /* make sure directory ends with a slash */
>>     if (dir && (dir[strlen(dir) - 1] != SLASH))
>>         conf->config_dir = apr_pstrcat(p, dir, SLASH_S, NULL);
>>     else
>>         conf->config_dir = apr_pstrdup(p, dir);
>>
>>     return conf;
>> }
>> It should in this case ignore whether it is on Win32 and instead use:
>> static void *python_create_dir_config(apr_pool_t *p, char *dir)
>> {
>>
>>     py_config *conf = python_create_config(p);
>>
>>     /* make sure directory ends with a slash */
>>     if (dir && (dir[strlen(dir) - 1] != '/'))
>>         conf->config_dir = apr_pstrcat(p, dir, "/", NULL);
>>     else
>>         conf->config_dir = apr_pstrdup(p, dir);
>>
>>     return conf;
>> }
>> Code change not personally tested as don't have Win32 machine.
>> See thread on mailing list for full discussion of issue.
>>   http://www.modpython.org/pipermail/mod_python/2004-November/016784.html
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>   http://issues.apache.org/jira/secure/Administrators.jspa
> -
> If you want more information on JIRA, or have a bug to report see:
>   http://www.atlassian.com/software/jira
>

Mime
View raw message