Commit 6c308b99 authored by tlotze's avatar tlotze

fixed: The download API computed MD5 checksums of text files wrong on Windows.

git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@104041 62d5b8a3-27da-0310-9561-8e5933582275
parent 3ff2393d
...@@ -9,6 +9,8 @@ Bugs fixed: ...@@ -9,6 +9,8 @@ Bugs fixed:
- Incrementing didn't work properly when extending multiple files. - Incrementing didn't work properly when extending multiple files.
https://bugs.launchpad.net/zc.buildout/+bug/421022 https://bugs.launchpad.net/zc.buildout/+bug/421022
- The download API computed MD5 checksums of text files wrong on Windows.
1.4.1 (2009-08-27) 1.4.1 (2009-08-27)
================== ==================
......
...@@ -223,7 +223,7 @@ def check_md5sum(path, md5sum): ...@@ -223,7 +223,7 @@ def check_md5sum(path, md5sum):
if md5sum is None: if md5sum is None:
return True return True
f = open(path) f = open(path, 'rb')
checksum = md5() checksum = md5()
try: try:
chunk = f.read(2**16) chunk = f.read(2**16)
......
...@@ -523,6 +523,21 @@ False ...@@ -523,6 +523,21 @@ False
True True
Regressions
-----------
MD5 checksum calculation needs to be reliable on all supported systems, which
requires text files to be treated as binary to avoid implicit line-ending
conversions:
>>> text = 'First line of text.\r\nSecond line.\r\n'
>>> f = open(join(server_data, 'foo.txt'), 'wb')
>>> f.write(text)
>>> f.close()
>>> path, is_temp = Download()(server_url+'foo.txt', md5(text).hexdigest())
>>> remove(path)
Clean up Clean up
-------- --------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment