GNU bug report logs - #25459
sed bug: native sed-4.3 appends excessive carriage-returns when run in binary mode on windows

Previous Next

Package: sed;

Reported by: Michael Builov <mbuilov <at> gmail.com>

Date: Mon, 16 Jan 2017 16:53:01 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Builov <mbuilov <at> gmail.com>
To: 25459 <at> debbugs.gnu.org
Subject: bug#25459: sed bug: native sed-4.3 appends excessive carriage-returns when run in binary mode on windows
Date: Mon, 16 Jan 2017 13:03:01 +0300
[Message part 1 (text/plain, inline)]
Steps to reproduce.

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

It's hard, but possible, I've done this:
https://github.com/mbuilov/sed-windows/blob/master/sed-4.3-build-patch-howto.txt

(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
[Message part 2 (text/html, inline)]
[sed-4.3-src-stdout.patch (application/octet-stream, attachment)]

This bug report was last modified 6 years and 151 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.