[asterisk-bugs] [Asterisk 0014300]: [patch] zoneinfo caching causes incorrect time
Asterisk Bug Tracker
noreply at bugs.digium.com
Wed Feb 25 10:09:58 CST 2009
The following issue has been ASSIGNED.
======================================================================
http://bugs.digium.com/view.php?id=14300
======================================================================
Reported By: jamessan
Assigned To: tilghman
======================================================================
Project: Asterisk
Issue ID: 14300
Category: Core/General
Reproducibility: always
Severity: minor
Priority: normal
Status: assigned
Asterisk Version: 1.4.22
Regression: No
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Request Review:
======================================================================
Date Submitted: 2009-01-21 14:05 CST
Last Modified: 2009-02-25 10:09 CST
======================================================================
Summary: [patch] zoneinfo caching causes incorrect time
Description:
In stdtime/localtime.c, the information for time-zones are cached in a
state struct. This caching is keyed off the name of the zone passed into
ast_tzset (using /etc/localtime if none is provided).
This is problematic since it isn't uncommon for the localtime file to be a
symlink to/copy of the actual zoneinfo file. Therefore, if the target of
the symlink is changed to affect a change in the system's timezone,
Asterisk will not recognize the change until it is restarted.
The attached patch uses realpath(3) to attempt expanding the zone to a
full path and using that as the key instead. This will ensure that if a
path like "/etc/localtime" or "/usr/share/zoneinfo/localtime" is being used
and is a symlink, changes in the target of the symlink will cause the
zoneinfo to be updated.
The limitations of this patch are:
1) Only notices changes when symlinks are used. If "/etc/localtime" (or
whatever the common file is) is a copy/hardlink instead, changes won't be
noticed. Making use of lstat(2) instead of realpath(3) may be an approach
to consider.
2) It doesn't handle the condition where zone is passed to ast_tzset and
is using a relative path and/or the zone contains a leading colon. There's
code in tzload that determines the absolute path which could be pulled out
into a common function. Feeding the results of that into realpath(3) would
then handle the different formats that the zone could be specified in.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2009-02-25 10:09 tilghman Status ready for testing =>
assigned
2009-02-25 10:09 tilghman Assigned To lmadsen => tilghman
======================================================================
More information about the asterisk-bugs
mailing list