Skip to content

Commit 42c6d21

Browse files
committed
(#11276) Checksum files in binary mode
Previously, the puppet module tool would checksum a file in text mode. On Windows, this would cause the module tool to report that a module had local changes due to it computing the wrong MD5 checksum (due to File.read translating '\r\n' to '\n'). This commit changes it to read the file in binary mode instead. This has no effect on non-Windows platforms.
1 parent 376dc8b commit 42c6d21

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/puppet/module_tool/checksums.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize(path)
1616

1717
# Return checksum for the +Pathname+.
1818
def checksum(pathname)
19-
return Digest::MD5.hexdigest(pathname.read)
19+
return Digest::MD5.hexdigest(IO.binread(pathname))
2020
end
2121

2222
# Return checksums for object's +Pathname+, generate if it's needed.

0 commit comments

Comments
 (0)