You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <d....@daniel.shahaf.name> on 2012/01/16 21:25:19 UTC

Re: svn commit: r1232085 - /subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c

Thanks for the fix.  I saw some discussion on IRC -- are there outstanding problems not addressed by the below commit?

On Mon, Jan 16, 2012, at 18:08, neels@apache.org wrote:
> Author: neels
> Date: Mon Jan 16 18:08:13 2012
> New Revision: 1232085
> 
> URL: http://svn.apache.org/viewvc?rev=1232085&view=rev
> Log:
> * contrib/server-side/mod_setlocale/mod_setlocale.c
>   (setlocale_post_config): Disallow a set_ctype of NULL, use "" instead.
> Found by: philip
> 
> Modified:
>     subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c
> 
> Modified: subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c?rev=1232085&r1=1232084&r2=1232085&view=diff
> ==============================================================================
> --- subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c (original)
> +++ subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c Mon Jan 16 18:08:13 2012
> @@ -86,6 +86,16 @@ setlocale_post_config(apr_pool_t *pconf,
>        return HTTP_INTERNAL_SERVER_ERROR;
>      }
>  
> +  /* If the user omitted a configuration directive, then set_ctype will be
> +   * NULL.  Below condition sets it to "" instead, which loads the default as
> +   * determined by the environment.  httpd's env is typically set by
> +   * /etc/apache2/envvars, where LANG defaults to 'C', but it can be set to
> +   * the system default there by sourcing the system's config file (e.g. '.
> +   * /etc/default/locale'). Then, it suffices to just load this module to
> +   * obtain the system's default locale. */
> +  if (cfg->set_ctype == NULL)
> +    cfg->set_ctype = "";
> +
>    cfg->old_ctype = setlocale(LC_CTYPE, cfg->set_ctype);
>    if (cfg->old_ctype)
>      {
> 
> 
> 

Re: svn commit: r1232085 - /subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c

Posted by Philip Martin <ph...@wandisco.com>.
Daniel Shahaf <d....@daniel.shahaf.name> writes:

> Specifically, I saw mentions of segfaults in backscroll,

I don't think it's mod_setlocale that is resposible.  I get an httpd
SEGV when I use setlocale, instead of setlocale_module, in the
LoadModule line:

[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
load_module (cmd=0x7fffffffe550, dummy=<value optimized out>, 
    modname=0x7ffff8265690 "setlocale", filename=<value optimized out>)
    at /build/buildd-apache2_2.2.16-6+squeeze4-amd64-pXldSC/apache2-2.2.16/modules/mappers/mod_so.c:263
263     /build/buildd-apache2_2.2.16-6+squeeze4-amd64-pXldSC/apache2-2.2.16/modules/mappers/mod_so.c: No such file or directory.
        in /build/buildd-apache2_2.2.16-6+squeeze4-amd64-pXldSC/apache2-2.2.16/modules/mappers/mod_so.c


-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com

Re: svn commit: r1232085 - /subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Specifically, I saw mentions of segfaults in backscroll, but I don't
think this commit prevents any segfaults.. (both setlocale() and ap_log_error()
would handle a NULL argument here)

On Mon, Jan 16, 2012, at 22:25, Daniel Shahaf wrote:
> Thanks for the fix.  I saw some discussion on IRC -- are there
> outstanding problems not addressed by the below commit?
> 
> On Mon, Jan 16, 2012, at 18:08, neels@apache.org wrote:
> > Author: neels
> > Date: Mon Jan 16 18:08:13 2012
> > New Revision: 1232085
> > 
> > URL: http://svn.apache.org/viewvc?rev=1232085&view=rev
> > Log:
> > * contrib/server-side/mod_setlocale/mod_setlocale.c
> >   (setlocale_post_config): Disallow a set_ctype of NULL, use "" instead.
> > Found by: philip
> > 
> > Modified:
> >     subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c
> > 
> > Modified: subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c
> > URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c?rev=1232085&r1=1232084&r2=1232085&view=diff
> > ==============================================================================
> > --- subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c (original)
> > +++ subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c Mon Jan 16 18:08:13 2012
> > @@ -86,6 +86,16 @@ setlocale_post_config(apr_pool_t *pconf,
> >        return HTTP_INTERNAL_SERVER_ERROR;
> >      }
> >  
> > +  /* If the user omitted a configuration directive, then set_ctype will be
> > +   * NULL.  Below condition sets it to "" instead, which loads the default as
> > +   * determined by the environment.  httpd's env is typically set by
> > +   * /etc/apache2/envvars, where LANG defaults to 'C', but it can be set to
> > +   * the system default there by sourcing the system's config file (e.g. '.
> > +   * /etc/default/locale'). Then, it suffices to just load this module to
> > +   * obtain the system's default locale. */
> > +  if (cfg->set_ctype == NULL)
> > +    cfg->set_ctype = "";
> > +
> >    cfg->old_ctype = setlocale(LC_CTYPE, cfg->set_ctype);
> >    if (cfg->old_ctype)
> >      {
> > 
> > 
> > 
> 

Re: svn commit: r1232085 - /subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Specifically, I saw mentions of segfaults in backscroll, but I don't
think this commit prevents any segfaults.. (both setlocale() and ap_log_error()
would handle a NULL argument here)

On Mon, Jan 16, 2012, at 22:25, Daniel Shahaf wrote:
> Thanks for the fix.  I saw some discussion on IRC -- are there
> outstanding problems not addressed by the below commit?
> 
> On Mon, Jan 16, 2012, at 18:08, neels@apache.org wrote:
> > Author: neels
> > Date: Mon Jan 16 18:08:13 2012
> > New Revision: 1232085
> > 
> > URL: http://svn.apache.org/viewvc?rev=1232085&view=rev
> > Log:
> > * contrib/server-side/mod_setlocale/mod_setlocale.c
> >   (setlocale_post_config): Disallow a set_ctype of NULL, use "" instead.
> > Found by: philip
> > 
> > Modified:
> >     subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c
> > 
> > Modified: subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c
> > URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c?rev=1232085&r1=1232084&r2=1232085&view=diff
> > ==============================================================================
> > --- subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c (original)
> > +++ subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c Mon Jan 16 18:08:13 2012
> > @@ -86,6 +86,16 @@ setlocale_post_config(apr_pool_t *pconf,
> >        return HTTP_INTERNAL_SERVER_ERROR;
> >      }
> >  
> > +  /* If the user omitted a configuration directive, then set_ctype will be
> > +   * NULL.  Below condition sets it to "" instead, which loads the default as
> > +   * determined by the environment.  httpd's env is typically set by
> > +   * /etc/apache2/envvars, where LANG defaults to 'C', but it can be set to
> > +   * the system default there by sourcing the system's config file (e.g. '.
> > +   * /etc/default/locale'). Then, it suffices to just load this module to
> > +   * obtain the system's default locale. */
> > +  if (cfg->set_ctype == NULL)
> > +    cfg->set_ctype = "";
> > +
> >    cfg->old_ctype = setlocale(LC_CTYPE, cfg->set_ctype);
> >    if (cfg->old_ctype)
> >      {
> > 
> > 
> > 
>