Steps to reproduce.

First it's needed to build native sed.exe on windows.

(Note: don't apply sed-4.3-src.patch in these instructions - it fixes reported bug and build problems with Visual Studio 2008)


Now, if we have working native sed.exe, from cmd.exe

1) create a file containing a line terminated with '\n':

echo.1> test

check "test" contents, dump it:

c:\cygwin64\bin\xxd test
00000000: 310d 0a                                  1..


2) process file "test" with sed in binary mode:

sed\sed.exe -b "" test > test1

dump resulting file "test1":

c:\cygwin64\bin\xxd test1
00000000: 310d 0d0a                                1...


As we can see, there is excessive '0d' in result.


To fix this bug, stdout should be set to binary mode, for example by applying attached patch.



Best Regards,
Michael M. Builov