Bug 149296 - Timezone ignored when placing date/time into output html
Summary: Timezone ignored when placing date/time into output html
Alias: None
Product: Fedora
Classification: Fedora
Component: mrtg   
(Show other bugs)
Version: 3
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Miloslav Trmač
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-02-22 01:55 UTC by Valeriy Kondrashov
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version: 2.11.1-3
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-03-13 12:10:39 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Call tzset () when changing $ENV{'TZ'} (932 bytes, patch)
2005-03-01 21:00 UTC, Miloslav Trmač
no flags Details | Diff

Description Valeriy Kondrashov 2005-02-22 01:55:30 UTC
Description of problem:
"mrtg.cfg" contains "Timezone[target]: Earth/Place".
When generating output HTML document, MRTG ignores timezone in 
When calling rateup, timezone correctly used inside graph.

Library /usr/lib/mrtg2/MRTG_lib.pm contains "datestr" sub.
This sub is called out of "writehtml".
"perl -d" shows, that before entering "localtime()" $ENV{TZ}
contains different timezone, than system's one.
But localtime() returns time, converted with system's /etc/localtime.
"strace" shows, that file "/etc/localtime" is opened.

Code cut to test perl program shows, that in normal case TZ= is used.
"strace" shows, that file "/usr/share/zoneinfo/Earth/Place" is opened.

Version-Release number of selected component (if applicable):

How reproducible:
Every time

Steps to Reproduce:
1. Use cfgmaker to produce simple interface config
2. Add Timezone[target]: Asia/Novosibirsk
3. Add "pngdate" to list of target options
4. Invoke MRTG "/usr/bin/mrtg <cfg>"
5. Take a lookup on output HTML in browser.

Actual results:
"The statistics were last updated" part has system's localtime.
PNG picture has different time.

Expected results:
"The statistics were last updated" part must have the same
time representation as on PNG picture.

Additional info:
Problem may be
1) in mrtg, garbaging memory
2) in perl-lib, not putting TZ=Earth/Place in libc's envp[]

Comment 1 Valeriy Kondrashov 2005-02-25 08:03:51 UTC
After a fresh installation, there is no such bug in MRTG.
This bug appears after "prelink" has been run.

Comment 2 Miloslav Trmač 2005-03-01 13:18:38 UTC
Reproduced here (rawhide mrtg-2.1.11-1).
Does the bug really not occur after a fresh installation, when the system
timezone is different from the mrtg-configured timezone?

Comment 3 Miloslav Trmač 2005-03-01 21:00:39 UTC
Created attachment 111550 [details]
Call tzset () when changing $ENV{'TZ'}

The attached patch was sent upstream.

(I'm almost sure prelink has nothing to do with this.)

Comment 4 Miloslav Trmač 2005-03-13 12:10:39 UTC
Fixed in mrtg-2.1.11-3, which should appear in rawhide after FC4t1 is released.
Thanks for your report.

Note You need to log in before you can comment on or make changes to this bug.