[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2013-12-10 Thread gudge

gudge added the comment:

Will work on this.
Please assign the issue to me.

Instructions before proceeding by Tim Golden(python mailing list):

Having just glanced at that issue, I would point out that there's been a
lot of development around the ssl module for the 3.4 release, so you
definitely want to confirm the issue against the hg tip to ensure it
still applies.

--
nosy: +gudge

___
Python tracker 
<http://bugs.python.org/issue19940>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2013-12-19 Thread gudge

gudge added the comment:

1) Can I get a list of failures. The summary of test results which I compare on 
my machine.

2) 

-
>>> import ssl
>>> ssl.cert_time_to_seconds("May  9 00:00:00 2007 GMT")
1178649000.0
>>> from datetime import datetime
>>> datetime.utcfromtimestamp(1178668800)
datetime.datetime(2007, 5, 9, 0, 0)
>>> import time
>>> time.gmtime(1178668800)
time.struct_time(tm_year=2007, tm_mon=5, tm_mday=9, tm_hour=0, tm_min=0, 
tm_sec=0, tm_wday=2, tm_yday=129, tm_isdst=0)
>>> import calender
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named 'calender'
>>> import callendar
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named 'callendar'
>>> import calendar
>>> calendar.timegm(time.strptime("May 9 00:00:00 2007 GMT", "%b %d %H:%M:%S %Y 
>>> GMT"))
1178668800


I am running a VM on windows host machine.
In your comment ou have specified:

>>> import ssl
>>> ssl.cert_time_to_seconds("May  9 00:00:00 2007 GMT")
1178694000.0

It should be `1178668800`:

But I get also get the same answer with the Python build from latest sources?
Therefore I do not get you?

3)
3 tests omitted:
test___all__ test_site test_urllib2net
348 tests OK.
3 tests failed:
test_codecs test_distutils test_ioctl
2 tests altered the execution environment:
test___all__ test_site
33 tests skipped:
test_bz2 test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp
test_codecmaps_kr test_codecmaps_tw test_curses test_dbm_gnu
test_dbm_ndbm test_devpoll test_gzip test_idle test_kqueue
test_lzma test_msilib test_ossaudiodev test_readline test_smtpnet
test_socketserver test_sqlite test_ssl test_startfile test_tcl
test_timeout test_tk test_ttk_guionly test_ttk_textonly
test_urllibnet test_winreg test_winsound test_xmlrpc_net
test_zipfile64 test_zlib


Are these results fine. These results are with no changes. 
How can I make all tests (skipped and omiited pass)

What about the 3 tests which failed. Are these known failures?

4) 

 Now say I have to pull time again to get the latest code. Does it help
to do a make. Or I will have o do configure again.

5) I had posted a query on core-metorship? No answers? Not that I am entitled 
to.

Thanks

--

___
Python tracker 
<http://bugs.python.org/issue19940>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2013-12-19 Thread gudge

gudge added the comment:

Sorry I think I did not read msg205774 (1st comment) correctly.
It clearly says:

"cert_time_to_seconds() uses `time.mktime()` [1] to convert utc time tuple to 
seconds since epoch. `mktime()` works with local time. It should use 
`calendar.timegm()` analog instead."

So the function cert_time_to_seconds() has to be fixed?

Thanks

--

___
Python tracker 
<http://bugs.python.org/issue19940>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2013-12-19 Thread gudge

gudge added the comment:

Patch is uploaded.
I will also copy paste it.

I have created the patch with git. Let me know if it is okay with you.
 If it is unacceptable I will try and create one for mercury

Patch:
--
diff --combined Doc/library/ssl.rst
index a6ce5d6,30cb732..000
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@@ -366,7 -366,7 +366,7 @@@ Certificate handlin
  
   >>> import ssl
   >>> ssl.cert_time_to_seconds("May  9 00:00:00 2007 GMT")
 - 1178694000.0
 + 1178668800 
   >>> import time
   >>> time.ctime(ssl.cert_time_to_seconds("May  9 00:00:00 2007 GMT"))
   'Wed May  9 00:00:00 2007'
diff --combined Lib/ssl.py
index f81ef91,052a118..000
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@@ -852,8 -852,7 +852,8 @@@ def cert_time_to_seconds(cert_time)
  a Python time value in seconds past the epoch."""
  
  import time
 -return time.mktime(time.strptime(cert_time, "%b %d %H:%M:%S %Y GMT"))
 +import calendar 
 +return calendar.timegm(time.strptime(cert_time, "%b %d %H:%M:%S %Y GMT"))
  
  PEM_HEADER = "-BEGIN CERTIFICATE-"
  PEM_FOOTER = "-END CERTIFICATE-"

-

Test Results:
358 tests OK.
1 test failed:
test_compileall
1 test altered the execution environment:
test___all__
28 tests skipped:
test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp
test_codecmaps_kr test_codecmaps_tw test_curses test_dbm_gnu
test_dbm_ndbm test_devpoll test_idle test_kqueue test_lzma
test_msilib test_ossaudiodev test_smtpnet test_socketserver
test_sqlite test_startfile test_tcl test_timeout test_tk
test_ttk_guionly test_ttk_textonly test_urllibnet test_winreg
test_winsound test_xmlrpc_net test_zipfile64


Doc changes won't effect the code. The tests would not fail. 
How would I check if the doc changes are coming up fine in the 
final version.

>>> import ssl
>>> ssl.cert_time_to_seconds("May  9 00:00:00 2007 GMT")
1178668800


I do not have a printer curretly. I will sign the license agreement 
in a few days.

--
Added file: http://bugs.python.org/file33217/patch.txt

___
Python tracker 
<http://bugs.python.org/issue19940>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2013-12-21 Thread gudge

gudge added the comment:

Akira, I will fix it. I will put in the patch in the same bug.

--

___
Python tracker 
<http://bugs.python.org/issue19940>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2013-12-22 Thread gudge

gudge added the comment:

1) I understand I can run a whole test suite as
./python -m test -v test_abc
as mentioned in
http://docs.python.org/devguide/runtests.html

How do I run a particluar test case, like the test I added
test_cert_time_to_seconds

2) I have a added a test case test_cert_time_to_seconds to test_ssl.py. 
3) ./python -m test -v test_ssl
   is all PASS.

4) I will start my work on http://bugs.python.org/issue19940#msg205860.

5) The patch is attached.

--
Added file: http://bugs.python.org/file33254/patch.txt

___
Python tracker 
<http://bugs.python.org/issue19940>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19940] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC

2013-12-29 Thread gudge

gudge added the comment:

Can you please provide some hints on how to handle
http://bugs.python.org/issue19940#msg205860.

The value of format_regex

1) Without locale set:
re.compile('(?Pjan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\s+(?P3[0-1]|[1-2]\\d|0[1-
9]|[1-9]| 
[1-9])\\s+(?P2[0-3]|[0-1]\\d|\\d):(?P[0-5]\\d|\\d):(?P6[0-1]|[0-5]\\d|\\d)\\s
+(?P\\d\\d\\d\\d, re.IGNORECASE)

2) With locale set:
re.compile('(?Psty|lut|mar|kwi|maj|cze|lip|sie|wrz|pa\\ΕΊ|lis|gru)\\s+(?P3[0-1]|[1-2]\\d|0[
1-9]|[1-9]| 
[1-9])\\s+(?P2[0-3]|[0-1]\\d|\\d):(?P[0-5]\\d|\\d):(?P6[0-1]|[0-5]\\d|\\d)\
\s+(?P\\d\\d\\d\, re.IGNORECASE)

The value of months are different.

Thanks

--

___
Python tracker 
<http://bugs.python.org/issue19940>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com