www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Taketo Kabe <k...@sra-tohoku.co.jp>
Subject os-solaris/7902: [PATCH] Solaris always logs by GMT timezone
Date Thu, 21 Jun 2001 21:09:46 GMT

>Number:         7902
>Category:       os-solaris
>Synopsis:       [PATCH] Solaris always logs by GMT timezone
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Jun 21 14:10:01 PDT 2001
>Originator:     kabe@sra-tohoku.co.jp
>Release:        2.0.18-alpha

SunOS 5.8 Generic_108528-05 sun4u sparc SUNW,Ultra-60
gcc version 2.95.2 19991024 (release)


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.


* 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.


#****** 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);
     time_t mango = input / APR_USEC_PER_SEC;
-    apr_int32_t offs = 0;
     struct tm mangotm;
     localtime_r(&mango, &mangotm);
 /* XXX - Add support for Solaris */
-    offs = mangotm.tm_gmtoff;
-#elif defined(HAVE___OFFSET)
-    offs = mangotm.__tm_gmtoff;
+/* kabe: Solaris support is already in set_xt_gmtoff_from_tm(), so use it */
 #else /* !APR_HAS_THREADS */
-    struct tm *mangotm;
-    mangotm=localtime(&mango);
-    offs = mangotm->tm_gmtoff;
+    struct tm mangotm;
+    mangotm = *localtime(&mango);
-    return apr_explode_time(result, input, offs);
+    tm_to_exp(result, &mangotm, &mango);
+    return APR_SUCCESS;
 #endif /* __EMX__ */
=============================== }

 [In order for any reply to be added to the PR database, you need]
 [to include <apbugs@Apache.Org> 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!     ]

View raw message