Skip to content
Snippets Groups Projects
Commit ed1a2121 authored by Katsunori FUJIWARA's avatar Katsunori FUJIWARA
Browse files

subrepo: open files in 'rb' mode to read exact data in (issue3926)

Before this patch, "subrepo._calcfilehash()" opens files by "open()"
without any mode specification. This implies "text mode" on Windows.

When target file contains '\x00' byte, "read()" in "text mode" reads
file contents in without data after '\x00'.

This causes invalid SHA1 hash calculation in "subrepo._calcfilehash()".

This patch opens files in 'rb' mode to read exact data in.
parent 0a12e5f3
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@
def _calcfilehash(filename):
data = ''
if os.path.exists(filename):
fd = open(filename)
fd = open(filename, 'rb')
data = fd.read()
fd.close()
return util.sha1(data).hexdigest()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment