From this I can see that PBD::copy_file is not working correctly on windows as it is adding windows style line endings. Adding O_BINARY to ::open flags would fix it, but perhaps there is a better way...