puppetlabs/puppet — pull request #192 by joshcooper (2011-11-01 20:20:09+00:00)
Title: (#9983) Fix file bucketing and remote file sourcing on Windows

Windows has a concept of text and binary modes, whereas Unix only has binary.

On Windows, when a file is written in text mode, newline characters are replaced with carriage-return/newline sequences (\r\n), and the opposite is done when reading files. In binary mode, no such translation takes place.

Previously, Windows agents were unable to restore, backup or source files from/to a non-Windows file server due to the Windows agent performing end-of-line translation and computing a different checksum than the non-Windows server.

This commit enables binary mode in places where the agent is handling arbitrary file content such as filebucketing and sourcing files from remote servers. It does not enable binary mode in places where we want to maintain the native \r\n line endings for configuration files, e.g. c:\windows\system32\drives\etc\hosts.

On Unix, setting binary or text mode on Unix is a noop. It also means users don't have to deploy a new master to serve content to Windows agents.