Hi, 

 When using the following script under mod_perl, each httpd process crashes on
the 2nd request to execute this script.
------------ 
#!/usr/bin/perl 
use strict; use POSIX qw(locale_h); 
setlocale(LC_ALL,'en_US.utf8'); 
print "Expires: 1 Jan 1970\nContent-Type: text/html\n\nHi"; 
-------------
 This crashes if instead of 'en_US.utf8' one uses any other utf8 locale that
is available in the system. If one uses locale with single-byte encoding (e.g. 
'en_US.ascii' or 'ru_RU.koi8r') it doesn't crash httpd. (I didn't try
other multibyte encodings beside utf8).

 If one uses LC_COLLATE instead of LC_ALL, it doesn't crash for any locale (I
didn't try other locale categories).  (The httpd server is started under
locale 'ru_RU.koi8r' - a single-byte locale).

 I'm using mod_perl on RH72 for x86, versions of the relevant software:
perl-5.6.0-17
mod_perl-1.24_01-3
glibc-2.2.4-19.3
apache-1.3.20-16


 It seems it's a bug in mod_perl, since the following C program
----------
#include <locale.h>
#include <stdlib.h>

int main(int argc,char** argv)
{
    setlocale(LC_ALL,"en_US.utf8");
    printf("try 1\n");

    setlocale(LC_ALL,"en_US.utf8");
    printf("try 2\n");

    setlocale(LC_ALL,"en_US.utf8");
    printf("try 3\n");
    return 0;
}
------------
 Works without crashing.

 Also, the following perl script:
------------
#!/usr/bin/perl
use strict;
use POSIX qw(locale_h);
for(my $i=0;$i<10; ++$i)
{
    setlocale(LC_ALL,'en_US.utf8');
}
print "done\n";
------------
 Works without crashing too.

 Granted, LC_COLLATE it's enough for my scripts, so this bug is not fatal to
me.

 Best regards,
  -Vlad

Reply via email to