GNU bug report logs -
#25459
sed bug: native sed-4.3 appends excessive carriage-returns when run in binary mode on windows
Previous Next
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
Hello,
Thank you for the report.
I do not have access to MSVC, but I can see similar issues when building
with mingw on cygwin64.
Before jumping to the fix, I'd like to show what I'm experiencing,
because there might be a larger issue here.
I'm testing on a Windows R2008 with cygwin64.
I've compared 3 binaries (below):
sed-4.2.2-cygwin.exe:
The default that's installed by cygwin itself.
sed-4.3-cygwin-gcc-5.4.0.exe:
Built from tarball using cygwin's default gcc compiler.
sed-4.3-mingw-64bit.exe:
Built from tarball using:
./configure --host=x86_64-w64-mingw32 --disable-nls
First,
sed-4.2.2 seems to produce incorrect output without "-b":
The output file is not set to text mode, and only '\n' is written
(without '\r').
second,
It seems the new sed-4.3-mingw does output extra '\r',
but only if the input is a file (and not stdin).
So there's some unclear interplay here (unclear to me).
The proposed patch does produce the correct output,
but I'd like to verify it's for the right reasons.
Lastly,
There's also testing needed with in-place writing of files,
and adding tests.
I hope to get to all of these soon.
regards,
- assaf
$ env printf '1\x0D\x0A' > test
$ ./sed-4.2.2-cygwin.exe -b "" < test | od -tx1 -An
31 0d 0a
$ ./sed-4.2.2-cygwin.exe -b "" test | od -tx1 -An
31 0d 0a
$ ./sed-4.2.2-cygwin.exe "" < test | od -tx1 -An
31 0a
$ ./sed-4.2.2-cygwin.exe "" test | od -tx1 -An
31 0a
$ ./sed-4.3-cygwin-gcc-5.4.0.exe -b "" < test | od -tx1 -An
31 0d 0a
$ ./sed-4.3-cygwin-gcc-5.4.0.exe -b "" test | od -tx1 -An
31 0d 0a
$ ./sed-4.3-cygwin-gcc-5.4.0.exe "" < test | od -tx1 -An
31 0d 0a
$ ./sed-4.3-cygwin-gcc-5.4.0.exe "" test | od -tx1 -An
31 0d 0a
$ ./sed-4.3-mingw-64bit.exe -b "" < test | od -tx1 -An
31 0d 0a
$ ./sed-4.3-mingw-64bit.exe -b "" test | od -tx1 -An
31 0d 0d 0a
$ ./sed-4.3-mingw-64bit.exe "" < test | od -tx1 -An
31 0d 0a
$ ./sed-4.3-mingw-64bit.exe "" test | od -tx1 -An
31 0d 0a
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.