You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Boris Zentner <bz...@2bz.de> on 2004/04/18 13:58:11 UTC

ht_time and locale

1. Problem Description:

ht_time formats the time with the locale info, that was present at the start 
of the server. Is this desired?

And this breaks the mod_perl tests for apache/util.


export LC_ALL=de_DE
./t/TEST -start-httpd

Apache::warn( Apache::Util::ht_time( $r->pool, time) );
[Sun Apr 18 13:34:37 2004] [warn] So, 18 Apr 2004 11:34:37 GMT

###
export LC_ALL=it_IT
./t/TEST -start-httpd
Apache::warn( Apache::Util::ht_time( $r->pool, time) );
[Sun Apr 18 13:33:18 2004] [warn] dom, 18 apr 2004 11:33:18 GMT

2. Used Components and their Configuration:

*** mod_perl version 1.9914

*** 
using /usr/lib/perl5/site_perl/5.8.1/i586-linux-thread-multi/Apache/BuildConfig.pm
*** Makefile.PL options:
  MP_AP_PREFIX   => /opt/apache2
  MP_COMPAT_1X   => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_USE_DSO     => 1
  MP_USE_STATIC  => 1


*** /opt/apache2/bin/httpd -V
Server version: Apache/2.0.49
Server built:   Apr 17 2004 18:39:13
Server's Module Magic Number: 20020903:7
Architecture:   32-bit
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT="/opt/apache2"
 -D SUEXEC_BIN="/opt/apache2/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"


*** /usr/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.6.0-test3, archname=i586-linux-thread-multi
    uname='linux g8 2.6.0-test3 #1 smp fri nov 14 00:07:01 utc 2003 i686 i686 
i386 gnulinux '
    config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl 
-Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Duseshrplib=true 
-Doptimize=-O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -pipe'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-fno-strict-aliasing'
    ccversion='', gccversion='3.3.1 (SuSE Linux)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =''
    libpth=/lib /usr/lib /usr/local/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic 
-Wl,-rpath,/usr/lib/perl5/5.8.1/i586-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared'


Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES 
PERL_IMPLICIT_CONTEXT
  Built under linux
  Compiled at Dec 10 2003 09:22:12
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /usr/lib/perl5/5.8.1/i586-linux-thread-multi
    /usr/lib/perl5/5.8.1
    /usr/lib/perl5/site_perl/5.8.1/i586-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.1
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.8.1/i586-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.1
    /usr/lib/perl5/vendor_perl
    .

*** Packages of interest status:

Apache::Request: 2.03-dev
CGI            : 3.00
LWP            : 5.76
mod_perl       : 1.9914


3. This is the core dump trace: (if you get a core dump):


This report was generated by /usr/bin/mp2bug on Sun Apr 18 10:32:33 2004 GMT.

-- 
Boris

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: ht_time and locale

Posted by Stas Bekman <st...@stason.org>.
Boris Zentner wrote:
> Hi Stas,
> 
> Am Dienstag, 20. April 2004 01:31 schrieb Stas Bekman:
> 
>>Ouch, can you please submit a patch that works for you? \w+ is good, as I'm
>>afraid we may have similar issues with other languges who may have 4 chars
>>or else. Thanks.
> 
> 
> Here it is. works fine for me.

Thanks, Boris, committed.


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: ht_time and locale

Posted by Boris Zentner <bz...@2bz.de>.
Hi Stas,

Am Dienstag, 20. April 2004 01:31 schrieb Stas Bekman:
> Ouch, can you please submit a patch that works for you? \w+ is good, as I'm
> afraid we may have similar issues with other languges who may have 4 chars
> or else. Thanks.

Here it is. works fine for me.

Index: util.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/response/TestApache/util.pm,v
retrieving revision 1.2
diff -u -r1.2 util.pm
--- util.pm	16 Mar 2004 19:46:13 -0000	1.2
+++ util.pm	19 Apr 2004 23:54:31 -0000
@@ -55,7 +55,7 @@
     Apache::OK;
 }
 
-my $fmtdate_ptn = qr/^\w\w\w, \d\d \w\w\w \d\d\d\d \d\d:\d\d:\d\d/;
+my $fmtdate_ptn = qr/^\w+, \d\d \w+ \d\d\d\d \d\d:\d\d:\d\d/;
 sub time_cmp {
     my($time, $fmtdate, $comment, $exact_match) = @_;
 

-- 
Boris

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: ht_time and locale

Posted by Stas Bekman <st...@stason.org>.
Boris Zentner wrote:
> Hi Stas,
> 
> Am Montag, 19. April 2004 23:38 schrieb Stas Bekman:
> 
>>Boris Zentner wrote:
>>
>>>1. Problem Description:
>>>
>>>ht_time formats the time with the locale info, that was present at the
>>>start of the server. Is this desired?
>>
>>I think yes.
>>
>>
>>>And this breaks the mod_perl tests for apache/util.
>>
>>You didn't show what's failing. That test already does regex mathing
>>instead of comparing the dates. I'm not sure what's wrong, I've tried with
>>en_GB and it worked just fine:
>>
> 
> 
> Ahh sorry, it was so clear for me. That I have it not written explicite.
> For german we have 
> 
> Mo, 19 Apr 2004 23:18:09 GMT
> 
> and the test is about /^\w{3}, \d\d \w{3} \d{4} \d\d:\d\d:\d\d/
> 
> this does not match 'Mo' you can do  
> /^\w{1,3}, \d\d \w{1,3} \d{4} \d\d:\d\d:\d\d/
> 
> or
> 
> /^\w+, \d\d \w+ \d{4} \d\d:\d\d:\d\d/

Ouch, can you please submit a patch that works for you? \w+ is good, as I'm 
afraid we may have similar issues with other languges who may have 4 chars or 
else. Thanks.

Ideally we should pick up the locale setting, generate a real string using it 
and strftime and do the comparison. The problem is that we can't control the 
time that Apache sees, so we can always have a mismatch of 1 and more secs, 
which may completely change the string if it happens at 23:59:59.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: ht_time and locale

Posted by Boris Zentner <bz...@2bz.de>.
Hi Stas,

Am Montag, 19. April 2004 23:38 schrieb Stas Bekman:
> Boris Zentner wrote:
> > 1. Problem Description:
> >
> > ht_time formats the time with the locale info, that was present at the
> > start of the server. Is this desired?
>
> I think yes.
>
> > And this breaks the mod_perl tests for apache/util.
>
> You didn't show what's failing. That test already does regex mathing
> instead of comparing the dates. I'm not sure what's wrong, I've tried with
> en_GB and it worked just fine:
>

Ahh sorry, it was so clear for me. That I have it not written explicite.
For german we have 

Mo, 19 Apr 2004 23:18:09 GMT

and the test is about /^\w{3}, \d\d \w{3} \d{4} \d\d:\d\d:\d\d/

this does not match 'Mo' you can do  
/^\w{1,3}, \d\d \w{1,3} \d{4} \d\d:\d\d:\d\d/

or

/^\w+, \d\d \w+ \d{4} \d\d:\d\d:\d\d/

> LC_ALL=en_GB t/TEST -v apache/util
>
> I don't have it_IT locale installed, so it'd help to see the verbose output
> of this test run.
>
> Thanks Boris.
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Boris

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: ht_time and locale

Posted by Stas Bekman <st...@stason.org>.
Boris Zentner wrote:
> 1. Problem Description:
> 
> ht_time formats the time with the locale info, that was present at the start 
> of the server. Is this desired?

I think yes.

> And this breaks the mod_perl tests for apache/util.

You didn't show what's failing. That test already does regex mathing instead 
of comparing the dates. I'm not sure what's wrong, I've tried with en_GB and 
it worked just fine:

LC_ALL=en_GB t/TEST -v apache/util

I don't have it_IT locale installed, so it'd help to see the verbose output of 
this test run.

Thanks Boris.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org