Received: (qmail 88196 invoked by uid 501); 21 Jun 2001 21:09:46 -0000 Message-Id: <20010621210946.88195.qmail@apache.org> Date: 21 Jun 2001 21:09:46 -0000 From: Taketo Kabe Reply-To: kabe@sra-tohoku.co.jp To: submit@bugz.apache.org Subject: [PATCH] Solaris always logs by GMT timezone X-Send-Pr-Version: 3.110 >Number: 7902 >Category: os-solaris >Synopsis: [PATCH] Solaris always logs by GMT timezone >Confidential: no >Severity: serious >Priority: medium >Responsible: apache >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Thu Jun 21 14:10:01 PDT 2001 >Closed-Date: Fri Jun 22 10:56:26 PDT 2001 >Last-Modified: Fri Jun 22 10:56:26 PDT 2001 >Originator: kabe@sra-tohoku.co.jp >Release: 2.0.18-alpha >Organization: >Environment: SunOS 5.8 Generic_108528-05 sun4u sparc SUNW,Ultra-60 gcc version 2.95.2 19991024 (release) >Description: Solaris doesn't have (struct tm *)->tm_gmtoff, so the server logs were written in GMT regardess of the system timezone. (The well-known Solaris headache) The Solaris-kludge did exist and worked in 2.0.16 of srclib/apr/time/unix/time.c:apr_explode_localtime(), but the code was moved from apr_explode_localtime() to set_xt_gmtoff_from_tm() around version 1.38. So the attached patch will use tm_to_exp() (which calls set_xt_gmtoff_from_tm()) in apr_explode_localtime(), which fixed the problem. Public APR fuction API is not changed. >How-To-Repeat: * Compile on a Solaris2 machine. * Invoke the httpd on a non-GMT timezone environment. * Access the server and see the log; the time is logged in GMT. >Fix: ##dist7 # #****** srclib/apr/time/unix/time.c Solaris-timezone.patch # # Fixes that on Solaris, access_log is always logged in GMT regardess of # timezone setting. (a well-known Solaris thingie) # # The Solaris-kludge was moved from apr_explode_localtime() to # set_xt_gmtoff_from_tm() in v 1.38, so use tm_to_exp() # (which calls set_xt_gmtoff_from_tm()) in apr_explode_localtime(). # /usr/local/gnu/bin/patch -p1 --backup --suffix=.dist7 << 'EOP' =============================== {{ diff -u httpd-2_0_18/srclib/apr/time/unix/time.c.dist7 httpd-2_0_18/srclib/apr/time/unix/time.c --- httpd-2_0_18/srclib/apr/time/unix/time.c.dist7 Thu Apr 19 22:01:06 2001 +++ httpd-2_0_18/srclib/apr/time/unix/time.c Thu Jun 21 17:32:56 2001 @@ -154,25 +154,18 @@ return apr_explode_time(result, input, -timezone); #else time_t mango = input / APR_USEC_PER_SEC; - apr_int32_t offs = 0; #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) struct tm mangotm; localtime_r(&mango, &mangotm); /* XXX - Add support for Solaris */ -#ifdef HAVE_GMTOFF - offs = mangotm.tm_gmtoff; -#elif defined(HAVE___OFFSET) - offs = mangotm.__tm_gmtoff; -#endif +/* kabe: Solaris support is already in set_xt_gmtoff_from_tm(), so use it */ #else /* !APR_HAS_THREADS */ - struct tm *mangotm; - mangotm=localtime(&mango); -#ifdef HAVE_GMTOFF - offs = mangotm->tm_gmtoff; -#endif + struct tm mangotm; + mangotm = *localtime(&mango); #endif - return apr_explode_time(result, input, offs); + tm_to_exp(result, &mangotm, &mango); + return APR_SUCCESS; #endif /* __EMX__ */ } =============================== } EOP >Release-Note: >Audit-Trail: State-Changed-From-To: open-closed State-Changed-By: trawick State-Changed-When: Fri Jun 22 10:56:26 PDT 2001 State-Changed-Why: The patch submitted with this bug report has been committed to APR. The problem with the Apache log will be resolved with the next public release of Apache 2.0. Thank you very much for your work to resolve this problem, and thanks for using Apache! >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]