Bug 149296 - Timezone ignored when placing date/time into output html
Timezone ignored when placing date/time into output html
Product: Fedora
Classification: Fedora
Component: mrtg (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Miloslav Trmač
Depends On:
  Show dependency treegraph
Reported: 2005-02-21 20:55 EST by Valeriy Kondrashov
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 2.11.1-3
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-03-13 07:10:39 EST
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 16:00 EST, Miloslav Trmač
no flags Details | Diff

  None (edit)
Description Valeriy Kondrashov 2005-02-21 20:55:30 EST
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 03:03:51 EST
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 08:18:38 EST
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 16:00:39 EST
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 07:10:39 EST
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.