Bug 716675 - ValueError when formatting time-zone to one that does not exist in TZ environment variable.
Summary: ValueError when formatting time-zone to one that does not exist in TZ environ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: vdsm
Version: 6.1
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Erez Shinan
QA Contact: David Naori
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-26 09:59 UTC by David Naori
Modified: 2011-12-06 07:24 UTC (History)
9 users (show)

Fixed In Version: vdsm-4.9-81.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 07:24:53 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:1782 0 normal SHIPPED_LIVE new packages: vdsm 2011-12-06 11:55:51 UTC

Description David Naori 2011-06-26 09:59:20 UTC
Description of problem:
ValueError when formatting time-zone to one that dose not exist in TZ environment variable.

#  TZ=EST python -c 'import time;print time.strptime("Tue May 10 15:42:40 EST 2011", "%a %b %d %H:%M:%S %Z %Y")'

time.struct_time(tm_year=2011, tm_mon=5, tm_mday=10, tm_hour=15, tm_min=42, tm_sec=40, tm_wday=1, tm_yday=130, tm_isdst=0)

#  TZ=GMT python -c 'import time;print time.strptime("Tue May 10 15:42:40 EST 2011", "%a %b %d %H:%M:%S %Z %Y")'

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.6/_strptime.py", line 454, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/usr/lib64/python2.6/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data 'Tue May 10 15:42:40 EST 2011' does not match format '%a %b %d %H:%M:%S %Z %Y'


Version-Release number of selected component (if applicable):
python-2.6.6-20.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:
strptime %Z should be able to format any time-zone.

Additional info:

Comment 2 Dave Malcolm 2011-07-01 21:42:46 UTC
Quoting http://docs.python.org/library/time.html#time.strptime
"Support for the %Z directive is based on the values contained in tzname and whether daylight is true. Because of this, it is platform-specific except for recognizing UTC and GMT which are always known (and are considered to be non-daylight savings timezones)."

You may want to look at the python-dateutil package; in particular, dateutil.parser.parse

Comment 3 RHEL Program Management 2011-07-01 21:55:12 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.

Comment 4 Dan Kenigsberg 2011-07-03 08:23:51 UTC
Thanks, we'll parse it in vdsm.

Comment 5 Erez Shinan 2011-07-04 08:02:56 UTC
Since the component specifies vdsm, please also specify where in vdsm does this bug occur.

Comment 6 David Naori 2011-07-04 08:23:24 UTC
(In reply to comment #5)
> Since the component specifies vdsm, please also specify where in vdsm does this
> bug occur.

On vdsm startup:

reproduce step:
/etc/init.d/vdsmd restart && tail -f /var/log/vdsm/vdsm.log | grep -A 10 --color ERROR

Thread-18::ERROR::2011-07-04 11:16:44,865::caps::206::root::(kernelDict) kernel build time not found
Traceback (most recent call last):
  File "/usr/share/vdsm/caps.py", line 204, in kernelDict
    t = time.mktime(time.strptime(t, '%a %b %d %H:%M:%S %Z %Y'))
  File "/usr/lib64/python2.6/_strptime.py", line 454, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/usr/lib64/python2.6/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data 'Fri Jun 10 10:54:26 EDT 2011' does not match format '%a %b %d %H:%M:%S %Z %Y'

caps.py + 204
t = time.mktime(time.strptime(t, '%a %b %d %H:%M:%S %Z %Y'))

Comment 7 David Naori 2011-07-05 12:53:08 UTC
http://gerrit.usersys.redhat.com/660

Comment 8 Dan Kenigsberg 2011-07-17 11:48:06 UTC
Bug report changed to ON_QA status by me since Errata System refused to do so.
A QE request has been submitted for advisory RHEA-2011:11186-01
http://errata.devel.redhat.com/errata/show/11186

Comment 9 David Naori 2011-07-18 07:28:53 UTC
Verified vdsm-4.9-82.el6.

kernel': {'release': '158.el6.x86_64', 'buildtime': 1308039694.0, 'version': '2.6.32'}

Comment 10 errata-xmlrpc 2011-12-06 07:24:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2011-1782.html


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