Wednesday, February 11, 2004
Apache time zone logging bug
My Apache 2.0.40 server on Red Hat 9 is writing logs like this:
161.74.11.24 - - [10/Feb/2004:05:29:46 051800] "GET /pics/lj HTTP/1.1" 200 8122 "-" "Mozilla/3.01 (compatible;)"
Notice the weird time zone. This is a bug that was fixed in 1996, seven years ago. Why is it showing up now? Is anyone else seeing this?
Update: This bug has already been fixed (again). Now to find RH compatible packages of 2.0.48.
Update 2: I back-ported the fix to RH’s packages. Here is how you patch your copy:
161.74.11.24 - - [10/Feb/2004:05:29:46 051800] "GET /pics/lj HTTP/1.1" 200 8122 "-" "Mozilla/3.01 (compatible;)"
Notice the weird time zone. This is a bug that was fixed in 1996, seven years ago. Why is it showing up now? Is anyone else seeing this?
Update: This bug has already been fixed (again). Now to find RH compatible packages of 2.0.48.
Update 2: I back-ported the fix to RH’s packages. Here is how you patch your copy:
Step 1: Install the httpd SRPM. I used apt-get source httpd.
Step 2: Create /usr/src/redhat/SOURCES/httpd-2.0.40-timezone.patch:
--- httpd-2.0.40/modules/loggers/mod_log_config.c-original 2004-02-11 12:23:05.000000000 0530
httpd-2.0.40/modules/loggers/mod_log_config.c 2004-02-11 12:24:48.000000000 0530
@@ -533,7 533,7 @@
"[d/%s/%d:d:d:d %c%.2d%.2d]",
xt.tm_mday, apr_month_snames[xt.tm_mon],
xt.tm_year 1900, xt.tm_hour, xt.tm_min, xt.tm_sec,
- sign, timz / (60*60), timz % (60*60));
sign, timz / (60*60), (timz % (60*60))/60);
cached_time->t_validate = t_seconds;
memcpy(&(request_time_cache[i]), cached_time,
sizeof(*cached_time));
Step 3: Patch /usr/src/redhat/SPECS/httpd.spec:
--- httpd.spec-original 2004-02-11 12:32:03.000000000 0530
httpd.spec 2004-02-11 12:43:13.000000000 0530
@@ -10,7 10,7 @@
Summary: Apache HTTP Server
Name: httpd
Version: 2.0.40
-Release: 21.9
Release: 21.9jck
URL: http://httpd.apache.org/
Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.gz
Source1: index.html
@@ -142,6 142,7 @@
%patch31 -p1 -b .include
%patch32 -p1 -b .graceful
%patch33 -p1 -b .rand
%patch34 -p1 -b .timezone
%patch40 -p0 -b .cnfdir
%patch41 -p0 -b .redhat
Step 4: Rebuild Apache with rpmbuild -ba /usr/src/redhat/SPECS/httpd.spec and upgrade.
fatmuttony — Feb 11, 2004 4:17:01 AM — # ↩
Any trishuls on your shoulder? Bhaiyya?
Kiran Jonnalagadda — Feb 11, 2004 5:06:09 AM — # ↩
No trishuls, but a couple of scratches on my left shoulder. You have them too?
fatmuttony — Feb 11, 2004 6:55:28 AM — # ↩
All I have are emabarrassing stretch marks, tertimony of my accelerated growth.
ashwinne — Feb 11, 2004 11:58:47 AM — # ↩
Any idea why they did the same mistake again? Due to the major rewrite they did for Apache2?
Kiran Jonnalagadda — Feb 11, 2004 1:52:00 PM — # ↩
I guess they're just not used to dealing with fractional time zones, because there are so few of them. The only places I can remember are India, Nepal and one zone in Australia.
Zope did it wrong too for several years.